summaryrefslogtreecommitdiff
path: root/user/lilo
diff options
context:
space:
mode:
authorA. Wilcox <awilcox@wilcox-tech.com>2020-03-22 10:36:34 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2020-03-22 10:36:34 +0000
commit8f4e2366f08fd0ad6903d3bc4b149352ea0443f6 (patch)
treed20d55e3b5e9336405f5f1bba05c2c0fc4cd55fc /user/lilo
parent7a8eb9c1a4a9c2f3e3a3228266bcba74ab298c23 (diff)
parent4c63cae23bf6fc07dfe85c0aa2b9b7701cf28933 (diff)
downloadpackages-8f4e2366f08fd0ad6903d3bc4b149352ea0443f6.tar.gz
packages-8f4e2366f08fd0ad6903d3bc4b149352ea0443f6.tar.bz2
packages-8f4e2366f08fd0ad6903d3bc4b149352ea0443f6.tar.xz
packages-8f4e2366f08fd0ad6903d3bc4b149352ea0443f6.zip
Merge branch 'lilo' into 'master'
Add the LILO bootloader See merge request adelie/packages!412
Diffstat (limited to 'user/lilo')
-rw-r--r--user/lilo/APKBUILD51
-rw-r--r--user/lilo/adelie.patch400
-rw-r--r--user/lilo/cflags.patch13
-rw-r--r--user/lilo/lilo.conf.template23
-rw-r--r--user/lilo/lilo.trigger93
-rw-r--r--user/lilo/musl.patch81
-rw-r--r--user/lilo/partuuid.patch65
7 files changed, 726 insertions, 0 deletions
diff --git a/user/lilo/APKBUILD b/user/lilo/APKBUILD
new file mode 100644
index 000000000..606b633b3
--- /dev/null
+++ b/user/lilo/APKBUILD
@@ -0,0 +1,51 @@
+# Maintainer: Max Rees <maxcrees@me.com>
+pkgname=lilo
+pkgver=24.2
+pkgrel=0
+pkgdesc="Minimal BIOS bootloader for x86 systems"
+url="https://www.joonet.de/lilo/"
+arch="pmmx x86 x86_64"
+options="!check" # No test suite.
+license="BSD-3-Clause AND GPL-2.0+ AND Public-Domain"
+depends="perl"
+makedepends="dev86 linux-headers lvm2-dev sharutils"
+subpackages="$pkgname-doc"
+triggers="$pkgname.trigger=/boot"
+source="https://www.joonet.de/lilo/ftp/sources/lilo-$pkgver.tar.gz
+ adelie.patch
+ cflags.patch
+ musl.patch
+ partuuid.patch
+ lilo.conf.template
+ "
+
+build() {
+ export CFLAGS="$CFLAGS -fno-strict-aliasing"
+ make
+}
+
+package() {
+ make DESTDIR="$pkgdir" install
+
+ rm -rf "$pkgdir"/etc/lilo/kernel \
+ "$pkgdir"/etc/lilo/initramfs \
+ "$pkgdir"/usr/sbin/mkrescue \
+ "$pkgdir"/usr/share/man/man8/mkrescue.8
+
+ mkdir "$pkgdir"/boot/lilo/gfx
+ mv "$pkgdir"/boot/lilo/*.bmp \
+ "$pkgdir"/boot/lilo/*.dat \
+ "$pkgdir"/boot/lilo/gfx
+
+ install -Dm644 "$srcdir"/lilo.conf.template \
+ "$pkgdir"/etc/lilo/lilo.conf.template
+ mv "$pkgdir"/etc/lilo/lilo.conf_example \
+ "$pkgdir"/etc/lilo/lilo.conf.example
+}
+
+sha512sums="4437cae21345f483194a5dc95f686f3f3cb2beec78faae3fba959db25eae29fe2c56732e055c05f1d101682c5d442cdc9561fae8074f61f5537dde0413204c54 lilo-24.2.tar.gz
+cf8dab563e88cc7b280f5740c3b0f25049b9ce27c77a67e7b0c55dc21a158f8b2998f0c7743f11bcc4ae893697e6b6cc56054a40919899bf2d6d79b4e1a59190 adelie.patch
+ed1ffb03dbbbf6fe6974d045005f72b3657d470cd3f3556d582e09a38836090c3e75a684a1dcfbe7ade91e5ada3706b712ae7111460df85454518a746c60bde4 cflags.patch
+1c1ce61d2d7c88c1ba66e1415b36edb6743f46a50857b5bcd2b6b28a0711e4de3f0a75c352a5997bc9b5d50b0754c49a3f69b736e07a6e389c02da004289c64f musl.patch
+3962bf30a866f31fa5263618210d61ac5663117cac1d5a52a5e14f3665ff8edfd628c80807591f3da5f2e6908b8c0af9b19fac32f6ab90e6c4755bf79cb34d5a partuuid.patch
+489f57d29ee6607fb7040a33655bc369a510290804ae11686e02ba91d6cd3401175fa93d8d74da6058f03126b924004d28d5145ec5df70be4d04acba112c5729 lilo.conf.template"
diff --git a/user/lilo/adelie.patch b/user/lilo/adelie.patch
new file mode 100644
index 000000000..29983faff
--- /dev/null
+++ b/user/lilo/adelie.patch
@@ -0,0 +1,400 @@
+Adjust paths so that lilo has its own dir in /etc and /boot.
+
+--- lilo-24.2/make.vars 2013-06-07 02:50:30.000000000 -0500
++++ lilo-24.2/make.vars 2020-03-19 15:50:13.710057044 -0500
+@@ -90,8 +90,8 @@ OPT=-Os
+ #
+
+ SBIN_DIR=/sbin
+-CFG_DIR=/etc
+-BOOT_DIR=/boot
++CFG_DIR=/etc/lilo
++BOOT_DIR=/boot/lilo
+ USRSBIN_DIR=/usr/sbin
+ BUILTIN=1
+
+--- lilo-24.2/src/config.h 2011-06-22 02:13:58.000000000 -0500
++++ lilo-24.2/src/config.h 2020-03-19 15:34:21.320045281 -0500
+@@ -39,8 +39,8 @@
+ #define DFL_CHAIN LILO_DIR "/chain.b" /* default chain loader */
+ #define DFL_MBR LILO_DIR "/mbr.b" /* default MBR */
+ #else
+-#define CFG_DIR "/etc" /* location of configuration files */
+-#define BOOT_DIR "/boot" /* location of boot files */
++#define CFG_DIR "/etc/lilo" /* location of configuration files */
++#define BOOT_DIR "/boot/lilo" /* location of boot files */
+ #define BACKUP_DIR BOOT_DIR /* boot sector and partition table backups */
+ #define DFL_CONFIG CFG_DIR "/lilo.conf"/* default configuration file */
+ #define DFL_DISKTAB CFG_DIR "/disktab" /* LILO's disk parameter table */
+--- lilo-24.2/sample/lilo.example.conf 2015-11-20 14:50:03.000000000 -0600
++++ lilo-24.2/sample/lilo.example.conf 2020-03-19 15:53:08.030059197 -0500
+@@ -1,4 +1,4 @@
+-# /etc/lilo.conf - systemwide LILO configuration (LILO 24)
++# /etc/lilo/lilo.conf - systemwide LILO configuration (LILO 24)
+ # details see in manpages: lilo(8) and lilo.conf(5)
+
+ # +-------------------------------------------------------------+
+@@ -50,7 +50,7 @@ root = /dev/sda1
+ # Specifies the location of the map file. Lilo creates the (sector)
+ # map file of direct sector addresses which are independent of any
+ # filesystem.
+-map = /boot/map
++map = /boot/lilo/map
+
+ # ---------------------------------------------------------------
+
+@@ -63,7 +63,7 @@ install = menu
+ # A) Customized boot message for choice 'text'.
+ # For the simple text menu you can set an extra message in the
+ # created file. Its text will be displayed before boot prompt.
+-#message = /boot/message.txt
++#message = /boot/lilo/message.txt
+
+ # B) Configuration of the scheme for choice 'menu'.
+ # Use following coding: <text>:<highlight>:<border>:<title>
+@@ -83,7 +83,7 @@ menu-scheme = Wb:Yr:Wb:Wb
+ # with 16 colors: onlyblue, tuxlogo, inside
+ # with 256 colors: coffee
+ # for Debian: debianlilo, debian, debian-de
+-#bitmap = /boot/tuxlogo.bmp
++#bitmap = /boot/lilo/gfx/tuxlogo.bmp
+
+ # ---------------------------------------------------------------
+
+--- lilo-24.2/scripts/liloconfig 2015-11-21 18:00:21.000000000 -0600
++++ lilo-24.2/scripts/liloconfig 2020-03-19 15:23:42.240037388 -0500
+@@ -44,7 +44,7 @@ getopts('hvfu');
+ pod2usage(1) if $opt_h;
+
+ #---- other variables
+-our $liloconf = "/etc/lilo.conf";
++our $liloconf = "/etc/lilo/lilo.conf";
+ our $conftmp_1 = "/tmp/lilotmp1";
+ our $conftmp_2 = "/tmp/lilotmp2";
+ our $liloconfold = $liloconf . ".old";
+@@ -54,7 +54,7 @@ our $fstabconf = "/etc/fstab";
+ our $idpath = "/dev/disk/by-id";
+ our $uuidpath = "/dev/disk/by-uuid";
+ our $lblpath = "/dev/disk/by-label";
+-our $template = "/usr/share/doc/lilo/examples/lilo.example.conf.gz";
++our $template = "/etc/lilo/lilo.conf.template";
+
+ our $rootpart; # found root part
+ our $root_dev; # /dev/hdX9, /dev/sdX9, /dev/md/*
+@@ -399,8 +401,12 @@ sub copy_template {
+
+ # copy template config
+ if (-f $template) {
+- system("gzip -d -c $template >$conftmp_1") if ($template =~ /\.gz$/);
+- system("cat $template >$conftmp_1") if ($template =~ /\.conf$/);
++ if ($template =~ /\.gz$/) {
++ system("gzip -d -c $template >$conftmp_1");
++ }
++ else {
++ system("cat $template >$conftmp_1");
++ }
+
+ open(CONFTMP1, "<$conftmp_1") or die "$prog: couldn't open $conftmp_1: $!\n";
+ open(CONFTMP2, ">$conftmp_2") or die "$prog: couldn't open $conftmp_2: $!\n";
+@@ -418,7 +418,7 @@ sub copy_template {
+ }
+ else {
+ open(CONFTMP2, ">$conftmp_2") or die "$prog: couldn't open $conftmp_2: $!\n";
+- print CONFTMP2 "# /etc/lilo.conf
++ print CONFTMP2 "# /etc/lilo/lilo.conf
+
+ ### LILO global section ###
+
+@@ -426,7 +426,7 @@ sub copy_template {
+ lba32
+ boot = /dev/sda
+ root = /dev/sda1
+-map = /boot/map
++map = /boot/lilo/map
+ install = menu
+ menu-scheme = Wb:Yr:Wb:Wb
+ prompt
+@@ -781,7 +781,7 @@ lilo.conf file you find many useful comm
+ Please pay attention about error messages if liloconfig cannot find
+ any images (/boot/vmlinuz*) oder image symlinks (/vmlinuz, /vmlinu.old).
+ Then you need to search for images by ourself and make some changes
+-in the '/etc/lilo.conf' file. Otherwise no bootloader can be installed
++in the '/etc/lilo/lilo.conf' file. Otherwise no bootloader can be installed
+ with '/sbin/lilo'.
+
+ =head1 OPTIONS
+@@ -808,7 +808,7 @@ Force overriding/update of boot line in
+
+ =head1 EXAMPLES
+
+-Lines in the configuration file /etc/lilo.conf:
++Lines in the configuration file /etc/lilo/lilo.conf:
+
+ ### LILO global section ###
+
+@@ -818,7 +818,7 @@ Lines in the configuration file /etc/lil
+ boot = /dev/disk/by-id/ata-SAMSUNG_SV1604N_S01FJ10X999999
+ #root = /dev/sda1
+ root = "UUID=18843936-00f9-4df0-a373-000d05a5dd44"
+- map = /boot/map
++ map = /boot/lilo/map
+ install = menu
+ menu-scheme = Wb:Yr:Wb:Wb
+ prompt
+--- lilo-24.2/scripts/lilo-uuid-diskid 2014-10-16 16:53:29.000000000 -0500
++++ lilo-24.2/scripts/lilo-uuid-diskid 2020-03-19 15:28:07.360040662 -0500
+@@ -1,7 +1,7 @@
+ #!/usr/bin/perl -w
+
+ # lilo-uuid-diskid - convert boot and root options to diskid
+-# and uuid in /etc/lilo.conf
++# and uuid in /etc/lilo/lilo.conf
+ #
+ # Copyright 2010-2014 Joachim Wiedorn <joodevel at joonet.de>
+ #
+@@ -41,7 +41,7 @@ getopts('hv');
+ pod2usage(1) if $opt_h;
+
+ #---- other variables
+-our $liloconf = "/etc/lilo.conf";
++our $liloconf = "/etc/lilo/lilo.conf";
+ our $liloconfold = $liloconf . ".old";
+ our $liloconfnew = $liloconf . ".new";
+ our $fstabconf = "/etc/fstab";
+@@ -454,7 +454,7 @@ Print verbose messages.
+
+ =head1 EXAMPLES
+
+-Lines in the configuration file /etc/lilo.conf:
++Lines in the configuration file /etc/lilo/lilo.conf:
+
+ #boot = /dev/sda
+ boot = /dev/disk/by-id/ata-SAMSUNG_SV1604N_S01FJ10X999999
+--- lilo-24.2/man/keytab-lilo.8 2010-06-28 15:41:18.000000000 -0500
++++ lilo-24.2/man/keytab-lilo.8 2020-03-19 16:01:06.730065109 -0500
+@@ -37,7 +37,7 @@ to set the keyboard type when booting
+ [using the
+ .B keytable
+ parameter in
+-.BR /etc/lilo.conf ].
++.BR /etc/lilo/lilo.conf ].
+
+ .I kbd_layout
+ should be the name of a map file which specifies the desired
+@@ -68,7 +68,7 @@ output, so you should redirect it to a s
+ .B lilo
+ has no particular restrictions on the name of keyboard translation
+ files, but the suggested naming convention and location is
+-.BI /boot/ mapping .ktl
++.BI /boot/lilo/ mapping .ktl
+ (where
+ .B .ktl
+ stands for "Keyboard Table for Lilo").
+@@ -86,11 +86,11 @@ respectively.
+
+ .SH "EXAMPLES"
+ .TP
+-.B keytab\-lilo dvorak >/boot/dvorak.ktl
++.B keytab\-lilo dvorak >/boot/lilo/dvorak.ktl
+
+ This is the most common form of invocation; it simply compiles the
+ given map file (in this case dvorak) and puts the result in
+-.BR /boot/dvorak.ktl .
++.BR /boot/lilo/dvorak.ktl .
+
+ .SH "AUTHOR"
+ Werner Almesberger (almesber@bernina.ethz.ch).
+--- lilo-24.2/man/lilo-uuid-diskid.8 2015-11-21 17:25:42.000000000 -0600
++++ lilo-24.2/man/lilo-uuid-diskid.8 2020-03-19 15:59:05.390063610 -0500
+@@ -100,7 +100,7 @@ Print a brief help.
+ Print verbose messages.
+ .SH "EXAMPLES"
+ .IX Header "EXAMPLES"
+-Lines in the configuration file /etc/lilo.conf:
++Lines in the configuration file /etc/lilo/lilo.conf:
+ .PP
+ .Vb 2
+ \& #boot = /dev/sda
+--- lilo-24.2/man/lilo.8 2015-11-21 17:25:31.000000000 -0600
++++ lilo-24.2/man/lilo.8 2020-03-19 16:01:39.580065515 -0500
+@@ -108,7 +108,7 @@ Auxiliary uses:
+ .SH "DESCRIPTION"
+ .IX Header "DESCRIPTION"
+ lilo installs a boot loader that will be activated the next time you boot
+-your system. The default configuration file \fI/etc/lilo.conf\fR (see manpage
++your system. The default configuration file \fI/etc/lilo/lilo.conf\fR (see manpage
+ \&\fIlilo.conf\fR\|(5)) will contain most options, but many, including those which
+ override the configuration file, may be specified on the command line.
+ .SH "OPTIONS"
+@@ -140,7 +140,7 @@ Speeds up the booting especially from fl
+ .IP "\fB\-C\fR \fIconfig-file\fR" 4
+ .IX Item "-C config-file"
+ Set another pathname and filename for the configuration file. The default
+-configuration file is \fI/etc/lilo.conf\fR.
++configuration file is \fI/etc/lilo/lilo.conf\fR.
+ .IP "\fB\-d\fR \fIdelay-time\fR" 4
+ .IX Item "-d delay-time"
+ Set the delay time in tenths of a second ('20' = 2 sec) before automatically
+@@ -171,7 +171,7 @@ header will be lost. It can be restored
+ a text-based backup for the \s-1LILO\s0 header information.
+ .IP "\fB\-f\fR \fIdisk-tab\fR" 4
+ .IX Item "-f disk-tab"
+-Set another disk geometry parameter file. The default is \fI/etc/disktab\fR.
++Set another disk geometry parameter file. The default is \fI/etc/lilo/disktab\fR.
+ .IP "\fB\-F\fR" 4
+ .IX Item "-F"
+ Override boot sector check for filesystems (e.g., swap, ext4, xfs ...) which
+@@ -204,7 +204,7 @@ addresses, allowing access to all partit
+ (This is the default geometry).
+ .IP "\fB\-m\fR \fImap-file\fR" 4
+ .IX Item "-m map-file"
+-Use another map file instead of the default file /boot/map.
++Use another map file instead of the default file /boot/lilo/map.
+ .IP "\fB\-M\fR \fImaster-device\fR \fB{mbr|ext}\fR" 4
+ .IX Item "-M master-device {mbr|ext}"
+ Install a Master Boot Record on the device specified as master-device, selecting
+@@ -232,7 +232,7 @@ sector. Compare with the '\-F' flag, whi
+ boot sector.
+ .Sp
+ \&\fB<global\-option>\fR allows the passing of any global option which may
+-appear in the global section (top) of the configuration file (\fI/etc/lilo.conf\fR).
++appear in the global section (top) of the configuration file (\fI/etc/lilo/lilo.conf\fR).
+ For instance \fI'\-P nowarn'\fR will pass the 'nowarn' option, just as though 'nowarn'
+ appeared in the configuration file (same as the '\-w' switch). Similarly
+ \&\fI'\-P timeout=50'\fR will add or override the 'timeout=' line in the configuration
+@@ -241,7 +241,7 @@ line option switches. However, it is not
+ cause an override of other options; e.g. '\-g' (\-P geometric), '\-L' (\-P lba32).
+ .IP "\fB\-q\fR" 4
+ .IX Item "-q"
+-List the currently mapped files. \fBlilo\fR maintains a file, by default \fI/boot/map\fR,
++List the currently mapped files. \fBlilo\fR maintains a file, by default \fI/boot/lilo/map\fR,
+ containing each name and location of the kernel(s) to boot. This option will list
+ the names therein. Use with \fB\-v\fR for more detailed information about the
+ installed boot loader.
+@@ -249,7 +249,7 @@ installed boot loader.
+ .IX Item "-r root-directory"
+ Before doing anything else, do a \fI'chroot'\fR to the indicated directory. The new
+ root directory must contain a \fI/dev\fR directory and may need a /boot directory.
+-It may also need an \fI/etc/lilo.conf\fR file.
++It may also need an \fI/etc/lilo/lilo.conf\fR file.
+ .IP "\fB\-R\fR \fIcommand-line\fR" 4
+ .IX Item "-R command-line"
+ This option sets the default command for the boot loader for the next time it
+@@ -267,13 +267,13 @@ Refer to \fI\fIlilo.conf\fI\|(5)\fR for
+ .IP "\fB\-s\fR \fIsave-file\fR" 4
+ .IX Item "-s save-file"
+ When lilo writes a new boot sector, it preserves the former contents of the boot
+-sector in a file, named by default /boot/boot.NNNN, where \s-1NNNN\s0 is the hexadecimal
++sector in a file, named by default /boot/lilo/boot.NNNN, where \s-1NNNN\s0 is the hexadecimal
+ representation of the major and minor device numbers of the drive/partition.
+ .Sp
+ This option defines the backup save file in one of three ways: a save directory
+-(default is '/boot') using the default filename 'boot.NNNN' in the defined
++(default is '/boot/lilo') using the default filename 'boot.NNNN' in the defined
+ directory; a pathname template to which '.NNNN' is appended (default would be
+-\&'/boot/boot'); or the full pathname of the file, which must include the correct
++\&'/boot/lilo/boot'); or the full pathname of the file, which must include the correct
+ \&'.NNNN' suffix. When used with the \-u option, the full file pathname must be set.
+ .IP "\fB\-S\fR \fIsave-file\fR" 4
+ .IX Item "-S save-file"
+@@ -386,7 +386,7 @@ removed from the command line before it
+ noted.
+ .IP "\fBlock\fR" 4
+ .IX Item "lock"
+-Locks the command line, as though 'lock' had been defined in \fI/etc/lilo.conf\fR.
++Locks the command line, as though 'lock' had been defined in \fI/etc/lilo/lilo.conf\fR.
+ .IP "\fBmem=###[,K,M,G]\fR" 4
+ .IX Item "mem=###[,K,M,G]"
+ Set the maximum memory in the system in bytes, kilobytes, megabytes or gigabytes.
+--- lilo-24.2/man/lilo.conf.5 2013-06-07 14:17:39.000000000 -0500
++++ lilo-24.2/man/lilo.conf.5 2020-03-19 16:01:57.970065742 -0500
+@@ -25,13 +25,13 @@ lilo.conf \- configuration file for lilo
+ .SH DESCRIPTION
+ .LP
+ This file, by default
+-.IR /etc/lilo.conf ,
++.IR /etc/lilo/lilo.conf ,
+ is read by the boot loader installer 'lilo' (see lilo(8)).
+ .LP
+ It might look as follows:
+ .IP
+ .nf
+-# /etc/lilo.conf
++# /etc/lilo/lilo.conf
+ #
+ # global options:
+ boot=/dev/hda
+@@ -111,7 +111,7 @@ All RAID installations should use only t
+ multiple backups may be created. The '.NNNN' suffix is the hexadecimal
+ representation of the major and minor device numbers of the device or
+ partition. If this option is not specified, the default name of boot sector
+-backups is '/boot/boot.NNNN'. If a backup already exists, it will be
++backups is '/boot/lilo/boot.NNNN'. If a backup already exists, it will be
+ preserved, rather than overwritten. C.f., \fBforce-backup=\fP below.
+ .TP
+ .BI "bios-passes-dl=" <option>
+@@ -334,7 +334,7 @@ viz.,
+ .BI "disktab=" <disktab-file>
+ Specifies the name of the disk parameter table.
+ The map installer looks for
+-.I /etc/disktab
++.I /etc/lilo/disktab
+ if `disktab' is omitted. The use of disktabs is discouraged.
+ .TP
+ .BI "el-torito-bootable-CD"
+@@ -436,7 +436,7 @@ The per-image password option `mandatory
+ .TP
+ .BI "map=" <map-file>
+ Specifies the location of the map file. If `map' is omitted, the file
+-.I /boot/map
++.I /boot/lilo/map
+ is used.
+
+ On machines with a pre-1998 BIOS, the EDD bios extensions which are required
+@@ -812,7 +812,7 @@ requirements of the boot-installer parse
+ an operator. The kernel command line parser is very much simpler, and
+ must not see any quotation marks. Simply stated, only use the quotation
+ marks within
+-.IR /etc/lilo.conf .
++.IR /etc/lilo/lilo.conf .
+ .TP
+ .BI "vga=" <mode>
+ This specifies the VGA text mode that should be selected when
+@@ -1027,7 +1027,7 @@ at the time the boot loader is installed
+ the password, it should be specified: \fBpassword=""\fP.
+ Passwords entered interactively are not required to be entered again if the
+ boot installer is re-run. They are cached, in hashed form, in a companion
+-file to the config-file, default name: \fB/etc/lilo.conf.crc\fP. If the
++file to the config-file, default name: \fB/etc/lilo/lilo.conf.crc\fP. If the
+ config-file is updated, a warning message
+ will be issued telling you to re-run \fIlilo \-p\fP to force re-creation of the
+ password cache file.
+--- lilo-24.2/man/liloconfig.8 2015-11-21 17:25:48.000000000 -0600
++++ lilo-24.2/man/liloconfig.8 2020-03-19 16:02:08.680065874 -0500
+@@ -92,7 +92,7 @@ lilo.conf file you find many useful comm
+ Please pay attention about error messages if liloconfig cannot find
+ any images (/boot/vmlinuz*) oder image symlinks (/vmlinuz, /vmlinu.old).
+ Then you need to search for images by ourself and make some changes
+-in the '/etc/lilo.conf' file. Otherwise no bootloader can be installed
++in the '/etc/lilo/lilo.conf' file. Otherwise no bootloader can be installed
+ with '/sbin/lilo'.
+ .SH "OPTIONS"
+ .IX Header "OPTIONS"
+@@ -110,7 +110,7 @@ Force overriding existing lilo.conf.
+ Force overriding/update of boot line in lilo.conf.
+ .SH "EXAMPLES"
+ .IX Header "EXAMPLES"
+-Lines in the configuration file /etc/lilo.conf:
++Lines in the configuration file /etc/lilo/lilo.conf:
+ .PP
+ .Vb 1
+ \& ### LILO global section ###
+@@ -121,7 +121,7 @@ Lines in the configuration file /etc/lil
+ \& boot = /dev/disk/by\-id/ata\-SAMSUNG_SV1604N_S01FJ10X999999
+ \& #root = /dev/sda1
+ \& root = "UUID=18843936\-00f9\-4df0\-a373\-000d05a5dd44"
+-\& map = /boot/map
++\& map = /boot/lilo/map
+ \& install = menu
+ \& menu\-scheme = Wb:Yr:Wb:Wb
+ \& prompt
diff --git a/user/lilo/cflags.patch b/user/lilo/cflags.patch
new file mode 100644
index 000000000..253d77a33
--- /dev/null
+++ b/user/lilo/cflags.patch
@@ -0,0 +1,13 @@
+Ensure our CFLAGS are being used
+
+--- lilo-24.2/src/Makefile 2015-11-21 17:50:25.000000000 -0600
++++ lilo-24.2/src/Makefile 2020-03-19 04:48:25.069499686 -0500
+@@ -22,7 +22,7 @@ LD86=ld86 -0
+ NASM=nasm
+ G=`cat foo1 foo2 | grep version | cut -d " " -f 3`
+
+-CFLAGS=$(OPT) -Wall $(PCONFIG)
++CFLAGS+=-Wall $(PCONFIG)
+ LIBS=$(DEVMAPPER)
+
+ OBJS=lilo.o raid.o map.o geometry.o boot.o device.o common.o bsect.o cfg.o \
diff --git a/user/lilo/lilo.conf.template b/user/lilo/lilo.conf.template
new file mode 100644
index 000000000..527ecf364
--- /dev/null
+++ b/user/lilo/lilo.conf.template
@@ -0,0 +1,23 @@
+# /etc/lilo/lilo.conf
+
+### LILO global section ###
+
+# Good assumptions for a modern (post-1998) system
+compact
+large-memory
+lba32
+
+# Menu configuration
+install = bmp
+bitmap = /boot/lilo/gfx/tuxlogo.bmp
+
+# Boot the first entry automatically in 10 seconds
+prompt
+timeout = 100
+
+# These will be configured automatically by liloconfig(8)
+boot = ""
+root = ""
+
+### LILO per-image section ###
+
diff --git a/user/lilo/lilo.trigger b/user/lilo/lilo.trigger
new file mode 100644
index 000000000..0f5a802a2
--- /dev/null
+++ b/user/lilo/lilo.trigger
@@ -0,0 +1,93 @@
+#!/bin/sh -e
+conf=/etc/lilo/lilo.conf
+
+# Check whether LILO is installed
+# This function is from /usr/sbin/mkboot from debianutils, with copyright:
+#
+# Debian GNU/Linux
+# Copyright 1996-1997 Guy Maor <maor@debian.org>
+#
+# Modified for Gentoo for use with the lilo ebuild by:
+# Martin Schlemmer <azarah@gentoo.org> (16 Mar 2003)
+#
+# Modified for Adélie for use with the lilo APKBUILD by:
+# Max Rees <maxcrees@me.com> (19 Mar 2020)
+lilocheck() {
+ if ! [ -e "$conf" ]; then
+ cat >&2 <<-EOF
+ *
+ * Could not find '$conf'!
+ *
+ EOF
+ exit 1
+ fi
+
+ if grep -q "^[[:space:]]*password[[:space:]]*=[[:space:]]*\"\"" \
+ "$conf"; then
+ cat >&2 <<-EOF
+ *
+ * You have requested interactive LILO password setup.
+ * Run "lilo -p" by hand.
+ *
+ EOF
+ return 1
+ fi
+
+ bootpart="$(sed -n "s:^boot[ ]*=[ ]*\(.*\)[ ]*:\1:p" "$conf")"
+ if ! [ -b "$bootpart" ]; then
+ cat >&2 <<-EOF
+ *
+ * Could not find '$bootpart'!
+ *
+ EOF
+ exit 1
+ fi
+
+ if ! dd if="$bootpart" ibs=16 count=1 2>/dev/null | grep -q LILO; then
+ cat >&2 <<-EOF
+ *
+ * No LILO signature found on '$bootpart'.
+ * You must run 'lilo' yourself.
+ *
+ EOF
+ return 1
+ fi
+}
+
+if ! [ -e /etc/fstab ]; then
+ cat >&2 <<-EOF
+ *
+ * You are missing an /etc/fstab file, so liloconfig
+ * cannot determine the root filesystem. Skipping
+ * automatic configuration.
+ *
+ EOF
+ exit 0
+fi
+
+if [ -e "$conf" ] && [ "$conf" -nt "$conf.template" ]; then
+ cat >&2 <<-EOF
+ *
+ * You appear to have manually edited '$conf'.
+ * LILO configuration will not be automatically regenerated.
+ *
+ EOF
+ exit 0
+fi
+
+cat >&2 <<-EOF
+*
+* Running liloconfig...
+*
+EOF
+liloconfig -f "$conf"
+touch -r "$conf.template" "$conf"
+
+if lilocheck; then
+ cat >&2 <<-EOF
+ *
+ * Running lilo...
+ *
+ EOF
+ lilo -C "$conf"
+fi
diff --git a/user/lilo/musl.patch b/user/lilo/musl.patch
new file mode 100644
index 000000000..5b95e717f
--- /dev/null
+++ b/user/lilo/musl.patch
@@ -0,0 +1,81 @@
+Regarding O_NOACCESS:
+
+ > Using a value of 3 as the argument to open is a traditional Linux
+ > extension for getting an fd that's usable only for ioctls. That's
+ > reasonable. What's not reasonable or correct is using O_ACCMODE as a
+ > way to get a 3.
+
+https://www.openwall.com/lists/musl/2014/07/01/12
+
+--- lilo-24.2/src/common.h 2015-11-21 17:50:23.000000000 -0600
++++ lilo-24.2/src/common.h 2020-03-19 07:32:52.429998369 -0500
+@@ -26,12 +26,8 @@
+ # define PAGE_SIZE 4096U
+ #endif
+
+-#ifdef O_ACCMODE
+-# define O_NOACCESS O_ACCMODE
+-#else
+ /* open a file for "no access" */
+-# define O_NOACCESS 3
+-#endif
++#define O_NOACCESS 3
+
+ /* special for LILO, bypass the actual open in dev_open( , ,-1) */
+ #define O_BYPASS -1
+--- lilo-24.2/src/config.h 2011-06-22 02:13:58.000000000 -0500
++++ lilo-24.2/src/config.h 2020-03-19 04:43:53.769503552 -0500
+@@ -20,10 +20,6 @@
+ #endif
+
+ #if !__MSDOS__
+-#if !defined(__GLIBC__) || (__GLIBC__ < 2) || \
+- !defined(__GLIBC_MINOR__) || (__GLIBC_MINOR__ < 1)
+-# warning "glibc version 2.1 or later is recommended"
+-#endif /* !__MSDOS__ */
+
+ #define TMP_DEV "/tmp/dev.%d" /* temporary devices are created here */
+ #define MAX_TMP_DEV 50 /* highest temp. device number */
+--- lilo-24.2/src/lilo.c 2015-11-21 17:51:24.000000000 -0600
++++ lilo-24.2/src/lilo.c 2020-03-19 04:34:43.899511387 -0500
+@@ -182,7 +182,6 @@ extern int has_partitions_beta(dev_t dev
+ printf("Without");
+ #endif
+ printf(" device-mapper\n");
+- printf("\nglibc version %d.%d\n", __GLIBC__, __GLIBC_MINOR__);
+ printf("Kernel Headers included from %d.%d.%d\n",
+ LINUX_VERSION_CODE>>16,
+ LINUX_VERSION_CODE>>8 & 255,
+--- lilo-24.2/src/partition.c 2015-11-21 17:50:20.000000000 -0600
++++ lilo-24.2/src/partition.c 2020-03-19 04:41:05.339505952 -0500
+@@ -31,30 +31,6 @@
+ #include "boot.h"
+ #include "loader.h"
+
+-#if __GLIBC__ < 2 || __GLIBC_MINOR__ < 1
+-#if defined(_syscall5) && defined(__NR__llseek)
+-
+- _syscall5(int, _llseek, unsigned int, fd, unsigned int, hi,
+- unsigned int, lo, lloff_t *, res, unsigned int, wh);
+- int _llseek(unsigned int fd, unsigned int offset_high,
+- unsigned int offset_low, lloff_t * result, unsigned int whence);
+-
+- lloff_t lseek64(unsigned int fd, lloff_t offs, unsigned int whence)
+- { lloff_t res;
+- return _llseek(fd, offs>>32, offs, &res, whence) < 0 ?
+- (lloff_t)(-1) : res;
+- }
+-
+-#else
+-/* last ditch attempt on small disks, and very old systems */
+-# warning "*****************************************"
+-# warning "***** no 64 bit lseek is available ******"
+-# warning "***** using 23 bit sector addresses *****"
+-# warning "*****************************************"
+-# define lseek64 lseek
+-#endif
+-#endif
+-
+ static
+ int anywhere(unsigned char *buf, char *str)
+ {
diff --git a/user/lilo/partuuid.patch b/user/lilo/partuuid.patch
new file mode 100644
index 000000000..a1a4fcc10
--- /dev/null
+++ b/user/lilo/partuuid.patch
@@ -0,0 +1,65 @@
+Enable usage of PARTUUID if /etc/fstab uses it for the root filesystem.
+While we're here, make the generated labels for the kernel choices more
+descriptive as well.
+
+--- lilo-24.2/src/bsect.c 2011-06-22 02:09:44.000000000 -0500
++++ lilo-24.2/src/bsect.c 2020-03-19 07:59:59.819990912 -0500
+@@ -1098,6 +1098,9 @@ if (image) { /* long section specific to
+ else if (strlen(root)>5 && !strncmp(root,"UUID=",5)) {
+ sprintf(strchr(options,0),"root=%s ", root);
+ }
++ else if (strlen(root)>9 && !strncmp(root,"PARTUUID=",9)) {
++ sprintf(strchr(options,0),"root=%s ", root);
++ }
+ else {
+ sprintf(strchr(options,0),"root=%x ",dev_number(root));
+ }
+--- lilo-24.2/scripts/liloconfig 2015-11-21 18:00:21.000000000 -0600
++++ lilo-24.2/scripts/liloconfig 2020-03-19 14:36:22.710002318 -0500
+@@ -217,11 +218,12 @@ sub convert_root_device {
+ $found = 0;
+ }
+ }
+- elsif ($rootpart =~ /^UUID/ or $rootpart =~ /^LABEL/) {
++ elsif ($rootpart =~ /^(PART)?UUID/ or $rootpart =~ /^LABEL/) {
+ $root_link = $rootpart;
+ $root_link =~ s{\"}{}g;
+ $root_link =~ s{^LABEL=}{/dev/disk/by-label/};
+ $root_link =~ s{^UUID=}{/dev/disk/by-uuid/};
++ $root_link =~ s{^PARTUUID=}{/dev/disk/by-partuuid/};
+
+ if (-l $root_link) {
+ $root_id = $rootpart;
+@@ -610,6 +610,7 @@ sub write_image_config {
+ my $initrd2;
+ my $nr;
+ my $nr2;
++ my $label;
+
+ # append to new lilo.conf
+ open(MYFH_NEW, ">> $liloconfnew") or die "Cannot open file: $!";
+@@ -627,18 +628,16 @@ sub write_image_config {
+ $initrd2 = $initrd;
+ $initrd2 =~ s/\.img//;
+ $nr2 = $nr + 1;
++ $label = $image;
++ $label =~ s@/boot/vmlinuz-@@;
++ $label =~ s/-[^-]*$//;
++ $label = substr $label, 0, 15;
+
+ print MYFH_NEW 'image = ' . $image . "\n";
+ if($opt_v) { print 'image = ' . $image . "\n"; }
+
+- if ($nr == 0) {
+- print MYFH_NEW "\t" . 'label = "Linux"' . "\n";
+- if($opt_v) { print "\t" . 'label = "Linux"' . "\n"; }
+- }
+- elsif ($nr == 1) {
+- print MYFH_NEW "\t" . 'label = "Linux Old"' . "\n";
+- if($opt_v) { print "\t" . 'label = "Linux Old"' . "\n"; }
+- }
++ print MYFH_NEW "\t" . "label = \"$label\"" . "\n";
++ if($opt_v) { print "\t" . "label = \"$label\"" . "\n"; }
+
+ print MYFH_NEW "\t" . 'read-only' . "\n";
+ if($opt_v) { print "\t" . 'read-only' . "\n"; }