wok-current rev 25638
Add lilo patch and example config
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Tue Jan 16 18:08:04 2024 +0000 (10 months ago) |
parents | adb82ce06cee |
children | 7e95bf4819fa |
files | lilo/receipt lilo/stuff/lilo.conf lilo/stuff/lilo.ignore.usable.memory.above.4G.diff lilo/stuff/lilo.nvme.support.diff |
line diff
1.1 --- a/lilo/receipt Mon Jan 15 22:12:34 2024 +0000 1.2 +++ b/lilo/receipt Tue Jan 16 18:08:04 2024 +0000 1.3 @@ -34,5 +34,22 @@ 1.4 # Rules to gen a SliTaz package suitable for Tazpkg. 1.5 genpkg_rules() 1.6 { 1.7 + mkdir -p $fs/usr/share/examples/lilo 1.8 cp -a $install/sbin $fs 1.9 + cp $stuff/lilo.conf $fs/usr/share/examples/lilo 1.10 } 1.11 + 1.12 +post_install() 1.13 +{ 1.14 + cat <<EOT 1.15 + 1.16 +# Copy example configuration file to /etc: 1.17 +cp /usr/share/examples/lilo/lilo.conf /etc/lilo.conf 1.18 + 1.19 +# To modify default configuration, edit 1.20 +/etc/lilo.conf 1.21 + 1.22 +# To install lilo to MBR on device sda enter: 1.23 +lilo 1.24 +EOT 1.25 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/lilo/stuff/lilo.conf Tue Jan 16 18:08:04 2024 +0000 2.3 @@ -0,0 +1,10 @@ 2.4 +boot=/dev/sda 2.5 +prompt 2.6 +timeout = 10 2.7 +compact 2.8 +vga = normal 2.9 +lock 2.10 +image = /boot/vmlinuz-4.19.298-slitaz 2.11 + label = "SliTaz" 2.12 + root = /dev/sda1 2.13 + read-only
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/lilo/stuff/lilo.ignore.usable.memory.above.4G.diff Tue Jan 16 18:08:04 2024 +0000 3.3 @@ -0,0 +1,42 @@ 3.4 +From Sl4ck3ver on LQ: 3.5 +http://www.linuxquestions.org/questions/slackware-14/[patch]-found-a-nasty-lilo-bug-with-a-2-line-fix-for-14-2-a-4175577969/ 3.6 + 3.7 +Every BIOS-e820 entry contains start and size of the area as 64-bit value 3.8 +and is shifted right 10 bits (1024) with "shrd" while searching for the 3.9 +largest "usable" memory range entry. 3.10 + 3.11 + 3.12 +Finally the found values are converted back into real addresses by shifting 3.13 +left 10 bits... 3.14 + 3.15 +BUT this is done the wrong only using a 32-bit register so the high dword is lost!!! 3.16 + 3.17 +0x000000027fffffff gets 0x000000007fffffff :-( 3.18 + 3.19 +Every EXISTING system which happens to work fine just happens to 3.20 +have an entry which just contains "usable" memory at that address. 3.21 +Often in the form of an entry like: 3.22 + 3.23 +BIOS-e820: [mem 0x0000000000100000-0x00000000fxxxxxxx] usable 3.24 + 3.25 +Virtually all systems have "usable" memory at that position, so until 3.26 +now this bug was not noticed! 3.27 + 3.28 + 3.29 +HERE IS THE FIX, A 2-LINER: 3.30 +=========================== 3.31 + 3.32 +Ignore any usable memory range not starting below 4GB and 3.33 +so avoid the truncation, really just a work around :-) 3.34 + 3.35 +--- ./src/second.S.orig 2016-04-21 15:12:57.155456806 -0500 3.36 ++++ ./src/second.S 2016-04-21 15:15:08.918466313 -0500 3.37 +@@ -2975,6 +2975,8 @@ 3.38 + shrd memmap+8,eax,#10 ; convert to 1k 3.39 + cmp dword memmap,#1024 ; below 1M 3.40 + jb e8go2 ; below 1M, no interest 3.41 ++ cmp dword memmap,#4*1024*1024 ; above 4G 3.42 ++ jae e8go2 ; above 4G, no interest 3.43 + cmp esi,memmap+8 ; check size 3.44 + ja e8go2 ; want largest 3.45 + mov edx,memmap ; start (in 1k)
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/lilo/stuff/lilo.nvme.support.diff Tue Jan 16 18:08:04 2024 +0000 4.3 @@ -0,0 +1,70 @@ 4.4 +diff -Naru lilo-24.2/src/common.h lilo-24.2.new/src/common.h 4.5 +--- lilo-24.2/src/common.h 2015-11-21 23:50:23.000000000 +0000 4.6 ++++ lilo-24.2.new/src/common.h 2018-02-15 15:13:17.411968439 +0000 4.7 +@@ -386,7 +386,7 @@ 4.8 + extern FILE *errstd; 4.9 + extern FILE *pp_fd; 4.10 + extern char *identify; /* in identify.c */ 4.11 +-extern int dm_major_list[16]; 4.12 ++extern int dm_major_list[32]; 4.13 + extern int dm_major_nr; 4.14 + 4.15 + #define crc(a,b) (~crc32((a),(b),CRC_POLY1)) 4.16 +diff -Naru lilo-24.2/src/geometry.c lilo-24.2.new/src/geometry.c 4.17 +--- lilo-24.2/src/geometry.c 2015-11-21 23:50:18.000000000 +0000 4.18 ++++ lilo-24.2.new/src/geometry.c 2018-02-15 16:10:25.844149725 +0000 4.19 +@@ -84,8 +84,9 @@ 4.20 + int dm_version_nr = 0; 4.21 + #endif 4.22 + 4.23 +-int dm_major_list[16]; 4.24 ++int dm_major_list[32]; /* increased from 16 to allow for nvme disks */ 4.25 + int dm_major_nr; 4.26 ++int nvme_pr = 0; /* set to none zero after geo_init if nvme disk present */ 4.27 + 4.28 + #ifdef LCF_LVM 4.29 + struct lv_bmap { 4.30 +@@ -200,6 +201,9 @@ 4.31 + 4.32 + while(fgets(line, (sizeof line)-1, file)) { 4.33 + if (sscanf(line, "%d %31s\n", &major, major_name) != 2) continue; 4.34 ++ if (strcmp(major_name, "nvme") !=0) { /* set if nvme drive is present */ 4.35 ++ nvme_pr=-1; 4.36 ++ } 4.37 + if (strcmp(major_name, "device-mapper") != 0) continue; 4.38 + dm_major_list[dm_major_nr] = major; 4.39 + if (verbose >= 3) { 4.40 +@@ -708,6 +712,22 @@ 4.41 + geo->start = hdprm.start; 4.42 + break; 4.43 + case MAJOR_SATA1: 4.44 ++ /* check for nvme device and assume boot/this device is nvme if present */ 4.45 ++ if (nvme_pr != 0) { 4.46 ++ geo->device = 0x80 + last_dev(MAJOR_IDE,64) + (MINOR(device) >> 4); 4.47 ++ if (!get_all) break; 4.48 ++ if (ioctl(fd,HDIO_GETGEO,&hdprm) < 0) 4.49 ++ die("geo_query_dev HDIO_GETGEO (dev 0x%04x): %s",device, 4.50 ++ strerror(errno)); 4.51 ++ if (all && !hdprm.sectors) 4.52 ++ die("HDIO_REQ not supported for your NVME controller. Please " 4.53 ++ "use a DISK section"); 4.54 ++ geo->heads = hdprm.heads; 4.55 ++ geo->cylinders = hdprm.cylinders; 4.56 ++ geo->sectors = hdprm.sectors; 4.57 ++ geo->start = hdprm.start; 4.58 ++ break; 4.59 ++ } 4.60 + case MAJOR_SATA2: 4.61 + printf("WARNING: SATA partition in the high region (>15):\n"); 4.62 + printf("LILO needs the kernel in one of the first 15 SATA partitions. If \n"); 4.63 +diff -Naru lilo-24.2/src/lilo.h lilo-24.2.new/src/lilo.h 4.64 +--- lilo-24.2/src/lilo.h 2015-11-21 23:50:20.000000000 +0000 4.65 ++++ lilo-24.2.new/src/lilo.h 2018-02-15 15:27:35.647786827 +0000 4.66 +@@ -245,6 +245,7 @@ 4.67 + 4.68 + /* high partitions (>15) on SATA hard disks */ 4.69 + #define MAJOR_SATA1 259 /* high SATA disk partitions (Block Extended Major) */ 4.70 ++ /* also used by kernel for nvme disks */ 4.71 + #define MAJOR_SATA2 260 /* high SATA disk partitions (Block Extended Major) (obsolete) */ 4.72 + 4.73 +