+Changes for version 23.2 (09-Apr-2011) - Joachim Wiedorn
+
+ Documentations
+ --------------
+ - Optimize documentation generation and information.
+ - Reformatting mkrescue.8 manpage. (thanks to Martin E. Schauer)
+ - Update of lilo.conf.5 manpage and remove of OS/2 information.
+
+ Sources
+ -------
+ - Remove obsolete BIOS workaround from 2002 (src/second.S)
+ - Add information about -H option. (src/lilo.c)
+ - Save errno for second command. (src/device.c)
+ - Fix missleading error message. (src/geometry.c)
+ - Remove obsolete OS/2 code. (src/boot.c, src/temp.c)
+ - Enlarge maximum number of sectors (MAX_SETUPSECS) for
+ kernel setup code to 63. (src/bootsect.S, src/lilo.h)
+ - Fix for many small flaws in source code. (Many thanks to
+ Solar Designer and Vasiliy Kulikov of the openwall project).
+
+ General
+ -------
+ - Remove obsolete OS/2 code. (make.vars, src/Makefile)
+ - Optimize Makefile and src/Makefile for use of $(MAKE).
+ - Use mktemp utility for floppy image generation in mkrescue.
+ (Many thanks to Solar Designer and Vasiliy Kulikov of the
+ openwall project).
+ - Add new scripts with Makefile (already used for Debian):
+ * liloconfig (for creating new lilo.conf)
+ * lilo-uuid-diskid (convert device names to UUID/DiskID)
+
+
Changes for version 23.1 (04-Nov-2010) - Joachim Wiedorn
Documentations
Copyright 1992-1998 Werner Almesberger
Copyright 1999-2007 John Coffman
-Copyright 2009-2010 Joachim Wiedorn
+Copyright 2009-2011 Joachim Wiedorn
All rights reserved.
# -*- makefile -*-
+#
+# Copyright 2009-2011 Joachim Wiedorn
+# All rights reserved.
+#
+# Licensed under the terms contained in the file 'COPYING'
+# in the source directory.
+#
#
# make help
@echo " make dosexe # DOS lilo.com utility"
@echo " make diagnostic # standalone diagnostics"
@echo " make alles # all above + static binary"
- @echo " make docs # doc/[user,tech].[ps,dvi] docs"
+ @echo " make docs # doc/[user,tech].[pdf,dvi] docs"
@echo " make floppy # 2 standalone bootable diagnostic floppies"
@echo ""
@echo " make install # install binaries++ into root directory"
# everything needed to run, just short of installation
#
all: test
- make -C src all
- make -C images all
+ $(MAKE) -C src all
+ $(MAKE) -C images all
#
# everything above plus the statically linked version
#
alles: test
- make -C src alles
- make -C images all
+ $(MAKE) -C src alles
+ $(MAKE) -C images all
#
# documentation files
#
docs:
- make -C doc all
+ $(MAKE) -C doc all
#
# if you have the 'bcc' compiler, then you can make the diagnostics, too
@echo before you proceed from this point.
@echo "Press <Enter> to continue, <^C> to abort ..."
@read
- @make -C src floppy1
+ @$(MAKE) -C src floppy1
@echo Done.
@echo
@echo Remove the floppy from the drive. Label it "\"1.6\""
@echo "Press <Enter> to continue, <^C> to abort ..."
@read
- @make -C src floppy2
+ @$(MAKE) -C src floppy2
@echo Done.
@echo
@echo Remove the floppy from the drive. Label it "\"2.4\""
@echo
diagnostic: test
- make -C src diagnostic
+ $(MAKE) -C src diagnostic
dosexe: test
- make -C dos lilo
+ $(MAKE) -C dos lilo
#
# test for compilers & utilities
# shorthand install, if one knows that one has the 'bcc' compiler
#
ins:
- make -C src ins
+ $(MAKE) -C src ins
#
# normal install, but doesn't make the diagnostic binaries
#
install: all
- make -C src install
- make -C images install
- make -C hooks install
- make -C sample install
- make -C man install
- make -C dos install
+ $(MAKE) -C src install
+ $(MAKE) -C images install
+ $(MAKE) -C hooks install
+ $(MAKE) -C sample install
+ $(MAKE) -C scripts install
+ $(MAKE) -C man install
+ $(MAKE) -C dos install
tidy:
- make -C src tidy
- make -C diagnose tidy
- make -C dos tidy
- make -C doc tidy
+ $(MAKE) -C src tidy
+ $(MAKE) -C diagnose tidy
+ $(MAKE) -C dos tidy
+ $(MAKE) -C doc tidy
clean: tidy
rm -f test.img
- make -C src clean
- make -C images clean
- make -C diagnose clean
- make -C dos clean
- make -C doc clean
+ $(MAKE) -C src clean
+ $(MAKE) -C images clean
+ $(MAKE) -C diagnose clean
+ $(MAKE) -C dos clean
+ $(MAKE) -C doc clean
spotless: distclean
distclean: clean
- make -C src distclean
- make -C diagnose distclean
- make -C dos distclean
+ $(MAKE) -C src distclean
+ $(MAKE) -C diagnose distclean
+ $(MAKE) -C dos distclean
uninstall:
- make -C src uninstall
- make -C images uninstall
- make -C hooks uninstall
- make -C sample uninstall
- make -C man uninstall
+ $(MAKE) -C src uninstall
+ $(MAKE) -C images uninstall
+ $(MAKE) -C hooks uninstall
+ $(MAKE) -C sample uninstall
+ $(MAKE) -C scripts uninstall
+ $(MAKE) -C man uninstall
(For details see file 'CHANGELOG' in the source directory)
+Version 23.2 (major and bugfix update of 23.1)
+
+ o Many fixes in source code and fixes for some error messages.
+ o Remove all obsolete OS/2 code and information.
+ o Fix for larger kernel setup code (needed for kernel >= 2.6.36)
+ o Update of script 'mkrescue'.
+ o Update of manpages (mkrescue.8, lilo.conf.5).
+ o Add new scripts 'liloconfig' and 'lilo-uuid-diskid'.
+
+
Version 23.1 (major and bugfix update of 23.0)
o Many fixes of typos in sources and documentation.
behaviour of 'large-memory'.
* patching sources because of some warnings while compiling
- with gcc 4.3.x
+ with gcc 4.4.x
* Upgrade of all manpages.
* Upgrade of all documentations.
+* code cleanup.
-The following is a list of external tools and programs that
-are used within lilo makefiles and scripts. Along with the
-RPMs or DEBs they can be found in:
+Needed tools for LILO sources
+=============================
+
+The following is a list of external tools and programs which
+are used within lilo makefiles. Along with the RPMs or DEBs
+they can be found in:
at least tested programs
package version until inside
sharutils 4.6.3 4.9 uuencode, uudecode
texlive-latex-base 2007-01 2009-11 ifpdf.sty
+
+
+
+Needed tools for installed LILO
+===============================
+
+The following is a list of external tools and programs which
+are used within lilo scripts. Along with the RPMs or DEBs
+they can be found in:
+
+ at least tested programs
+package version until inside
+-----------------------------------------------------------------
+perl 5.8.8 5.10.1 (general)
+
+perl-modules 5.8.8 5.10.1 Getopt::Std,
+ Pod::Usage
+ File::Copy
$(PDFLATEX) tech
$(PDFLATEX) tech
-../doc/README: user.tex
- perl t2a.pl <user.tex >../doc/README || { rm -f ../doc/README; exit 1; }
-
html: user.ps tech.ps
latex2html -split 2 -link 2 -toc_depth 2 user
latex2html -split 1 -link 1 -toc_depth 1 tech
-Generating the README
-=====================
-
-In order to (re)generate the plain ASCII documentation that is found in
-lilo/README, Perl 4 or 5 must be installed on your system.
-Just type
-
-make ../README
-
-to perform the conversion. Note that fairly large amounts of virtual memory
-(16 MB or more) are allocated during the process.
-
-
Printing the documentation
==========================
To run LaTeX just type
-make
+ make
LaTeX issues many "Overfull \hbox" warnings. They can be safely ignored.
LaTeX will be run repeatedly until it stops issuing the message
-LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
+LaTeX Warning: Label(s) may have changed. Rerun to get cross-references
+right.
+
+At the end you should get the very old documentation in user.pdf and
+tech.pdf.
+
+Generating user.README
+======================
+
+Use the simple tool t2a.pl for converting to ASCII formatted (old) user
+documentation:
+
+ perl t2a.pl <user.tex >user.README
-Finally, you have to convert the device-independent file doc.dvi to
-something your printer understands. The actual command to perform this
-depends on your local installation. Example:
+Online documentation
+====================
-dvips user | lpr
+The (old) documentation can also be found in the web:
-(Another way is to use GhostScript. To generate HP DeskJet output by
-converting the DVI file to PostScript as an intermediate step, use this
-command
+http://lilo.alioth.debian.org/olddoc/html/user_21-5.html
+http://lilo.alioth.debian.org/olddoc/pdf/user_21-5.pdf
-dvips -r1 -f1 user | gs -q -sDEVICE=deskjet -sOutputFile=/dev/lp1 -
+http://lilo.alioth.debian.org/olddoc/html/tech_21-5.html
+http://lilo.alioth.debian.org/olddoc/pdf/tech_21-5.pdf
-gs -h lists all configured drivers.)
-If you don't have access to LaTeX but if you can print PostScript, you
-should get the file(s) lilo.<part>.<version>.ps.gz from the same place
-where you've obtained lilo.<version>.tar.gz That file contains the
-document user.tex (<part> = u) or tech.tex (<part> = t) already translated
-to PostScript.
+-- Joachim Wiedorn (2011)
### Configuration variables for makefiles ###
+#
+# Copyright 2009-2011 Joachim Wiedorn
+# All rights reserved.
+#
+# Licensed under the terms contained in the file 'COPYING'
+# in the source directory.
+#
# NOTE: These variables can also be stored in a file /etc/lilo.defines, e.g.
# -DIGNORECASE -DONE_SHOT
# * REISERFS Compile support for parts of LILO on ReiserFS.
# Requires header files for kernel 2.4.0test8 or later.
# * REWRITE_TABLE Enable rewriting the partition table at boot time.
-# * SOLO_CHAIN Assemble all chain-loader functions into 'chain.b',
-# eliminating the need for 'os2_d.b'.
+# * SOLO_CHAIN Assemble all chain-loader functions into 'chain.b'.
# SUSPEND= Modify 'vmdefault' action if this partition type on C: drive
# is marked active; (Dell suspend partition is -DSUSPEND=0x84).
# USE_TMPDIR Create temporary devices in $TMPDIR if set
.\" this software without specific prior written permission. This work
.\" is provided "as is" and without any express or implied warranties.
.\"
-.TH LILO.CONF 5 "July 2010"
+.TH LILO.CONF 5 "April 2011"
.SH NAME
lilo.conf \- configuration file for lilo
.SH DESCRIPTION
It might look as follows:
.IP
.nf
-# lilo.conf
+# /etc/lilo.conf
#
# global options:
boot=/dev/hda
read-only
menu-title=" John's Computer "
#
-# bootable kernel images:
-image=/boot/zImage-1.5.99
+### bootable kernel images ###
+image=/boot/vmlinuz-2.6.29-1-i386
label=try
-image=/boot/zImage-1.0.9
- label=1.0.9
+ initrd=/boot/initrd.img-2.6.29-1-i386
+image=/boot/vmlinuz-2.4.33-1-i386
+ label=2.4.33
image=/tamu/vmlinuz
label=tamu
- initrd=initramdisk.img
+ initrd=/tamu/initrd.img
root=/dev/hdb2
vga=ask
#
-# other operating systems:
+### other operating systems ###
other=/dev/hda3
- label=dos
+ label=PCDOS
boot-as=0x80 # must be C:
other=/dev/hdb1
- label=Win98
+ label=WinXP
boot-as=0x80 # must be C:
other=/dev/hdb5
- label=os2
- loader=os2_d
- table=E: # os2 sees as E:
+ label=oldDOS
+ loader=chain
+ table=/dev/hdb5
.fi
.LP
This configuration file specifies that lilo uses the Master
.sp
When a bitmap file is specified as a background screen during the boot
process, the color selection and layout of the text which overlays the
-graphic image must be specified in one of two ways. One way, is to use
-a bitmap image (*.bmp) file which has had a header written by the
+graphic image must be specified in one of two ways.
+.sp
+One way is the use of header information in the bitmap image (*.bmp) file:
+From a text file with all the information about 'bmp-colors', 'bmp-table'
+and 'bmp-timer' options together with the 'bitmap' option are stored in
+the special LILO header of the bitmap image file by the
.BI "lilo -E"
-command. If this command is used, then all of the
-information specified by the 'bmp-colors', 'bmp-table', and 'bmp-timer'
-options is stored in a special LILO header within the bitmap file.
-Without this header, the 'bmp-' option values should be
-specified in the configuration file; if not, default values are used.
-Any use of the 'bmp-' options
-within the configuration file overrides the values stored in the
-bitmap file header.
++command. Another way works without these special header information: All
++the information about 'bmp-colors', 'bmp-table' and 'bmp-timer' options
++together with the 'bitmap' option are stored in the configuration file.
++Any use of the 'bmp-' options within the configuration file overrides
++the options stored in the bitmap file header. If lilo cannot find any of
++the 'bmp-' options, then default values are used.
.TP
.BI "bmp-colors=" <fg>,<bg>,<sh>,<hfg>,<hbg>,<hsh>
Specifies the decimal values of the colors to be used for the menu display
.fi
.sp
probably only useful for floppy disks and loopback devices,
-since for hard disks the
+because for hard disks the
.BI lba32
-disk addressing option (LILO 21.2) ignores disk geometry.
+disk addressing option ignores disk geometry.
.sp
-(22.5.8) Developers who have implemented a disk driver for a new block storage
+Developers who have implemented a disk driver for a new block storage
device will have to indicate to LILO the maximum number of partitions
on the device. This is in addition to making all of the necessary
entries for the device in the "/dev" directory (with 'mknod'). The
-maximum number of partitions must be one of 63 (like an IDE disk), 31 (uncommon), 15
-(like SCSI disks -- most common value), or 7 (like one array controller).
-An example specification would be:
+maximum number of partitions must be one of 63 (like an IDE disk),
+31 (uncommon), 15 (like SCSI disks -- most common value), or 7
+(like one array controller). An example specification would be:
.sp
.nf
disk=/dev/userd0
partition entry contains a 3D (cylinder/head/sector) and a linear
address of the first and the last sector of the partition. If a
partition is not track-aligned and if certain other operating systems
-(e.g. PC/MS-DOS or OS/2) are using the same disk, they may change the
+(e.g. PC/MS-DOS) are using the same disk, they may change the
3D address. lilo can store its boot sector only on partitions where
both address types correspond. lilo re-adjusts incorrect 3D start
addresses if `fix-table' is set.
.BR ask :
stop and ask for user input (at boot time).
.sp
-<number>: use the corresponding text mode. A list of available modes
+<number>: use the corresponding text mode (can specify the number in decimal
+or in hex with the usual '0x' convention). A list of available modes
can be obtained by booting with
.I vga=ask
and pressing [Enter].
.I chain
is used. This chain loader passes partition and drive information in the
boot sector it loads only to DOS on FAT12 or FAT16, Windows on FAT16 or
-FAT32, or OS/2 on FAT16 or HPFS.
-The alternate chain loader,
-.I os2_d
-passes partition and drive information unconditionally, and uses a format
-suitable for OS/2 and DOS (see
+FAT32. (see also
.I table=<letter>
below).
.TP
with `table' is modified.
.TP
.BI "table=" <drive-letter>
-This is a special case for the
+This option is obsolete. It were used in the special case with the obsolete
.I os2_d
-chain loader. It specifies the DOS drive letter for the partition
-that will be booted. This is
-.I mandatory
-when booting OS/2 installed on
-an extended partition. The drive letter may be specified with or without a
-trailing colon.
+chain loader.
.TP
.BI "change"
This keyword starts a section which describes how primary partition IDs are
.B change
is omitted, change rules are generated as though the
.I "automatic"
-keyword were specified. The keyword
+keyword were specified. The keyword
.B change
alone, without any rules following, will suppress automatic change-rules.
For example,
local option to override "master-boot" as necessary.
.TP
.BI "master-boot"
-This flag (LILO version 22.5) indicates a DOS/Windows/OS2 or other
+This flag (LILO version 22.5) indicates a DOS/Windows or other
system which will only boot from BIOS device 0x80, the "C:" drive, or BIOS
device 0, the A: drive. When this
flag is specified, if this drive is not assigned device code 0x80 or 0 by the
'\" t
-.\" @(#)mkrescue.8 1.0 20011031 jrc
+.\" @(#)mkrescue.8
.\" This page is part of the LILO package, which is released by
.\" the author(s) under a BSD license. See the file COPYING
-.\" in the LILO source directory for the License and Disclaimer.
+.\" in the LILO source directory for the license and disclaimer.
.\"
-.\" Original version, John Coffman 2001-10-31
-.\" Updated to version 2.0 & lilo 22.5.4, John Coffman 2003-05-24
-.\"
-.\" Updated to version 3.0 & lilo 22.6.1, John Coffman 2004-11-16
-.\"
-.TH MKRESCUE 8 "16 Nov 2004"
+.\" Original for lilo 22.1, John Coffman 2001-10-31
+.\" Updated for lilo 22.5.4, John Coffman 2003-05-24
+.\" Updated for lilo 22.6.1, John Coffman 2004-11-16
+.\" Updated for lilo 23.1, Martin Eberhard Schauer 2011-03-06
+.\" (Reformatted to better match Linux man-pages conventions)
+
+.TH MKRESCUE 8 "6 Mar 2011"
+
.SH NAME
-mkrescue \- make rescue floppy
+mkrescue \- make rescue floppy or CD
+
.SH SYNOPSIS
-.LP
-.B "/usr/sbin/mkrescue"
-\- make a bootable rescue floppy or CD using the default kernel specified
-in \fIlilo.conf\fP.
+.B /sbin/mkrescue
+makes a bootable rescue floppy or CD using the default kernel specified in
+.IR lilo.conf .
+
.SH DESCRIPTION
-.LP
-.B mkrescue
-takes its specification for the kernel from the default image specified in
-\fB/etc/lilo.conf\fP. If the actual default is an \fIother=\fP specification,
-then use the first \fIimage=\fP specification.
-Any associated initial ramdisk (initrd=), and \fIappend=\fP
-options will also be used. The root directory will be taken to be the
-\fIcurrent\fP root. A bootable floppy or CD-image will be created using LILO version
+\fBmkrescue\fP takes its specifation for the kernel from the default image
+specified in \fI/etc/lilo.conf\fP.
+If the actual default is an \fIother=\fP specification, then use the first
+\fIimage=\fP specification.
+Any associated initial ramdisk (\fIinitrd=\fP), and \fIappend=\fP options
+will also be used.
+The root directory will be taken to be the \fIcurrent\fP root.
+A bootable floppy or CD-image will be created using LILO version
22.5.5 or later.
-.B mkrescue
-normally requires no options, unless a CD-image is desired (\fI--iso\fP).
+\fBmkrescue\fP normally requires no options, unless a CD-image is desired
+(\fB--iso\fP).
+
.SH OPTIONS
-.LP
+
.TP
-.BI "--append <string>"
-Override any \fIappend=\fP options taken from the default image. If there is
-any doubt about whether the \fIlilo.conf\fP options are correct, then specify
-no kernel parameters with: \fB--append ""\fP, the null string.
+\fB--append\fP <string>
+Override any \fIappend=\fP options taken from the default image.
+If there is any doubt about whether the \fIlilo.conf\fP
+options are correct, then specify no kernel parameters by providing the
+null string (\fB--append ""\fP).
+
.TP
-.BI "--debug"
-Provide verbose output of the operation of "mkrescue", pausing to allow
-the setting of internal operating parameters to be viewed. "<CR>" must
-be hit to proceed from these pauses.
+.B --debug
+Provide verbose output of the operation of
+.BR mkrescue ,
+pausing to allow the setting of internal operating parameters to be viewed.
+<CR> must be hit to proceed from these pauses.
+
.TP
-.BI "--device <device>"
-Make the floppy on a device other than /dev/fd0. The floppy disk will
-always be made to boot on BIOS device code 0x00 (A: drive), without
-regard to the drive on which it is created.
+\fB--device\fP <device>
+Make the floppy on a device other than \fI/dev/fd0\fP.
+The floppy disk will always be made to boot on BIOS device code 0x00 (A:
+drive), without regard to the drive on which it is created.
+
.TP
-.BI "--fast"
-Use a faster method of creating the boot floppy. This involves first
-creating a file of "\-\-size" 1k blocks (default is 1440)
-mounted using a loopback device, creating the bootable floppy,
+.B --fast
+Use a faster method of creating the boot floppy.
+This involves first creating a file of \fB--size\fP 1k blocks (default
+is 1440) mounted using a loopback device, creating the bootable floppy,
then copying the entire file to the disk.
+
.TP
-.BI "--fs [ ext2 | msdos | minix ]"
+\fB--fs\fP [ \fIext2\fP | \fImsdos\fP | \fIminix\fP ]
Specify the type of filesystem to create on the drive.
-.B ext2
-is the default, but "msdos" and "minix" allow slightly more disk sectors
-for really big kernels.
+\fIext2\fP is the default, but \fImsdos\fP and \fIminix\fP allow
+slightly more disk sectors for really big kernels.
+
.TP
-.BI "--help"
+.B --help
Print a short usage synopsis, including a list of command options.
+
.TP
-.BI "--image <label>"
+\fB--image\fP <label>
Specifies the label or alias of the particular image from which the
-append, initial ramdisk, root, keytable, and kernel information is to be
-taken.
+append, initial ramdisk, root, keytable, and kernel information is to
+be taken.
+
.TP
-.BI "--initrd <filepath>" " and " "--kernel <filepath>"
+\fB--initrd\fP \fI<filepath>\fP and \fB--kernel\fP \fI<filepath>\fP
These options, which must be used together, allow specification of an
arbitrary kernel file and initial ramdisk file to be used on the created
-boot floppy. Be sure you know what you are doing before you use these
-options. If no initial ramdisk is needed with a particular kernel, then you
-MUST specify \fB--initrd ""\fP, meaning a null pathname.
+boot floppy.
+Be sure you know what you are doing before you use these options.
+If no inital ramdisk is needed with a particular kernel, then you MUST
+specify \fB--initrd ""\fP, meaning a null pathname.
+
.TP
-.BI "--install [ text | menu ]"
+\fB--install\fP [ \fItext\fP | \fImenu\fP ]
Allows overriding the default human interface used with the rescue
-bootloader (configuration file "install=" option). "text" is the
-default on 1.2MB and 1.44MB floppy disks, and "menu" is the default on
-2.88MB floppies and HD emulation on CD-R media.
+bootloader (configuration file "install=" option). \fItext\fP is the
+default on 1.2MB and 1.44MB floppy disks, and \fImenu\fP is the default
+on 2.88MB floppies and HD emulation on CD-R media.
+
.TP
-.BI "--iso"
-Create an ISO-9660 bootable CD image (El Torito Format) suitable for burning
-to a CD-R or CD-RW. The \fB--device\fP specification defaults to the
-filename \fB"rescue.iso"\fP, and the \fB--size\fP defaults to 2880. A utility
-such as \fIcdrecord\fP may be used to burn the ISO file to a recordable CD
-medium. With this ISO option, the
-.B "--size HD"
-option is allowed.
+.BI --iso
+Create an ISO-9660 bootable CD image (El Torito Format) suitable for
+burning to a CD-R or CD-RW. The \fB--device\fP specification defaults to
+the filename \fIrescue.iso\fP, and the \fB--size\fP defaults to 2880.
+A utility such as "wodim" may be used to burn the ISO file to a
+recordable CD medium.
+With this ISO option, the \fB--size\fP \fIHD\fP option is allowed.
+
.TP
-.BI "--nocompact"
+.BI --nocompact
For faster kernel loading from a floppy, LILO map compaction is normally
-enabled. This option will disable map compaction by omitting the
-lilo "\-c" switch.
+enabled.
+This option will disable map compaction by omitting the lilo \fB-c\fP
+switch.
+
.TP
-.BI "--noformat"
-Suppresses creation of a new filesystem on the boot floppy. This option may
-be used
-.B only
+.BI --noformat
+Suppresses creation of a new filesystem on the boot floppy.
+This option may be used ONLY
when you know that the floppy you will be writing upon is formatted with the
-same filesystem as specified by "\-\-fs XXX" (default is ext2).
+same filesystem as specified by \fB--fs\fP \fIXXX\fP (default is \fIext2\fP).
+
.TP
-.BI "--root <device>"
-Specify the root filesystem for the kernel on the boot floppy. The currently
-mounted root is taken as the default specification.
+\fB--root\fP \fI<device>\fP
+Specify the root filesystem for the kernel on the boot floppy.
+The currently mounted root is taken as the default specification.
+
.TP
-.BI "--size [ 1440 | 1200 | 2880 | HD ]"
-The default floppy disk size is \fI1440\fP, meaning a 1.44MB floppy. When \fI--iso\fP
-is specified, the default size is \fI2880\fP. Allowed
-specifications are 1200, 1440, or 2880, meaning a 1.2MB, 1.44MB or 2.88MB
-floppy, respectively. No other floppy disk sizes are supported.
+\fB--size\fP [ \fI1440\fP | \fI1200\fP | \fI2880\fP | \fIHD\fP ]
+The default floppy disk size is \fI1440\fP, meaning a 1.44MB floppy.
+When \fB--iso\fP is specified, the default size is \fI2880\fP.
+Allowed specifications are \fI1200\fP, \fI1440\fP, or \fI2880\fP, meaning
+a 1.2MB, 1.44MB or 2.88MB floppy, respectively.
+No other floppy disk sizes are supported.
.sp
-The
-.I HD
-specification, meaning "hard disk", may only be used with the
-.B "--iso"
-option, to indicate a 16MB hard disk is to be generated for emulation. This
-allows for very large kernel / initial ramdisk combinations on CD-R. The
-hard disk image is created using loopback devices
-"/dev/loop0" and "/dev/loop1", which
-must be free to utilize this size option.
+The \fIHD\fP specification, meaning "hard disk", may only be used with
+the \fB--iso\fP option, to indicate a 16MB hard disk is to be generated
+for emulation.
+This allows for very large kernel/initial ramdisk combinations on CD-R.
+The hard disk image is created using loopback devices \fI/dev/loop0\fP
+and \fI/dev/loop1\fP, which must be free to utilize this size option.
+
.TP
-.BI "--version"
-Print the version number of \fImkrescue\fP, then terminate.
-.TE
+.BI --version
+Print the version number of \fBmkrescue\fP, then terminate.
+
.SH "SEE ALSO"
-lilo(8), lilo.conf(5), mkfs(8), dd(1), mount(8), mkinitrd(8), mkisofs(8),
-cdrecord(1).
-.SH "AUTHOR"
-John Coffman <johninsd@san.rr.com> (3.0)
+.BR cdrecord (1),
+.BR dd (1),
+.BR wodim (1),
+.BR lilo.conf (5),
+.BR lilo (8),
+.BR mkfs (8),
+.BR mkinitrd (8),
+.BR mkisofs (8),
+.BR mount (8)
+
+.\" .SH "AUTHOR"
+.\" John Coffman <johninsd@san.rr.com>
compact=-c
device=/dev/fd0
fs=ext2
-tmpbase=${TMPDIR:-/tmp}/mkrescue_$$
-mount=`mktemp -d -t mkrescue-flp.XXXXXX` || { echo "$0: Cannot create temporary directory" >&2; exit 1; }
-mfile=`mktemp -t mkrescue-emu.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
-mtemp=`mktemp -t mkrescue-tmp.XXXXXX` || { echo "$0: Cannot create temporary file" >&2; exit 1; }
-trap " [ \"$debug\" != true ] && rm -f \"$mtemp\" ; /bin/rm -rf -- \"$mount\" \"$mfile\" " 0 1 2 3 13 15
+tmpbase="`mktemp -dt $(basename $0).XXXXXXXXXX`" || exit
+if [ "$debug" != true ]; then
+ trap 'rm -rf -- "$tmpbase"' EXIT
+ trap 'trap - EXIT; rm -rf -- "$tmpbase"; exit 1' HUP INT QUIT TERM
+fi
+mount="$tmpbase/mkrescue-flp"
+mfile="$tmpbase/mkrescue-emu"
+mtemp="$tmpbase/mkrescue-tmp"
+mkdir "$mount"
+touch "$mfile" "$mtemp"
+
loopback=loop0
looppart=loop1
install=text
--- /dev/null
+# -*- makefile -*-
+
+# adding variables
+include ../make.vars
+
+all:
+
+install:
+ mkdir -p $$DESTDIR$(USRSBIN_DIR)
+
+ install -m 0755 liloconfig $$DESTDIR$(USRSBIN_DIR)
+ install -m 0755 lilo-uuid-diskid $$DESTDIR$(USRSBIN_DIR)
+
+clean:
+
+distclean:
+
+uninstall:
+ rm -f $$DESTDIR$(USRSBIN_DIR)/liloconfig
+ rm -f $$DESTDIR$(USRSBIN_DIR)/lilo-uuid-diskid
+
--- /dev/null
+#!/usr/bin/perl -w
+
+# lilo-uuid-diskid - convert boot and root options to diskid
+# and uuid in /etc/lilo.conf
+#
+# Copyright 2010-2011 Joachim Wiedorn <ad_debian at joonet.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+#---- some modules
+use strict;
+use warnings;
+use Getopt::Std;
+use Pod::Usage;
+use File::Copy;
+
+
+#---- global variables
+my $prog = $0;
+$prog =~ s#.*/##;
+my $version = "0.3";
+
+#---- parameter check
+our $opt_h = 0;
+our $opt_v = 0;
+getopts('hv');
+# define perldoc usage
+pod2usage(1) if $opt_h;
+
+#---- other variables
+our $liloconf = "/etc/lilo.conf";
+our $liloconfold = '';
+our $fstabconf = "/etc/fstab";
+our $idpath = "/dev/disk/by-id";
+our $uuidpath = "/dev/disk/by-uuid";
+our $labpath = "/dev/disk/by-label";
+
+our $bootready = 0;
+our $boot_id = '';
+our $root_id = '';
+our $optboot = 0; # -1 = only ^#boot, 0 = nothing, 1 = ^boot exist
+
+#-------------------- main program --------------------
+
+sub main {
+
+ my $exit = 0;
+
+ if (@ARGV == 1) {
+ $liloconf = "$ARGV[0]";
+ }
+
+ if (-f $liloconf) {
+ $liloconfold = $liloconf . "_old";
+ $exit = convert_lilo_conf();
+ }
+ else {
+ print "cannot open $liloconf: file not found!\n";
+ $exit = 1;
+ }
+ return $exit;
+}
+
+#-------------------- subroutines --------------------
+
+sub convert_lilo_conf {
+
+ my @sellines;
+ my $exit = 0;
+ my $line = '';
+ my $bootline = '';
+
+ # at first read lilo.conf and search for 'boot'
+ my $ok = 0;
+ open(MYFH, "<$liloconf") or die ("cannot open $liloconf: $!");
+ @sellines = grep(/^#?boot/, readline(MYFH));
+ close(MYFH);
+
+ # analyse the boot option in config file
+ foreach $line (@sellines) {
+ if ($line =~ /^boot/) {
+ # activated boot option found
+ $bootline = $line;
+ chomp $bootline;
+ $optboot = 1;
+ }
+ if ($optboot == 0) {
+ # commented boot option found
+ if ($line =~ /^#boot/) { $optboot = -1; }
+ }
+ }
+
+ if ($optboot != 0) {
+
+ if($opt_v) { print "++++++++++ write options into $liloconf ++++++++++\n\n"; }
+
+ if ( detect_boot_device($bootline) == 0) {
+ # found diskid or uuid for boot device: $boot_id
+ if (-l $boot_id) {
+ write_boot_option();
+ }
+ else {
+ if($opt_v) { print "cannot open $boot_id: link does not exist!\n"; }
+ $exit = 1;
+ }
+ }
+ else {
+ if($opt_v) { print "\n"; }
+ }
+ }
+ else {
+ print "cannot use $liloconf: uncomplete configuration!\n";
+ $exit = 1;
+ }
+
+ return $exit;
+}
+
+
+sub detect_boot_device {
+
+ my $boot_line = $_[0];
+ my $boot_disk = '';
+ my $searchpath;
+ my $_part;
+ my $exit = 0;
+
+ if ($optboot == 1) {
+ # the usual case: found ^boot in lilo.conf
+ $boot_disk = ($boot_line =~ /^boot *= *(\/dev\/.*)/) ? ($1) : ();
+
+ # check if the found partition is a raid volume
+ if($boot_disk =~ /\/dev\/md/) {
+ $boot_disk = check_raid($boot_disk);
+ }
+ }
+ elsif ($optboot == -1) {
+ # found only ^#boot in lilo.conf, then /etc/fstab is needed
+ if (-f $fstabconf) {
+ if($opt_v) {
+ print "no boot option in $liloconf: selecting from $fstabconf\n";
+ }
+ $boot_disk = read_fstab($fstabconf);
+ }
+ else {
+ print "no boot option in $liloconf and no file $fstabconf found!\n";
+ $exit = 1;
+ }
+ }
+
+ if (-b $boot_disk) {
+ if($boot_disk =~ /$idpath/
+ or $boot_disk =~ /$uuidpath/
+ or $boot_disk =~ /$labpath/) {
+ print "boot option is already updated to $boot_disk\n";
+ $bootready = 1; $exit = 1;
+ }
+ else {
+ if($opt_v) { print "convert boot option $boot_disk into new ID\n"; }
+
+ # is it a block device name ?
+ $_part = $boot_disk;
+ $_part =~ s/\d+$//;
+ $searchpath = ($_part eq $boot_disk) ? $idpath : $uuidpath;
+
+ $boot_id = $searchpath . "/" . find_id_link($boot_disk,$searchpath);
+ if(not -l "$boot_id") { $exit = 1; }
+ }
+ }
+ else {
+ if($opt_v) { print "cannot read $boot_disk: link does not exist!\n"; }
+ $exit = 1;
+ }
+ return $exit;
+}
+
+sub read_fstab {
+
+ my $ffile = $_[0];
+ my $root_line;
+ my $root_part;
+ my $_item;
+
+ $root_line = `awk '{ if (\$2=="/") print \$1}' <$ffile`;
+
+ # search for the last valid entry in /etc/fstab about root partition
+ foreach $_item (split("\n", $root_line)) {
+ if(not $_item =~ /#/) {
+ $root_part = $_item;
+ }
+ }
+ # check if the found partition is a raid volume
+ if($root_part =~ /\/dev\/md/) {
+ }
+ unless ($root_part =~ /^UUID/) {
+ # now find the right block device name
+ $root_part =~ s/\d+$//;
+ }
+
+ return $root_part;
+}
+
+sub check_raid {
+
+ my $part = $_[0];
+ my $mdname;
+ my $md;
+ my @devices;
+
+ # check if the found partition is a raid volume
+ if($part =~ /\/dev\/md/)
+ {
+ $mdname = $part;
+ $mdname =~ s/\/dev\///;
+ $mdname =~ s/\///;
+ $md = `grep $mdname /proc/mdstat`;
+
+ @devices = split(" ", $md);
+ @devices = sort(@devices[4..$#devices]);
+ $part = "/dev/" . $devices[0];
+ $part =~ s/\[.*$//;
+
+ }
+ return $part;
+}
+
+sub detect_root_device {
+
+ my $root_line = $_[0];
+ my $root_disk = '';
+ my $root_link = '';
+ my $exit = 0;
+
+ if (not $exit) {
+ # extract the root device name
+ $root_disk = ( $root_line =~ /^\t?root *= *(.*)/ ) ? ($1) : ();
+ chomp $root_disk;
+
+ # check if the found partition is a raid volume
+ if($root_disk =~ /\/dev\/md/) {
+ $root_disk = check_raid($root_disk);
+ }
+ }
+
+ # check if root device exist / also for raid volume
+ if (-b $root_disk) {
+ if($opt_v) { print "convert root option $root_disk into new UUID\n"; }
+ $root_id = find_id_link($root_disk,$uuidpath);
+ if (not -l "$uuidpath/$root_id") { $exit = 1; }
+ }
+ else {
+ # nothing to do but perhaps give a message
+ $exit = 1;
+ $root_link = $root_disk;
+ $root_link =~ s{\"}{}g;
+ $root_link =~ s{^LABEL=}{/dev/disk/by-label/};
+ $root_link =~ s{^UUID=}{/dev/disk/by-uuid/};
+ if (not -l $root_link) {
+ if($opt_v) { print "cannot check $root_link: link does not exist!\n"; }
+ }
+ }
+ return $exit;
+}
+
+sub find_id_link {
+
+ my $olddev = $_[0];
+ my $path_id = $_[1];
+ my @sellinks;
+ my $_idlink;
+ my $_actlink;
+ my $newdevid = '';
+ my $ok = 0;
+
+ opendir(MYDH, "$path_id") or die("cannot open $path_id: $! \n");
+ @sellinks = grep(!/\-part\d\d?$/, grep(!/^\.\.?$/, readdir(MYDH)));
+ @sellinks = sort(@sellinks);
+ closedir(MYDH);
+
+ foreach $_idlink (@sellinks) {
+ if(not $_idlink =~ /^usb/ and length($_idlink) > 10 and $ok == 0) {
+ $_actlink = readlink("$path_id/$_idlink");
+ $_actlink =~ s/^\.\.\/\.\.\//\/dev\//;
+ if($opt_v) { print "** try: $_actlink => $_idlink \n"; }
+
+ if($_actlink eq $olddev) {
+ $newdevid = $_idlink;
+ if($opt_v) { print "** convert: $_actlink => $path_id/$_idlink \n"; }
+ # run only one time
+ $ok = 1;
+ }
+ }
+ }
+
+ if($opt_v and not $ok) { print "$olddev not converted: link not useful\n\n"; }
+
+ return ($newdevid);
+}
+
+sub write_boot_option {
+
+ my $oldline = '';
+ my $comline = '';
+ my $newline = '';
+ my @status;
+ my $_preold;
+ my $_prenew;
+
+ if (-f $liloconf) {
+ # move old lilo.conf to lilo.conf_old
+ @status = stat($liloconf);
+ move ($liloconf, $liloconfold);
+ utime ($status[9],$status[9],$liloconfold);
+ chmod (0600,$liloconfold);
+
+ # copy all lines from lilo.conf_old into
+ # new lilo.conf and add 'boot=' line
+ my $ok = 0;
+ open(MYFH_NEW, "> $liloconf") or die("cannot open $liloconf: $!");
+ open(MYFH_OLD, "< $liloconfold") or die ("cannot open $liloconfold: $!");
+
+ while (<MYFH_OLD>) {
+ # line read from MYFH_OLD
+ $oldline = $_;
+
+ if (/^boot/ and $ok == 0) {
+ $newline = "boot = $boot_id\n";
+ print MYFH_NEW "#" . $oldline;
+ print MYFH_NEW $newline;
+ if($opt_v) { print "+ #" . $oldline; }
+ print "+ " . $newline;
+ if($opt_v) { print "\n"; }
+ # convert only one time
+ $ok = 1;
+ }
+ elsif (/^#boot/ and $optboot == -1 and $ok == 0) {
+ # found a line with boot option commented out
+ $newline = "boot = $boot_id\n";
+ print MYFH_NEW $oldline;
+ print MYFH_NEW $newline;
+ if($opt_v) { print "+ " . $oldline; }
+ print "+ " . $newline;
+ if($opt_v) { print "\n"; }
+ # convert only one time
+ $ok = 1;
+ }
+ elsif (/^root/ or /^\troot/) {
+ # found a line with root option
+ if (detect_root_device($oldline) == 0) {
+ $comline = comment_root_line($oldline);
+ $newline = modern_root_line($oldline,$root_id);
+ print MYFH_NEW $comline;
+ print MYFH_NEW $newline;
+ if($opt_v) { print '+ ' . $comline; }
+ print '+ ' . $newline;
+ if($opt_v) { print "\n"; }
+ }
+ else {
+ print MYFH_NEW $oldline;
+ }
+ }
+ else {
+ print MYFH_NEW $oldline;
+ }
+ }
+ close(MYFH_OLD);
+ close(MYFH_NEW);
+ chmod (0600,$liloconf);
+ }
+ else {
+ print "file $liloconf does not exist: nothing changed\n";
+ }
+}
+
+sub comment_root_line {
+
+ my $rootline = $_[0];
+
+ if( $rootline =~ /root/) {
+ $rootline =~ s/root/#root/;
+ }
+ return $rootline;
+}
+
+sub modern_root_line {
+
+ my $oldline = $_[0];
+ my $newline = $_[0];
+ my $rootid = $_[1];
+ my $indent = '';
+
+ if($oldline =~ /root/) {
+ $indent = $oldline;
+ chomp $indent;
+ $indent =~ s/^(\t?)root.*/$1/;
+ $newline = $indent . "root = \"UUID=$rootid\"\n";
+ }
+ return $newline;
+}
+
+
+main();
+
+
+__END__
+
+
+=head1 NAME
+
+lilo-uuid-diskid - convert boot / root options to diskid and uuid in lilo.conf
+
+=head1 SYNOPSIS
+
+lilo-uuid-diskid [-h] [-v] [lilo.conf]
+
+=head1 DESCRIPTION
+
+This script looks for the boot block device or boot partition and create the
+right diskid or uuid as boot option. Then it looks for all root partitions
+and create the right uuids as root options.
+
+These conversions are necessary for use with newer kernel (>= 2.6.26) if it
+use the libata module for parallel and serial ATA interfaces of block devices
+(i. e. hard disks with IDE or SATA interface, usbsticks).
+
+=head1 EXAMPLES
+
+Lines in the configuration file /etc/lilo.conf:
+
+ #boot = /dev/sda
+ boot = /dev/disk/by-id/ata-SAMSUNG_SV1604N_S01FJ10X999999
+
+ #root = /dev/sda1
+ root = "UUID=18843936-00f9-4df0-a373-000d05a5dd44"
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-h>
+
+Print a brief help.
+
+=item B<-v>
+
+Print verbose messages.
+
+=back
+
+=head1 AUTHOR
+
+B<lilo-uuid-diskid> was written by Joachim Wiedorn.
+
+=cut
--- /dev/null
+#!/usr/bin/perl -w
+
+# liloconfig - creating a new lilo.conf file
+#
+# Copyright 2011 Joachim Wiedorn <ad_debian@joonet.de>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+#---- some modules
+use strict;
+use warnings;
+use Getopt::Std;
+use Pod::Usage;
+use File::Copy;
+
+
+#---- global variables
+my $prog = $0;
+$prog =~ s#.*/##;
+my $version = "0.1";
+
+#---- parameter check
+# h: help, v: verbose, f: force
+our $opt_h = 0;
+our $opt_v = 0;
+our $opt_f = 0;
+getopts('hvf');
+# define perldoc usage
+pod2usage(1) if $opt_h;
+
+#---- other variables
+our $liloconf = "/etc/lilo.conf";
+our $conftmp_1 = "/tmp/lilotmp1";
+our $conftmp_2 = "/tmp/lilotmp2";
+our $liloconfold = $liloconf . ".old";
+our $liloconfnew = $liloconf . ".new";
+our $fstabconf = "/etc/fstab";
+
+our $idpath = "/dev/disk/by-id";
+our $uuidpath = "/dev/disk/by-uuid";
+our $lblpath = "/dev/disk/by-label";
+our $template = "/etc/lilo.conf_example";
+
+our $rootpart; # found root part
+our $root_dev; # /dev/hdX9, /dev/sdX9, /dev/md/*
+our $root_id; # UUID, LABEL, ID
+our $boot_dev; # /dev/hdX, /dev/sdX, /dev/md
+our $boot_id; # DISK-ID
+
+#-------------------- main program --------------------
+
+sub main {
+
+ my $exit = 0;
+
+ if (@ARGV == 1) {
+ $liloconf = "$ARGV[0]";
+ $liloconfold = $liloconf . ".old";
+ $liloconfnew = $liloconf . ".new";
+ }
+ if (-f $liloconf and not $opt_f) {
+ print "$prog: $liloconf already exist! Please use '-f' for overwriting.\n";
+ $exit = 1;
+ }
+ else {
+ $exit = create_lilo_conf()
+ }
+ return $exit;
+}
+
+#-------------------- subroutines --------------------
+
+sub create_lilo_conf {
+
+ my $found = 0;
+ my $exit = 1;
+
+ # search for root device in fstab and convert it
+ $found = detect_root_device();
+
+ # convert root device to boot device
+ if ($found) { $found = convert_boot_device(); }
+
+ # finally write new lilo.conf file
+ if ($found) { $exit = write_lilo_conf(); }
+
+ return $exit;
+}
+
+sub detect_root_device {
+
+ # read fstab and find root device;
+ my $found = read_fstab();
+
+ # identify root device: root_dev and root_id
+ if ($found) { $found = convert_root_device(); }
+
+ return $found;
+}
+
+sub read_fstab {
+
+ my $root_part;
+ my $mountpoint;
+ my $broken_fstab = 1;
+ my $base_fstab = 0;
+ my $found = 1;
+
+ # check fstab for root device
+ if (-f $fstabconf) {
+ # Parsing fstab for the root partition
+ open(FSTAB, "<$fstabconf") or die "$prog: couldn't open $fstabconf: $!\n";
+
+ while (<FSTAB>) {
+ # Search magic string which indicates a base filesystem
+ $base_fstab = 1 if /^# UNCONFIGURED FSTAB FOR BASE SYSTEM/;
+ next if /^#/; # ignore comment lines
+
+ s/^[ \t]+//; # remove space or tab at begin of the line
+ ($root_part,$mountpoint) = split(/[ \t]+/);
+ next unless defined $mountpoint; # ignore empty lines too
+
+ # stop if we found the root device...
+ if ($mountpoint eq '/') {
+ $broken_fstab = 0;
+ last;
+ }
+ }
+ close(FSTAB) or die "$prog: couldn't close $fstabconf: $!\n";
+ }
+
+ if ($base_fstab) {
+ print "E: It seems you want configure the base filesystem \n" .
+ "and I'm therefore simply going to exit successfully \n" .
+ "without trying to actually configure LILO properly. \n";
+ $found = 0;
+ }
+ if ($broken_fstab) {
+ print "E: It seems the file /etc/fstab is not properly \n" .
+ "configured: no root partition '/' found! \n";
+ $found = 0;
+ }
+ # save the found root device
+ $rootpart = $root_part;
+
+ return $found;
+}
+
+sub convert_root_device {
+
+ my $found = 1;
+ my $root_disk = '';
+ my $root_link;
+ # global variables: $root_dev, $root_id
+
+ if ($rootpart =~ /\/dev\//) {
+ $root_disk = $rootpart;
+
+ if (-b $root_disk) {
+ $root_dev = $root_disk;
+ if($opt_v) { print "Convert root option $root_disk into UUID\n"; }
+ $root_id = find_id_link($root_disk,$uuidpath);
+
+ if (not -l "$uuidpath/$root_id") {
+ if($opt_v) { print "W: could not find UUID for $root_disk!\n"; }
+ ## than we want use root_dev in lilo.conf
+ #$found = 0;
+ }
+ else {
+ # finally add uuid label
+ $root_id = "UUID=" . $root_id;
+ }
+ }
+ else {
+ if($opt_v) { print "E: cannot check $root_disk: device does not exist!\n"; }
+ $found = 0;
+ }
+ }
+ elsif ($rootpart =~ /^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/};
+
+ if (-l $root_link) {
+ $root_id = $rootpart;
+ $root_disk = readlink($root_link);
+ $root_disk =~ s{\.\./\.\./}{/dev/};
+
+ if (-b $root_disk) { $root_dev = $root_disk; }
+ else {
+ if($opt_v) { print "E: cannot check $root_link: link does not exist!\n"; }
+ $found = 0;
+ }
+ }
+ else {
+ print "E: cannot check $root_link: link does not exist!\n";
+ $found = 0;
+ }
+ }
+ else {
+ print "E: cannot use uncommon $rootpart found as root device!\n";
+ $found = 0;
+ }
+
+ return $found;
+}
+
+sub find_id_link {
+
+ my $olddev = $_[0];
+ my $path_id = $_[1];
+ my @sellinks;
+ my $_idlink;
+ my $_actlink;
+ my $newdevid = '';
+
+ opendir(MYDH, "$path_id") or die("cannot open $path_id: $! \n");
+ @sellinks = grep(!/\-part\d\d?$/, grep(!/^\.\.?$/, readdir(MYDH)));
+ @sellinks = sort(@sellinks);
+ closedir(MYDH);
+
+ foreach $_idlink (@sellinks) {
+ chomp $_idlink;
+ if(not $_idlink =~ /^usb/ and length($_idlink) > 10) {
+ $_actlink = readlink("$path_id/$_idlink");
+ $_actlink =~ s{\.\./\.\./}{/dev/};
+ if($opt_v) { print "** try: $_actlink => $_idlink \n"; }
+
+ # stop if we find the right link...
+ if($_actlink eq $olddev) {
+ $newdevid = $_idlink;
+ if($opt_v) { print "** convert: $_actlink => $path_id/$_idlink \n\n"; }
+ last;
+ }
+ }
+ }
+
+ if(not $newdevid) {
+ if($opt_v) { print "W: $olddev not converted: link not useful\n\n"; }
+ }
+
+ return ($newdevid);
+}
+
+sub convert_boot_device {
+
+ my $found = 1;
+ my $boot_disk = '';
+ my $boot_link;
+ # global variables: $boot_dev, $boot_id
+
+ if (-b $root_dev) {
+ if ($root_dev =~ /\/dev\/md/) {
+ # search if the found partition is a raid volume
+ $boot_disk = check_raid($root_dev);
+ }
+ else {
+ # find the right block device name
+ $boot_disk = $root_dev;
+ $boot_disk =~ s/\d+$//;
+ }
+
+ if (-b $boot_disk) {
+ # set global variable boot_dev
+ $boot_dev = $boot_disk;
+ }
+ else {
+ print "E: boot device $boot_disk does not exist! \n";
+ $found = 0;
+ }
+ }
+ else {
+ print "E: could not find root device $root_dev! \n";
+ $found = 0;
+ }
+
+ if ($found) {
+ if($opt_v) { print "Convert boot option $boot_disk into DISK ID\n"; }
+ $boot_id = $idpath . "/" . find_id_link($boot_disk,$idpath);
+
+ if(not -l "$boot_id") {
+ if($opt_v) { print "W: could not find DISK ID for $boot_disk!\n"; }
+ ## not so important, than using boot_dev in lilo.conf
+ #$found = 0;
+ }
+ }
+
+ return $found;
+}
+
+sub check_raid {
+
+ my $part = $_[0];
+ my $mdname;
+ my $md;
+ my @devices;
+
+ # check if the found partition is a raid volume
+ if($part =~ /\/dev\/md/)
+ {
+ $mdname = $part;
+ $mdname =~ s/\/dev\///;
+ $mdname =~ s/\///;
+ $md = `grep $mdname /proc/mdstat`;
+
+ @devices = split(" ", $md);
+ @devices = sort(@devices[4..$#devices]);
+ $part = "/dev/" . $devices[0];
+ $part =~ s/\[.*$//;
+
+ }
+ return $part;
+}
+
+sub write_lilo_conf {
+
+ my @status;
+ my $exit = copy_template();
+
+ if (not $exit) {
+ # create lilo.conf.new
+ write_boot_option();
+ write_image_config();
+ }
+
+ if (-f $liloconf and not -f $liloconfold) {
+ # move old lilo.conf to lilo.conf.old
+ @status = stat($liloconf);
+ move ($liloconf, $liloconfold) or die "Cannot rename file: $!\n";
+ utime ($status[9],$status[9],$liloconfold);
+ chmod (0600,$liloconfold);
+ print "Old file moved to: $liloconfold \n";
+ }
+ if (-f $liloconfnew) {
+ move ($liloconfnew, $liloconf) or die "Cannot move file: $!\n";
+ chmod (0600,$liloconf);
+ print "New file created as: $liloconf \n";
+ print "Now you must execute '/sbin/lilo' to " .
+ "activate this new configuation!\n\n";
+ }
+ else {
+ print "E: Cannot find temporary file $conftmp_1!\n";
+ $exit = 1;
+ }
+
+ return $exit;
+}
+
+sub copy_template {
+
+ my $endreached = 0;
+ my $exit = 0;
+
+ # copy template config
+ if (-f $template) {
+ system("gzip -d -c $template >$conftmp_1") if ($template =~ /\.gz$/);
+ system("cat $template >$conftmp_1") if ($template =~ /\.conf$/);
+
+ 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";
+
+ while (<CONFTMP1>) {
+ if (/first\ example/) {
+ $endreached = 1;
+ }
+ unless ($endreached) {
+ print CONFTMP2 $_;
+ }
+ }
+ close(CONFTMP1) or die "$prog: couldn't close $conftmp_1: $!\n";;
+ close(CONFTMP2) or die "$prog: couldn't close $conftmp_2: $!\n";;
+ }
+ else {
+ open(CONFTMP2, ">$conftmp_2") or die "$prog: couldn't open $conftmp_2: $!\n";
+ print CONFTMP2 "# /etc/lilo.conf
+
+### LILO global section ###
+
+#large-memory
+lba32
+boot = /dev/sda
+map = /boot/map
+install = menu
+menu-scheme = Wb:Yr:Wb:Wb
+prompt
+timeout = 100
+vga = normal
+#default = Linux
+
+### LILO per-image section ###
+
+";
+ close(CONFTMP2) or die "$prog: couldn't close $conftmp_2: $!\n";;
+ }
+
+ return $exit;
+}
+
+sub write_boot_option {
+
+ my $oldline = '';
+ my $newline = '';
+ my $ok = 0;
+
+ open(MYFH_NEW, "> $liloconfnew") or die "Cannot open file: $!";
+ open(MYFH_TMP, "< $conftmp_2") or die "Cannot read file: $!";
+
+ while (<MYFH_TMP>) {
+ # line read from MYFH_TMP
+ $oldline = $_;
+
+ if (/^boot/ and $ok == 0) {
+ if ($boot_id) {
+ $oldline = "#boot = $boot_dev\n";
+ $newline = "boot = $boot_id\n";
+ print MYFH_NEW $oldline;
+ if($opt_v) { print $oldline; }
+ }
+ else {
+ $oldline = "boot = $boot_dev\n";
+ }
+ print MYFH_NEW $newline;
+ if($opt_v) { print $newline; }
+ if($opt_v) { print "\n"; }
+
+ # convert only one time
+ $ok = 1;
+ }
+ else {
+ print MYFH_NEW $oldline;
+ }
+ }
+ close(MYFH_TMP);
+ close(MYFH_NEW);
+}
+
+sub write_image_config {
+
+ my $image;
+ my $initrd;
+ my $nr;
+ my $nr2;
+
+ # search for kernel image files
+ my @vmlinuz = readpipe("/bin/ls -t -1 /boot/vmlinuz-2* 2>/dev/null");
+
+ # append to new lilo.conf
+ open(MYFH_NEW, ">> $liloconfnew") or die "Cannot open file: $!";
+
+ # create some line for each kernel image
+ $nr = 0;
+ foreach $image (@vmlinuz) {
+ # search for kernel initrd file
+ chomp $image;
+ $initrd = $image;
+ $initrd =~ s/vmlinuz/initrd\.img/;
+ $nr2 = $nr + 1;
+
+ 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"; }
+ }
+ if ($root_id) {
+ print MYFH_NEW "\t" . '#root = ' . $root_dev . "\n";
+ if($opt_v) { print "\t" . '#root = ' . $root_dev . "\n"; }
+ print MYFH_NEW "\t" . 'root = "' . $root_id . '"' . "\n";
+ if($opt_v) { print "\t" . 'root = "' . $root_id . '"' . "\n"; }
+ }
+ else {
+ print MYFH_NEW "\t" . 'root = ' . $root_dev . "\n";
+ if($opt_v) { print "\t" . 'root = ' . $root_dev . "\n"; }
+ }
+ print MYFH_NEW "\t" . 'read-only' . "\n";
+ if($opt_v) { print "\t" . 'read-only' . "\n"; }
+ print MYFH_NEW "#\t" . 'restricted' . "\n";
+ if($opt_v) { print "#\t" . 'restricted' . "\n"; }
+ print MYFH_NEW "#\t" . 'alias = ' . "$nr2" . "\n";
+ if($opt_v) { print "#\t" . 'alias = ' . "$nr2" . "\n"; }
+ print MYFH_NEW "#\t" . 'optional' . "\n";
+ if($opt_v) { print "#\t" . 'optional' . "\n"; }
+ if (-f $initrd) {
+ print MYFH_NEW "\t" . 'initrd = ' . $initrd . "\n";
+ if($opt_v) { print "\t" . 'initrd = ' . $initrd . "\n"; }
+ }
+ print MYFH_NEW "\n";
+ if($opt_v) { print "\n"; }
+
+ $nr++;
+ last if ($nr > 1);
+ }
+
+ close(MYFH_NEW);
+}
+
+
+main();
+
+__END__
+
+
+=head1 NAME
+
+liloconfig - create new lilo.conf file (with diskid and uuid)
+
+=head1 SYNOPSIS
+
+liloconfig [-h] [-v] [-f] [lilo.conf]
+
+=head1 DESCRIPTION
+
+liloconfig is an simple program for creating a new lilo.conf file.
+After creating the new configuration file you must execute '/sbin/lilo'.
+
+liloconfig use the lilo.example.conf file as template. In the final
+lilo.conf file you find many useful comments for custom changes.
+
+=head1 EXAMPLES
+
+Lines in the configuration file /etc/lilo.conf:
+
+ ### LILO global section ###
+
+ #large-memory
+ lba32
+ boot = /dev/sda
+ map = /boot/map
+ install = menu
+ menu-scheme = Wb:Yr:Wb:Wb
+ prompt
+ timeout = 100
+ vga = normal
+ #default = Linux
+
+ ### LILO per-image section ###
+
+ #boot = /dev/sda
+ boot = /dev/disk/by-id/ata-SAMSUNG_SV1604N_S01FJ10X999999
+
+ image = /boot/vmlinuz-2.6.32-5book-686
+ label = "Linux"
+ #root = /dev/sda1
+ root = "UUID=18843936-00f9-4df0-a373-000d05a5dd44"
+ read-only
+ # restricted
+ # alias = 1
+ # optional
+ initrd = /boot/initrd.img-2.6.32-5book-686
+
+ image = /boot/vmlinuz-2.6.32-5-686
+ label = "Linux Old"
+ #root = /dev/sda1
+ root = "UUID=18843936-00f9-4df0-a373-000d05a5dd44"
+ read-only
+ # restricted
+ # alias = 2
+ # optional
+ initrd = /boot/initrd.img-2.6.32-5-686
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-h>
+
+Print a brief help.
+
+=item B<-v>
+
+Print verbose messages.
+
+=item B<-f>
+
+Force overriding existing lilo.conf.
+
+=back
+
+=head1 AUTHOR
+
+B<liloconfig> was written by Joachim Wiedorn.
+
+=cut
# -*- makefile -*-
+#
+# Copyright 2009-2011 Joachim Wiedorn
+# All rights reserved.
+#
+# Licensed under the terms contained in the file 'COPYING'
+# in the source directory.
+#
# adding variables
include ../make.vars
NASM=nasm
G=`cat foo1 foo2 | grep version | cut -d " " -f 3`
-CFLAGS=$(OPT) -Wall -g $(PCONFIG)
+CFLAGS=$(OPT) -Wall $(PCONFIG)
LDFLAGS=#-Xlinker -qmagic
LIBS=$(DEVMAPPER)
EDIT=edit.c common.o
-LIS=chain.lis disk.lis dparam.lis os2_d.lis first.lis second.lis \
+LIS=chain.lis disk.lis dparam.lis first.lis second.lis \
bootsect.lis third.lis mbr.lis bitmap.lis pseudo.lis mbr2.lis \
pseudo1.lis loader.lis pseudo3.lis
BFILES=first.b second.b third.b bitmap.b chain.b mbr.b mbr2.b \
floppy2: disk.b
@echo
@echo Creating Diagnostic Floppy 2.4
- @make -C ../diagnose check
- @make -C ../diagnose floppy
+ @$(MAKE) -C ../diagnose check
+ @$(MAKE) -C ../diagnose floppy
diagnostic: ../test.img diag1.img diag2.img diag3.img
dd if=$*.img of=$*.b bs=32 skip=1
edit: $(EDIT)
- $(CC) -Wall -s -O -DSTANDALONE -o edit $(EDIT) $(LDFLAGS)
+ $(CC) $(CFLAGS) -DSTANDALONE -o edit $(EDIT) $(LDFLAGS)
-loader.i: mkloader first.b second.b third.b bitmap.b mbr.b \
- chain.b os2_d.b mbr2.b
+loader.i: mkloader first.b second.b third.b bitmap.b mbr.b chain.b mbr2.b
./mkloader >loader.i
disk.com: disk.b
rm -f $(TMP).S
pseudo2.s: bootsect.S pseudo.S
- make -C ../diagnose all
+ $(MAKE) -C ../diagnose all
cat bootsect.S pseudo.S >$(TMP).S
$(CPP) -traditional $(PCONFIG) \
-DSIZEKRNL=`wc -c <../diagnose/test4.com | sed "s/ //g"` \
rm -f $(TMP).S
pseudo3.s: bootsect.S pseudo.S
- make -C ../diagnose all
+ $(MAKE) -C ../diagnose all
cat bootsect.S pseudo.S >$(TMP).S
$(CPP) -traditional $(PCONFIG) \
-DSIZEKRNL=`wc -c <../diagnose/test5.com | sed "s/ //g"` \
cat pseudo1.b disk.com >diag1.img
diag2.img: pseudo2.b
- make -C ../diagnose all
+ $(MAKE) -C ../diagnose all
cat pseudo2.b ../diagnose/test4.com >diag2.img
diag3.img: pseudo3.b
- make -C ../diagnose all
+ $(MAKE) -C ../diagnose all
cat pseudo3.b ../diagnose/test5.com >diag3.img
flags.i: ../test.img Makefile version $(CFILES) $(HFILES)
chain.s: chain.S lilo.h version.h first.b Makefile
$(CPP) $(PCONFIG) -DCHAIN=0x536a7646 chain.S -o chain.s
-os2_d.s: chain.S lilo.h version.h first.b Makefile
- $(CPP) $(PCONFIG) chain.S -DDOS_D -o os2_d.s
-
xxx.s: chain.S lilo.h Makefile
$(CPP) chain.S -DXXX -o xxx.s
rm -f $$DESTDIR$(BOOT_DIR)/boot-text.b; rm -f $$DESTDIR$(BOOT_DIR)/boot-text.old; fi
@if [ -f $$DESTDIR$(BOOT_DIR)/chain.b ]; then \
mv $$DESTDIR$(BOOT_DIR)/chain.b $$DESTDIR$(BOOT_DIR)/chain.old; fi
- @if [ -f $$DESTDIR$(BOOT_DIR)/os2_d.b ]; then \
- mv $$DESTDIR$(BOOT_DIR)/os2_d.b $$DESTDIR$(BOOT_DIR)/os2_d.old; fi
@if [ -f $$DESTDIR$(BOOT_DIR)/mbr.b ]; then \
mv $$DESTDIR$(BOOT_DIR)/mbr.b $$DESTDIR$(BOOT_DIR)/mbr.old; fi
- if [ -f os2_d.b -a $(BUILTIN) -eq 0 ]; then cp os2_d.b $$DESTDIR$(BOOT_DIR); fi
if [ -f chain.b -a $(BUILTIN) -eq 0 ]; then cp chain.b $$DESTDIR$(BOOT_DIR); fi
if [ -f mbr.b -a $(BUILTIN) -eq 0 ]; then cp mbr.b $$DESTDIR$(BOOT_DIR); fi
if [ -f diag1.img ]; then cp -f diag1.img $$DESTDIR$(BOOT_DIR); fi
rm -f $$DESTDIR$(BOOT_DIR)/diag1.img
rm -f $$DESTDIR$(BOOT_DIR)/diag2.img
- if [ -f $$DESTDIR$(BOOT_DIR)/os2_d.b ]; then \
- rm -f $$DESTDIR$(BOOT_DIR)/os2_d.b; fi
if [ -f $$DESTDIR$(BOOT_DIR)/chain.b ]; then \
rm -f $$DESTDIR$(BOOT_DIR)/chain.b; fi
if [ -f $$DESTDIR$(BOOT_DIR)/mbr.b ]; then \
*
* Copyright 1992-1998 Werner Almesberger
* Copyright 1999-2007 John Coffman
- * Copyright 2009-2010 Joachim Wiedorn
+ * Copyright 2009-2011 Joachim Wiedorn
* All rights reserved.
*
* Licensed under the terms contained in the file 'COPYING'
check_size(spec,setup,sectors);
else {
if (hdr.start % PAGE_SIZE)
- die("Can't load kernel at mis-aligned address 0x%08lx\n",hdr.start);
+ die("Can't load kernel at mis-aligned address 0x%08x\n",hdr.start);
descr->flags |= FLAG_LOADHI; /* load kernel high */
hi_sectors = sectors - setup; /* number of sectors loaded high */
hi_sectors *= 6; /* account for decompression */
if (!loader) loader = DFL_CHAIN;
#ifdef LCF_BUILTIN
-#ifndef LCF_SOLO_CHAIN
- if (strstr(loader,"os2")) {
- chain = &Os2_d;
- cname = "OS/2";
- }
- else
-#endif
{
chain = &Chain;
cname = "CHAIN";
!
-! bootsect.s Copyright (C) 1991, 1992 Linus Torvalds
+! bootsect.s
+! Copyright (C) 1991, 1992 Linus Torvalds
+!
! modified by Drew Eckhardt
! modified by Bruce Evans (bde)
-! modified by John Coffman for LILO disk.b diagnostic (27-Mar-2000)
-! (09-Mar-2001)
+! modified by John Coffman (2000, 2001)
+! modified by Joachim Wiedorn (2011)
!
!
! bootsect.s is loaded at 0x7c00 by the bios-startup routines, and moves
INITSEG = 0x9000 ! we move boot here - out of the way
SETUPSEG = INITSEG+0x20 ! setup starts here
SYSSEG = 0x1000 ! system loaded at 0x10000 (65536).
-MAX_SETUPSECS = 31 ! same as lilo.h
+MAX_SETUPSECS = 63 ! same as lilo.h (for kernel >= 2.4.0)
STK_SIZE = MAX_SETUPSECS*512+512 ! 0x4000
#ifndef SIZEKRNL
}
-void cfg_error(char *msg,...)
+void __attribute__ ((format (printf, 1, 2))) cfg_error(char *msg,...)
{
va_list ap;
/* Opens the configuration file. Returns the file descriptor of the open
file. */
-void cfg_error(char *msg,...);
+void cfg_error(char *msg,...) __attribute__ ((format (printf, 1, 2)));
/* Signals an error while parsing the configuration file and terminates the
program. */
int curr_prt_map;
#endif /* !__MSDOS__ */
-/*volatile*/ void pdie(char *msg)
+/*volatile*/ void pdie(const char *msg)
{
fflush(stdout);
#if !__MSDOS__
}
-/*volatile*/ void die(char *fmt,...)
+/*volatile*/ void __attribute__ ((format (printf, 1, 2))) die(const char *fmt,...)
{
va_list ap;
#define comma (cc(First)|cc(Second)|cc(Third)|cc(Bitmap)|cc(Chain)|cc(Mbr)|cc(Mbr2))
-/*volatile*/ void pdie(char *msg);
+/*volatile*/ void pdie(const char *msg) __attribute__ ((noreturn));
/* Do a perror and then exit. */
-/*volatile*/ void die(char *fmt,...);
+/*volatile*/ void __attribute__ ((format (printf, 1, 2)))
+ __attribute__ ((noreturn)) die(const char *fmt,...);
/* fprintf an error message and then exit. */
char name[PATH_MAX];
ST_BUF st;
int count;
+ int err;
if (lookup_dev(name,dev,number)) dev->delete = 0;
else {
#endif
if (flags == O_BYPASS) dev->fd = -1;
else if ((dev->fd = open(name,flags)) < 0) {
- fprintf (errstd, "Cannot proceed. Maybe you need to add "
+ err = errno;
+ fprintf (errstd, "Cannot proceed. Maybe you need to add "
"this to your lilo.conf:\n"
"\tdisk=%s inaccessible\n"
"(real error shown below)\n", name);
- die("open %s: %s",name,strerror(errno));
+ die("open %s: %s",name,strerror(err));
}
dev->name = stralloc(name);
return dev->fd;
*(int*)&buff.sector[PART_TABLE_OFFSET-6] = serial;
if (*(short*)&buff.sector[PART_TABLE_OFFSET - 2] == 0)
- *(short*)&buff.sector[PART_TABLE_OFFSET - 2] = MAGIC_SERIAL;
+ *(unsigned short*)&buff.sector[PART_TABLE_OFFSET - 2] = MAGIC_SERIAL;
if (verbose)
printf("Assigning new Volume ID to (%04X) '%s' ID = %08X\n",
device, dev.name, (int)serial);
if (device_code[i]==device)
die("register_bios: device code duplicated: %04X", device);
if (serial_no[i]==serial)
- die("register_bios: volume ID serial no. duplicated: %08lX", serial);
+ die("register_bios: volume ID serial no. duplicated: %08X", serial);
}
device_code[bios] = device;
serial_no[bios] = serial;
fd = dev_open(&dev, device, option ? O_RDWR : O_RDONLY);
if (read(fd, &buf, sizeof(buf)) != sizeof(buf)) {
- fprintf (errstd, "Cannot proceed. Maybe you need to add "
+ fprintf (errstd, "Cannot proceed. Maybe you need to add "
"this to your lilo.conf:\n"
"\tdisk=%s inaccessible\n"
"(real error shown below)\n", dev.name);
- die("VolumeID read error: sector 0 of %s not readable", dev.name);
+ die("VolumeID read error: sector 0 of %s not readable", dev.name);
}
if (option==ID_SET) {
make_backup(NULL, 0, &buf, device,
if (fh->magic != 0x4D42 /* "BM" */) return 1;
if (read(fd, &size, sizeof(size)) != sizeof(size)) return -1;
if (size==sizeof(BITMAPHEADER2)) { /* an OS/2 bitmap */
- if (read(fd, (void*)&bmh2+sizeof(size), sizeof(BITMAPHEADER2)-sizeof(size))
+ if (read(fd, (char*)&bmh2+sizeof(size), sizeof(BITMAPHEADER2)-sizeof(size))
!= sizeof(BITMAPHEADER2)-sizeof(size) ) return -1;
memset(bmh, 0, sizeof(BITMAPHEADER));
bmh->width = bmh2.width;
n = sizeof(RGB2);
}
else if (size==sizeof(BITMAPHEADER)) {
- if (read(fd, (void*)bmh+sizeof(size), sizeof(BITMAPHEADER)-sizeof(size))
+ if (read(fd, (char*)bmh+sizeof(size), sizeof(BITMAPHEADER)-sizeof(size))
!= sizeof(BITMAPHEADER)-sizeof(size) ) return -1;
bmh->size = size;
n = sizeof(RGB);
/* get probable BITMAPLILOHEADER */
if (read(fd, &size, sizeof(size)) != sizeof(size)) return -1;
if (size != sizeof(BITMAPLILOHEADER)) return 4;
- if (read(fd, (void*)lh+sizeof(size), sizeof(*lh)-sizeof(size)) !=
+ if (read(fd, (char*)lh+sizeof(size), sizeof(*lh)-sizeof(size)) !=
sizeof(*lh)-sizeof(size)) return -1;
*(int*)(lh->size) = size;
if (strncmp(lh->magic, "LILO", 4) != 0) return 5;
BITMAPLILOHEADER bmlh;
} tm;
static MENUTABLE *menu = &tm.mt;
-static BITMAPLILOHEADER *lh = (void*)tm.buffer +
- ((long)&tm.mt.row - (long)&tm.bmlh.row);
+static BITMAPLILOHEADER *lh = (void*)(tm.buffer +
+ ((long)&tm.mt.row - (long)&tm.bmlh.row));
/* a convenience definition */
#define mn tm.mt
if (strspn(line," \t") != strlen(line)) {
entry = alloc_t(DT_ENTRY);
items = sscanf(line,"0x%x 0x%x %d %d %d %d",&entry->device,
- &entry->bios,&entry->sectors,&entry->heads,&entry->cylinders,
+ (unsigned int*)&entry->bios,&entry->sectors,&entry->heads,&entry->cylinders,
&entry->start);
if (items == 5) entry->start = -1;
if (items < 5)
if (i!=7 && i!=15 && i!=31 && i!=63) die("disk=%s: illegal value for max-partitions(%d)", disk, i);
}
else {
- die("Implementation restriction: max-partitions on major device > %d", nelem(max_partno)-1);
+ die("Implementation restriction: max-partitions on major device > %d", (int)nelem(max_partno)-1);
}
}
entry->bios = bios ? to_number(bios) : -1;
* only used to count IDE drives anyway, we try now only the first two devices
* and forget about scan_last_dev.
*/
+ DEVICE dev;
+ int devs;
static int cached_major=-1, cached_increment=-1, cached_result=-1;
if(major == cached_major && increment == cached_increment)
return cached_result;
cached_major = major;
cached_increment = increment;
- DEVICE dev;
- int devs;
for (devs = 0;
devs < 2 && dev_open(&dev,MKDEV(major,increment*devs),O_BYPASS);
lvmfd = dev_open(&dev, lbm->lv_dev, O_RDONLY);
if (lvmfd < 0)
- die("can't open LVM block device %#x\n", lbm->lv_dev);
+ die("can't open LVM block device %#x\n", (int)lbm->lv_dev);
last_dev = lbm->lv_dev;
}
if (ioctl(lvmfd, LV_BMAP, lbm) < 0) {
if ((MAJOR(device)>=120 && MAJOR(device)<=127) ||
(MAJOR(device)>=240 && MAJOR(device)<=254) )
- die("Linux experimental device 0x04x needs to be defined.\n"
+ die("Linux experimental device 0x%04x needs to be defined.\n"
"Check 'man lilo.conf' under 'disk=' and 'max-partitions='", device);
else die("Sorry, don't know how to handle device 0x%04x",device);
}
} /* end of geo_get */
-int geo_open(GEOMETRY *geo,char *name,int flags)
+int geo_open(GEOMETRY *geo,const char *name,int flags)
{
char *here;
int user_dev,block_size;
is retrieved and the other geometry information is undefined. */
-int geo_open(GEOMETRY *geo,char *name,int flags);
+int geo_open(GEOMETRY *geo,const char *name,int flags);
/* Opens the specified file or block device, obtains the necessary geometry
information and returns the file descriptor. If the name contains a BIOS
device specification (xxx:yyy), it is removed and stored in the geometry
*
* Copyright 1992-1998 Werner Almesberger
* Copyright 1999-2007 John Coffman
- * Copyright 2009-2010 Joachim Wiedorn
+ * Copyright 2009-2011 Joachim Wiedorn
* All rights reserved.
*
* Licensed under the terms contained in the file 'COPYING'
fprintf(errstd,"%7s%s [ -C config_file ] -I name [ options ]\n","",name);
fprintf(errstd,"%7s%s [ -C config_file ] [ -s save_file ] "
"-u | -U [ boot_device ]\n","",name);
+ fprintf(errstd,"%7s%s -H\t\t\t\tinstall only to active discs (RAID-1)\n", "", name);
fprintf(errstd,"%7s%s -A /dev/XXX [ N ]\t\tinquire/activate a partition\n","",name);
fprintf(errstd,"%7s%s -M /dev/XXX [ mbr | ext ]\tinstall master boot record\n","",name);
fprintf(errstd,"%7s%s -T help \t\t\tlist additional options\n", "", name);
if (version+activate+instmbr+(tell_param!=NULL) > 1) usage(name);
if (activate) do_activate(act1, act2);
#endif /* !__MSDOS__ */
+
if (verbose > 0 || version) {
- printf("LILO version %d.%d%s%s", VERSION_MAJOR, VERSION_MINOR,
- VERSION_EDIT, test ? " (test mode)" : "");
- if (version && verbose<=0) {
- printf("\n");
- return 0;
- }
- printf("\n * Copyright (C) 1992-1998 Werner Almesberger (until v20)\n"
- " * Copyright (C) 1999-2007 John Coffman (until v22)\n"
- " * Copyright (C) 2009-2010 Joachim Wiedorn (since v23)\n"
- "This program comes with ABSOLUTELY NO WARRANTY. This is free software \n"
- "distributed under the BSD License (3-clause). Details can be found in \n"
- "the file COPYING, which is distributed with this software.\n"
- );
+ printf("LILO version %d.%d%s", VERSION_MAJOR, VERSION_MINOR, VERSION_EDIT);
+ if (test)
+ printf(" (test mode)\n");
+ else
+ printf(" (released %s)\n", VERSION_DATE);
+ if (version && verbose<=0) {
+ /* exit if user asks for version and no verbose */
+ return 0;
+ }
+ printf(" * Copyright (C) 1992-1998 Werner Almesberger (until v20)\n"
+ " * Copyright (C) 1999-2007 John Coffman (until v22)\n"
+ " * Copyright (C) 2009-2011 Joachim Wiedorn (since v23)\n"
+ "This program comes with ABSOLUTELY NO WARRANTY. This is free software \n"
+ "distributed under the BSD License (3-clause). Details can be found in \n"
+ "the file COPYING, which is distributed with this software.\n"
+ );
if (verbose>0) {
#if !__MSDOS__
#include <sys/utsname.h>
- struct utsname buf;
+ struct utsname buf;
#endif
- printf("Released %s%s and compiled at %s on %s%s\n",
- VERSION_DATE, comma ? "," : "", __TIME__, __DATE__, semi);
+ printf("Compiled at %s on %s%s\n", __TIME__, __DATE__, semi);
#if !__MSDOS__
- if (verbose>=2 && uname(&buf)==0) {
- printf("Running %s kernel %s on %s\n",
- buf.sysname, buf.release, buf.machine);
- }
+ if (verbose>=2 && uname(&buf)==0) {
+ printf("Running %s kernel %s on %s\n",
+ buf.sysname, buf.release, buf.machine);
+ }
#endif
- }
+ }
printf("\n");
if (version) {
if (verbose>=2) configuration();
/* lilo.h - LILO constants
-
-Copyright 1992-1998 Werner Almesberger.
-Copyright 1999-2006 John Coffman.
-All rights reserved.
-
-Licensed under the terms contained in the file 'COPYING' in the
-source directory.
-
-*/
-
+ *
+ * Copyright 1992-1998 Werner Almesberger
+ * Copyright 1999-2006 John Coffman
+ * Copyright 2009-2011 Joachim Wiedorn
+ * All rights reserved.
+ *
+ * Licensed under the terms contained in the file 'COPYING'
+ * in the source directory.
+ */
/* This file is also included by the boot loader assembler code. Put
everything that isn't legal C syntax or isn't swallowed by the
#define STAGE_FLAG_MENU 0x0200 /* boot loader supports menu interface */
#define STAGE_FLAG_BMP4 0x0400 /* boot loader supports 640x480x4 bitmaps */
-#define SETUPSECS 4 /* nr of setup sectors */
-#define VSS_NUM 497 /* address where variable setup size is
- stored */
+#define VSS_NUM 497 /* address where variable setup size is stored */
#define VGA_SET 506 /* address of initial kernel VGA mode */
-#define MAX_SETUPSECS 31 /* maximum number of sectors in kernel
- setup code (+ bootsect) */
+#define SETUPSECS 4 /* default number of setup sectors */
+#define MAX_SETUPSECS 63 /* maximum number of sectors in kernel
+ setup code (+ bootsect) (for kernel >= 2.4.0) */
#define MAX_KERNEL_SECS 1024 /* absolute maximum kernel size */
#define SPECIAL_SECTORS 2 /* special sectors (don't compact) at beginning
of map sections */
#endif
static
-int anywhere(void *buf, char *str)
+int anywhere(unsigned char *buf, char *str)
{
int k, n;
- void *s;
+ char *s;
k = strlen(str);
n = SECTOR_SIZE-k;
while(s) {
if (!strncmp(s, str, k)) return 1;
s++;
- n = SECTOR_SIZE - k - (int)(s-buf);
+ n = SECTOR_SIZE - k - (int)(s-(char*)buf);
s = memchr(s, *str, n);
}
return 0;
int i;
if (curr_prt_map == PRTMAP_SIZE)
- cfg_error("Too many change rules (more than %s)",PRTMAP_SIZE);
+ cfg_error("Too many change rules (more than %d)",PRTMAP_SIZE);
if (verbose >= 3)
printf(" Adding rule: disk 0x%02x, offset 0x%x, 0x%02x -> 0x%02x\n",
bios,PART_TABLE_OFFSET+offset,expect,set);
eq = (void*)&buf.b[buf.s5.equipment];
v1 = (void*)&buf.b[buf.s5.video];
if (buf.s5.vid > 1) {
- v2 = (void*)v1 + sizeof(*v1);
- v25 = (void*)v2 + sizeof(*v2);
+ v2 = (void*)(v1 + 1);
+ v25 = (void*)(v2 + 1);
}
- if (buf.s5.vid > 2) v3 = (void*)v25 + sizeof(*v25);
+ if (buf.s5.vid > 2) v3 = (void*)(v25 + 1);
}
#if BETA_TEST
if (verbose>=5) printf("fetch: good return\n");
if (drive >= 0x80)
- hdp[drive-0x80 + 1] = (void*)hd + sizeof(hard_t); /* simplest increment, but may be wrong */
+ hdp[drive-0x80 + 1] = hd + 1; /* simplest increment, but may be wrong */
/* regs.eax = 0x1500; check drive type */
/* regs.edx = drive; */
#if 0
geom->pt = &pt_base[(drive&15)*4];
#else
- void *p = (void*)pt_base;
+ char *p = (char*)pt_base;
int i = buf.s5.version >= 4 ? 8 : 0;
p += (drive & 15) * (PART_TABLE_SIZE + i) + i;
fflush(stdout);
#endif
/* update the pointer to the next drive */
- hdp[drive-0x80 + 1] = (void*)dp + sizeof(edd_t);
+ hdp[drive-0x80 + 1] = (void*)(dp + 1);
/* regs.eax = 0x4800; */
/* regs.edx = drive; */
xor edx,edx ; flag nothing found
xor esi,esi ; flag size==0
xor ebx,ebx
- ;jmp e8go ; circumvented due to BIOS problems
- br no_e801 ; skip to backup plan
+ jmp e8go
e8go2: or ebx,ebx ; test for end
jz e8go5
e8go: push edx ; save best prospect
-/* temp.c - Temporary file registry */
-/*
-Copyright 1992-1998 Werner Almesberger.
-Copyright 1999-2006 John Coffman.
-All rights reserved.
-
-Licensed under the terms contained in the file 'COPYING' in the
-source directory.
-
-*/
-
+/* temp.c - Temporary file registry
+ *
+ * Copyright 1992-1998 Werner Almesberger
+ * Copyright 1999-2006 John Coffman
+ * Copyright 2009-2011 Joachim Wiedorn
+ * All rights reserved.
+ *
+ * Licensed under the terms contained in the file 'COPYING'
+ * in the source directory.
+ */
#define _GNU_SOURCE
#include <stdlib.h>
process("mbr.b", "Mbr");
process("mbr2.b", "Mbr2");
process("chain.b", "Chain");
-#ifndef LCF_SOLO_CHAIN
- process("os2_d.b", "Os2_d");
-#endif
#endif
printf("/*** end loader ***/\n");
return 0;
#define VERSION_H
#define VERSION_MAJOR 23
-#define VERSION_MINOR 1
+#define VERSION_MINOR 2
#define VERSION_EDIT ""
-#define VERSION_DATE "04-Nov-2010"
+#define VERSION_DATE "09-Apr-2011"
#endif