Gentoo Archives: gentoo-commits

From: Joshua Kinard <kumba@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-boot/lilo/files/, sys-boot/lilo/
Date: Fri, 31 Jul 2020 04:09:19
Message-Id: 1596168525.d5f9c57fe506f3c38fa8b4e939fc1c1a28c621a2.kumba@gentoo
1 commit: d5f9c57fe506f3c38fa8b4e939fc1c1a28c621a2
2 Author: Joshua Kinard <kumba <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 31 04:08:05 2020 +0000
4 Commit: Joshua Kinard <kumba <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 31 04:08:45 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5f9c57f
7
8 sys-boot/lilo: EAPI 7 and add NVME support
9
10 Signed-off-by: Joshua Kinard <kumba <AT> gentoo.org>
11 Closes: https://bugs.gentoo.org/689940
12 Package-Manager: Portage-3.0.1, Repoman-2.3.23
13
14 .../lilo/files/lilo-24.2-add-nvme-support.patch | 70 ++++++++++++++++++++++
15 sys-boot/lilo/lilo-24.2.ebuild | 10 +++-
16 2 files changed, 77 insertions(+), 3 deletions(-)
17
18 diff --git a/sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch b/sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch
19 new file mode 100644
20 index 00000000000..b4d54ec9bc9
21 --- /dev/null
22 +++ b/sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch
23 @@ -0,0 +1,70 @@
24 +diff -Naurp lilo-24.2.orig/src/common.h lilo-24.2/src/common.h
25 +--- lilo-24.2.orig/src/common.h 2015-11-21 18:50:23.000000000 -0500
26 ++++ lilo-24.2/src/common.h 2020-07-30 23:20:05.611122665 -0400
27 +@@ -386,7 +386,7 @@ extern char *config_file;
28 + extern FILE *errstd;
29 + extern FILE *pp_fd;
30 + extern char *identify; /* in identify.c */
31 +-extern int dm_major_list[16];
32 ++extern int dm_major_list[32];
33 + extern int dm_major_nr;
34 +
35 + #define crc(a,b) (~crc32((a),(b),CRC_POLY1))
36 +diff -Naurp lilo-24.2.orig/src/geometry.c lilo-24.2/src/geometry.c
37 +--- lilo-24.2.orig/src/geometry.c 2015-11-21 18:50:18.000000000 -0500
38 ++++ lilo-24.2/src/geometry.c 2020-07-30 23:20:05.611122665 -0400
39 +@@ -84,8 +84,9 @@ DM_TABLE *dmtab = NULL;
40 + int dm_version_nr = 0;
41 + #endif
42 +
43 +-int dm_major_list[16];
44 ++int dm_major_list[32]; /* increased from 16 to allow for nvme disks */
45 + int dm_major_nr;
46 ++int nvme_pr = 0; /* set to none zero after geo_init if nvme disk present */
47 +
48 + #ifdef LCF_LVM
49 + struct lv_bmap {
50 +@@ -200,6 +201,9 @@ void geo_init(char *name)
51 +
52 + while(fgets(line, (sizeof line)-1, file)) {
53 + if (sscanf(line, "%d %31s\n", &major, major_name) != 2) continue;
54 ++ if (strcmp(major_name, "nvme") !=0) { /* set if nvme drive is present */
55 ++ nvme_pr=-1;
56 ++ }
57 + if (strcmp(major_name, "device-mapper") != 0) continue;
58 + dm_major_list[dm_major_nr] = major;
59 + if (verbose >= 3) {
60 +@@ -708,6 +712,22 @@ void geo_query_dev(GEOMETRY *geo,int dev
61 + geo->start = hdprm.start;
62 + break;
63 + case MAJOR_SATA1:
64 ++ /* check for nvme device and assume boot/this device is nvme if present */
65 ++ if (nvme_pr != 0) {
66 ++ geo->device = 0x80 + last_dev(MAJOR_IDE,64) + (MINOR(device) >> 4);
67 ++ if (!get_all) break;
68 ++ if (ioctl(fd,HDIO_GETGEO,&hdprm) < 0)
69 ++ die("geo_query_dev HDIO_GETGEO (dev 0x%04x): %s",device,
70 ++ strerror(errno));
71 ++ if (all && !hdprm.sectors)
72 ++ die("HDIO_REQ not supported for your NVME controller. Please "
73 ++ "use a DISK section");
74 ++ geo->heads = hdprm.heads;
75 ++ geo->cylinders = hdprm.cylinders;
76 ++ geo->sectors = hdprm.sectors;
77 ++ geo->start = hdprm.start;
78 ++ break;
79 ++ }
80 + case MAJOR_SATA2:
81 + printf("WARNING: SATA partition in the high region (>15):\n");
82 + printf("LILO needs the kernel in one of the first 15 SATA partitions. If \n");
83 +diff -Naurp lilo-24.2.orig/src/lilo.h lilo-24.2/src/lilo.h
84 +--- lilo-24.2.orig/src/lilo.h 2015-11-21 18:50:20.000000000 -0500
85 ++++ lilo-24.2/src/lilo.h 2020-07-30 23:20:05.611122665 -0400
86 +@@ -245,6 +245,7 @@
87 +
88 + /* high partitions (>15) on SATA hard disks */
89 + #define MAJOR_SATA1 259 /* high SATA disk partitions (Block Extended Major) */
90 ++ /* also used by kernel for nvme disks */
91 + #define MAJOR_SATA2 260 /* high SATA disk partitions (Block Extended Major) (obsolete) */
92 +
93 +
94
95 diff --git a/sys-boot/lilo/lilo-24.2.ebuild b/sys-boot/lilo/lilo-24.2.ebuild
96 index c84d6257d95..73f9ea6efbb 100644
97 --- a/sys-boot/lilo/lilo-24.2.ebuild
98 +++ b/sys-boot/lilo/lilo-24.2.ebuild
99 @@ -1,7 +1,7 @@
100 -# Copyright 1999-2017 Gentoo Foundation
101 +# Copyright 1999-2020 Gentoo Authors
102 # Distributed under the terms of the GNU General Public License v2
103
104 -EAPI="5"
105 +EAPI="7"
106
107 inherit eutils flag-o-matic toolchain-funcs
108
109 @@ -25,10 +25,14 @@ DEPEND=">=sys-devel/bin86-0.15.5"
110 RDEPEND="device-mapper? ( >=sys-fs/lvm2-2.02.45 )"
111
112 src_prepare() {
113 + default
114 +
115 # this patch is needed when booting PXE and the device you're using
116 # emulates vga console via serial console.
117 # IE.. B.B.o.o.o.o.t.t.i.i.n.n.g.g....l.l.i.i.n.n.u.u.x.x and stair stepping.
118 - use pxeserial && epatch "${FILESDIR}/${PN}-24.1-novga.patch"
119 + use pxeserial && eapply "${FILESDIR}/${PN}-24.1-novga.patch"
120 +
121 + eapply "${FILESDIR}/${PN}-24.2-add-nvme-support.patch"
122
123 # Do not strip and have parallel make
124 # FIXME: images/Makefile does weird stuff