summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Kinard <kumba@gentoo.org>2020-07-31 00:08:05 -0400
committerJoshua Kinard <kumba@gentoo.org>2020-07-31 00:08:45 -0400
commitd5f9c57fe506f3c38fa8b4e939fc1c1a28c621a2 (patch)
treec043b93c1842d72cd0d2bc87e0becb0b3d63fdd9 /sys-boot
parentwww-misc/shellinabox: ppc64 stable (bug #733488) (diff)
downloadgentoo-d5f9c57fe506f3c38fa8b4e939fc1c1a28c621a2.tar.gz
gentoo-d5f9c57fe506f3c38fa8b4e939fc1c1a28c621a2.tar.bz2
gentoo-d5f9c57fe506f3c38fa8b4e939fc1c1a28c621a2.zip
sys-boot/lilo: EAPI 7 and add NVME support
Signed-off-by: Joshua Kinard <kumba@gentoo.org> Closes: https://bugs.gentoo.org/689940 Package-Manager: Portage-3.0.1, Repoman-2.3.23
Diffstat (limited to 'sys-boot')
-rw-r--r--sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch70
-rw-r--r--sys-boot/lilo/lilo-24.2.ebuild10
2 files changed, 77 insertions, 3 deletions
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
new file mode 100644
index 000000000000..b4d54ec9bc95
--- /dev/null
+++ b/sys-boot/lilo/files/lilo-24.2-add-nvme-support.patch
@@ -0,0 +1,70 @@
+diff -Naurp lilo-24.2.orig/src/common.h lilo-24.2/src/common.h
+--- lilo-24.2.orig/src/common.h 2015-11-21 18:50:23.000000000 -0500
++++ lilo-24.2/src/common.h 2020-07-30 23:20:05.611122665 -0400
+@@ -386,7 +386,7 @@ extern char *config_file;
+ extern FILE *errstd;
+ extern FILE *pp_fd;
+ extern char *identify; /* in identify.c */
+-extern int dm_major_list[16];
++extern int dm_major_list[32];
+ extern int dm_major_nr;
+
+ #define crc(a,b) (~crc32((a),(b),CRC_POLY1))
+diff -Naurp lilo-24.2.orig/src/geometry.c lilo-24.2/src/geometry.c
+--- lilo-24.2.orig/src/geometry.c 2015-11-21 18:50:18.000000000 -0500
++++ lilo-24.2/src/geometry.c 2020-07-30 23:20:05.611122665 -0400
+@@ -84,8 +84,9 @@ DM_TABLE *dmtab = NULL;
+ int dm_version_nr = 0;
+ #endif
+
+-int dm_major_list[16];
++int dm_major_list[32]; /* increased from 16 to allow for nvme disks */
+ int dm_major_nr;
++int nvme_pr = 0; /* set to none zero after geo_init if nvme disk present */
+
+ #ifdef LCF_LVM
+ struct lv_bmap {
+@@ -200,6 +201,9 @@ void geo_init(char *name)
+
+ while(fgets(line, (sizeof line)-1, file)) {
+ if (sscanf(line, "%d %31s\n", &major, major_name) != 2) continue;
++ if (strcmp(major_name, "nvme") !=0) { /* set if nvme drive is present */
++ nvme_pr=-1;
++ }
+ if (strcmp(major_name, "device-mapper") != 0) continue;
+ dm_major_list[dm_major_nr] = major;
+ if (verbose >= 3) {
+@@ -708,6 +712,22 @@ void geo_query_dev(GEOMETRY *geo,int dev
+ geo->start = hdprm.start;
+ break;
+ case MAJOR_SATA1:
++ /* check for nvme device and assume boot/this device is nvme if present */
++ if (nvme_pr != 0) {
++ geo->device = 0x80 + last_dev(MAJOR_IDE,64) + (MINOR(device) >> 4);
++ if (!get_all) break;
++ if (ioctl(fd,HDIO_GETGEO,&hdprm) < 0)
++ die("geo_query_dev HDIO_GETGEO (dev 0x%04x): %s",device,
++ strerror(errno));
++ if (all && !hdprm.sectors)
++ die("HDIO_REQ not supported for your NVME controller. Please "
++ "use a DISK section");
++ geo->heads = hdprm.heads;
++ geo->cylinders = hdprm.cylinders;
++ geo->sectors = hdprm.sectors;
++ geo->start = hdprm.start;
++ break;
++ }
+ case MAJOR_SATA2:
+ printf("WARNING: SATA partition in the high region (>15):\n");
+ printf("LILO needs the kernel in one of the first 15 SATA partitions. If \n");
+diff -Naurp lilo-24.2.orig/src/lilo.h lilo-24.2/src/lilo.h
+--- lilo-24.2.orig/src/lilo.h 2015-11-21 18:50:20.000000000 -0500
++++ lilo-24.2/src/lilo.h 2020-07-30 23:20:05.611122665 -0400
+@@ -245,6 +245,7 @@
+
+ /* high partitions (>15) on SATA hard disks */
+ #define MAJOR_SATA1 259 /* high SATA disk partitions (Block Extended Major) */
++ /* also used by kernel for nvme disks */
+ #define MAJOR_SATA2 260 /* high SATA disk partitions (Block Extended Major) (obsolete) */
+
+
diff --git a/sys-boot/lilo/lilo-24.2.ebuild b/sys-boot/lilo/lilo-24.2.ebuild
index c84d6257d959..73f9ea6efbb4 100644
--- a/sys-boot/lilo/lilo-24.2.ebuild
+++ b/sys-boot/lilo/lilo-24.2.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-EAPI="5"
+EAPI="7"
inherit eutils flag-o-matic toolchain-funcs
@@ -25,10 +25,14 @@ DEPEND=">=sys-devel/bin86-0.15.5"
RDEPEND="device-mapper? ( >=sys-fs/lvm2-2.02.45 )"
src_prepare() {
+ default
+
# this patch is needed when booting PXE and the device you're using
# emulates vga console via serial console.
# 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.
- use pxeserial && epatch "${FILESDIR}/${PN}-24.1-novga.patch"
+ use pxeserial && eapply "${FILESDIR}/${PN}-24.1-novga.patch"
+
+ eapply "${FILESDIR}/${PN}-24.2-add-nvme-support.patch"
# Do not strip and have parallel make
# FIXME: images/Makefile does weird stuff