summaryrefslogtreecommitdiffstats
path: root/disk
diff options
context:
space:
mode:
authorFlorian Franzmann2021-05-27 17:40:27 +0200
committerFlorian Franzmann2021-06-01 00:44:20 +0200
commit490a789c098f3e7bb9fd39916729c01326388257 (patch)
tree1c35db1c1943ce1000816dcc619cc81b9135a2b4 /disk
parentd30c644eb23186306758187b3a4e1aba4cc45b82 (diff)
disk/lilo: fix error during linking
Diffstat (limited to 'disk')
-rw-r--r--disk/lilo/HISTORY7
-rwxr-xr-xdisk/lilo/PRE_BUILD4
-rw-r--r--disk/lilo/patches/lilo-24.2-add-nvme-support.patch70
-rw-r--r--disk/lilo/patches/lilo-24.x-fix-gcc-10.patch51
4 files changed, 132 insertions, 0 deletions
diff --git a/disk/lilo/HISTORY b/disk/lilo/HISTORY
index 9ee6d3b8b1..bbb5a8da36 100644
--- a/disk/lilo/HISTORY
+++ b/disk/lilo/HISTORY
@@ -1,3 +1,10 @@
+2021-05-27 Florian Franzmann <bwlf@bandrate.org>
+ * PRE_BUILD,
+ patches/{lilo-24.2-add-nvme-support.patch,lilo-24.x-fix-gcc-10.patch}:
+ apply patches from Gentoo to add support for nvme and fix linker error
+ with gcc >= 10
+
+
2019-01-19 Treeve Jelbert <treeve@sourcemage.org>
* DEPENDS: delete gnupg
diff --git a/disk/lilo/PRE_BUILD b/disk/lilo/PRE_BUILD
new file mode 100755
index 0000000000..8821392c25
--- /dev/null
+++ b/disk/lilo/PRE_BUILD
@@ -0,0 +1,4 @@
+default_pre_build &&
+cd "$SOURCE_DIRECTORY" &&
+
+apply_patch_dir patches
diff --git a/disk/lilo/patches/lilo-24.2-add-nvme-support.patch b/disk/lilo/patches/lilo-24.2-add-nvme-support.patch
new file mode 100644
index 0000000000..b4d54ec9bc
--- /dev/null
+++ b/disk/lilo/patches/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/disk/lilo/patches/lilo-24.x-fix-gcc-10.patch b/disk/lilo/patches/lilo-24.x-fix-gcc-10.patch
new file mode 100644
index 0000000000..c46b9eebde
--- /dev/null
+++ b/disk/lilo/patches/lilo-24.x-fix-gcc-10.patch
@@ -0,0 +1,51 @@
+Description: Fix ftbfs with GCC-10
+
+Author: Ryan Finnie <ryan@finnie.org>
+Bug-Debian: https://bugs.debian.org/957490
+Forwarded: no
+
+---
+
+--- a/src/raid.h
++++ b/src/raid.h
+@@ -8,7 +8,7 @@
+ * in the source directory.
+ */
+
+-int do_md_install, ndisk, md_bios;
++extern int ndisk, md_bios;
+
+ int raid_setup(void);
+ void raid_final(void);
+--- a/src/bsect.c
++++ b/src/bsect.c
+@@ -54,8 +54,6 @@
+ #endif
+
+
+-int boot_dev_nr;
+-
+ static BOOT_SECTOR bsect,bsect_orig;
+ static MENUTABLE menuparams;
+ static DESCR_SECTORS descrs;
+--- a/src/identify.c
++++ b/src/identify.c
+@@ -19,7 +19,6 @@
+ #include "common.h"
+ #include "cfg.h"
+
+-char *identify;
+ static char *opt;
+ static char *first, *dflt;
+ static int idefault;
+--- a/src/raid.c
++++ b/src/raid.c
+@@ -41,7 +41,7 @@
+ static int raid_bios[MAX_RAID+1];
+ static int device;
+ enum {MD_NULL=0, MD_PARALLEL, MD_MIXED, MD_SKEWED};
+-int do_md_install, ndisk, md_bios;
++int ndisk, md_bios;
+ static char *raid_list[MAX_RAID];
+ static int list_index[MAX_RAID];
+ static int nlist, faulty;