From 28d8d828b3c36ab05534951694c7e7999eae77cf Mon Sep 17 00:00:00 2001 From: Marty Connor Date: Fri, 6 Jul 2007 08:04:06 -0400 Subject: Rename .lilo extension to .lkrn and updated dependencies --- src/arch/i386/Makefile | 10 +-- src/arch/i386/prefix/bImageprefix.S | 2 +- src/arch/i386/prefix/liloprefix.S | 147 ------------------------------------ src/arch/i386/prefix/lkrnprefix.S | 147 ++++++++++++++++++++++++++++++++++++ src/util/geniso | 10 +-- src/util/genliso | 12 +-- src/util/makelilo.pl | 40 ---------- 7 files changed, 164 insertions(+), 204 deletions(-) delete mode 100644 src/arch/i386/prefix/liloprefix.S create mode 100644 src/arch/i386/prefix/lkrnprefix.S delete mode 100755 src/util/makelilo.pl (limited to 'src') diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile index f4e19d3f3..bda22c8af 100644 --- a/src/arch/i386/Makefile +++ b/src/arch/i386/Makefile @@ -68,9 +68,9 @@ MEDIA += lmelfd OBJS_lmelfdprefix = lmelfdprefix zlmelfdprefix CFLAGS_zlmelfdprefix = $(CFLAGS_ZPREFIX) -MEDIA += lilo -OBJS_liloprefix = liloprefix zliloprefix -CFLAGS_zliloprefix = $(CFLAGS_ZPREFIX) +MEDIA += lkrn +OBJS_lkrnprefix = lkrnprefix zlkrnprefix +CFLAGS_zlkrnprefix = $(CFLAGS_ZPREFIX) MEDIA += bImage OBJS_bImageprefix = bImageprefix zbImageprefix @@ -113,12 +113,12 @@ NON_AUTO_MEDIA += fd0 # rule to make a non-emulation ISO boot image NON_AUTO_MEDIA += iso -%iso: %lilo util/geniso +%iso: %lkrn util/geniso ISOLINUX_BIN=$(ISOLINUX_BIN) bash util/geniso $@ $< # rule to make a floppy emulation ISO boot image NON_AUTO_MEDIA += liso -%liso: %lilo util/genliso +%liso: %lkrn util/genliso bash util/genliso $@ $< # rule to make a USB disk image diff --git a/src/arch/i386/prefix/bImageprefix.S b/src/arch/i386/prefix/bImageprefix.S index 7d746ede3..30020f731 100644 --- a/src/arch/i386/prefix/bImageprefix.S +++ b/src/arch/i386/prefix/bImageprefix.S @@ -91,7 +91,7 @@ _prefix: /* This is a minimal boot sector. If anyone tries to execute it (e.g., if - a .lilo file is dd'ed to a floppy), print an error message. + a .lkrn file is dd'ed to a floppy), print an error message. */ bootsector: diff --git a/src/arch/i386/prefix/liloprefix.S b/src/arch/i386/prefix/liloprefix.S deleted file mode 100644 index 0857f3201..000000000 --- a/src/arch/i386/prefix/liloprefix.S +++ /dev/null @@ -1,147 +0,0 @@ -/* - Copyright (C) 2000, Entity Cyber, Inc. - - Authors: Gary Byers (gb@thinguin.org) - Marty Connor (mdc@thinguin.org) - - This software may be used and distributed according to the terms - of the GNU Public License (GPL), incorporated herein by reference. - - Description: - - This is just a little bit of code and data that can get prepended - to an Etherboot ROM image in order to allow LILO to load the - result as if it were a Linux kernel image. - - A real Linux kernel image consists of a one-sector boot loader - (to load the image from a floppy disk), followed a few sectors - of setup code, followed by the kernel code itself. There's - a table in the first sector (starting at offset 497) that indicates - how many sectors of setup code follow the first sector and which - contains some other parameters that aren't interesting in this - case. - - When LILO loads the sectors that comprise a kernel image, it doesn't - execute the code in the first sector (since that code would try to - load the image from a floppy disk.) The code in the first sector - below doesn't expect to get executed (and prints an error message - if it ever -is- executed.) LILO's only interested in knowing the - number of setup sectors advertised in the table (at offset 497 in - the first sector.) - - Etherboot doesn't require much in the way of setup code. - Historically, the Linux kernel required at least 4 sectors of - setup code. Current versions of LILO look at the byte at - offset 497 in the first sector to indicate how many sectors - of setup code are contained in the image. - -*/ - -#define SETUPSECS 4 /* Minimal nr of setup-sectors */ -#define PREFIXSIZE ((SETUPSECS+1)*512) -#define PREFIXPGH (PREFIXSIZE / 16 ) -#define BOOTSEG 0x07C0 /* original address of boot-sector */ -#define INITSEG 0x9000 /* we move boot here - out of the way */ -#define SETUPSEG 0x9020 /* setup starts here */ -#define SYSSEG 0x1000 /* system loaded at 0x10000 (65536). */ - - .text - .code16 - .arch i386 - .org 0 - .section ".prefix", "ax", @progbits -/* - This is a minimal boot sector. If anyone tries to execute it (e.g., if - a .lilo file is dd'ed to a floppy), print an error message. -*/ - -bootsector: - jmp $BOOTSEG, $1f /* reload cs:ip to match relocation addr */ -1: - movw $0x2000, %di /* 0x2000 is arbitrary value >= length - of bootsect + room for stack */ - - movw $BOOTSEG, %ax - movw %ax,%ds - movw %ax,%es - - cli - movw %ax, %ss /* put stack at BOOTSEG:0x2000. */ - movw %di,%sp - sti - - movw $why_end-why, %cx - movw $why, %si - - movw $0x0007, %bx /* page 0, attribute 7 (normal) */ - movb $0x0e, %ah /* write char, tty mode */ -prloop: - lodsb - int $0x10 - loop prloop -freeze: jmp freeze - -why: .ascii "This image cannot be loaded from a floppy disk.\r\n" -why_end: - - - .org 497 -setup_sects: - .byte SETUPSECS -root_flags: - .word 0 -syssize: - .word _load_size_pgh - PREFIXPGH -swap_dev: - .word 0 -ram_size: - .word 0 -vid_mode: - .word 0 -root_dev: - .word 0 -boot_flag: - .word 0xAA55 - - - .org 512 -/* - We're now at the beginning of the second sector of the image - - where the setup code goes. - - We don't need to do too much setup for Etherboot. - - This code gets loaded at SETUPSEG:0. It wants to start - executing the Etherboot image that's loaded at SYSSEG:0 and - whose entry point is SYSSEG:0. -*/ -setup_code: - /* Etherboot expects to be contiguous in memory once loaded. - * LILO doesn't do this, but since we don't need any - * information that's left in the prefix, it doesn't matter: - * we just have to ensure that %cs:0000 is where the start of - * the Etherboot image *would* be. - */ - ljmp $(SYSSEG-(PREFIXSIZE/16)), $run_etherboot - - - .org PREFIXSIZE -/* - We're now at the beginning of the kernel proper. - */ -run_etherboot: - call install - - /* Jump to .text16 segment */ - pushw %ax - pushw $1f - lret - .section ".text16", "awx", @progbits -1: - pushl $main - pushw %cs - call prot_call - popl %eax /* discard */ - - /* Boot next device */ - int $0x18 diff --git a/src/arch/i386/prefix/lkrnprefix.S b/src/arch/i386/prefix/lkrnprefix.S new file mode 100644 index 000000000..0857f3201 --- /dev/null +++ b/src/arch/i386/prefix/lkrnprefix.S @@ -0,0 +1,147 @@ +/* + Copyright (C) 2000, Entity Cyber, Inc. + + Authors: Gary Byers (gb@thinguin.org) + Marty Connor (mdc@thinguin.org) + + This software may be used and distributed according to the terms + of the GNU Public License (GPL), incorporated herein by reference. + + Description: + + This is just a little bit of code and data that can get prepended + to an Etherboot ROM image in order to allow LILO to load the + result as if it were a Linux kernel image. + + A real Linux kernel image consists of a one-sector boot loader + (to load the image from a floppy disk), followed a few sectors + of setup code, followed by the kernel code itself. There's + a table in the first sector (starting at offset 497) that indicates + how many sectors of setup code follow the first sector and which + contains some other parameters that aren't interesting in this + case. + + When LILO loads the sectors that comprise a kernel image, it doesn't + execute the code in the first sector (since that code would try to + load the image from a floppy disk.) The code in the first sector + below doesn't expect to get executed (and prints an error message + if it ever -is- executed.) LILO's only interested in knowing the + number of setup sectors advertised in the table (at offset 497 in + the first sector.) + + Etherboot doesn't require much in the way of setup code. + Historically, the Linux kernel required at least 4 sectors of + setup code. Current versions of LILO look at the byte at + offset 497 in the first sector to indicate how many sectors + of setup code are contained in the image. + +*/ + +#define SETUPSECS 4 /* Minimal nr of setup-sectors */ +#define PREFIXSIZE ((SETUPSECS+1)*512) +#define PREFIXPGH (PREFIXSIZE / 16 ) +#define BOOTSEG 0x07C0 /* original address of boot-sector */ +#define INITSEG 0x9000 /* we move boot here - out of the way */ +#define SETUPSEG 0x9020 /* setup starts here */ +#define SYSSEG 0x1000 /* system loaded at 0x10000 (65536). */ + + .text + .code16 + .arch i386 + .org 0 + .section ".prefix", "ax", @progbits +/* + This is a minimal boot sector. If anyone tries to execute it (e.g., if + a .lilo file is dd'ed to a floppy), print an error message. +*/ + +bootsector: + jmp $BOOTSEG, $1f /* reload cs:ip to match relocation addr */ +1: + movw $0x2000, %di /* 0x2000 is arbitrary value >= length + of bootsect + room for stack */ + + movw $BOOTSEG, %ax + movw %ax,%ds + movw %ax,%es + + cli + movw %ax, %ss /* put stack at BOOTSEG:0x2000. */ + movw %di,%sp + sti + + movw $why_end-why, %cx + movw $why, %si + + movw $0x0007, %bx /* page 0, attribute 7 (normal) */ + movb $0x0e, %ah /* write char, tty mode */ +prloop: + lodsb + int $0x10 + loop prloop +freeze: jmp freeze + +why: .ascii "This image cannot be loaded from a floppy disk.\r\n" +why_end: + + + .org 497 +setup_sects: + .byte SETUPSECS +root_flags: + .word 0 +syssize: + .word _load_size_pgh - PREFIXPGH +swap_dev: + .word 0 +ram_size: + .word 0 +vid_mode: + .word 0 +root_dev: + .word 0 +boot_flag: + .word 0xAA55 + + + .org 512 +/* + We're now at the beginning of the second sector of the image - + where the setup code goes. + + We don't need to do too much setup for Etherboot. + + This code gets loaded at SETUPSEG:0. It wants to start + executing the Etherboot image that's loaded at SYSSEG:0 and + whose entry point is SYSSEG:0. +*/ +setup_code: + /* Etherboot expects to be contiguous in memory once loaded. + * LILO doesn't do this, but since we don't need any + * information that's left in the prefix, it doesn't matter: + * we just have to ensure that %cs:0000 is where the start of + * the Etherboot image *would* be. + */ + ljmp $(SYSSEG-(PREFIXSIZE/16)), $run_etherboot + + + .org PREFIXSIZE +/* + We're now at the beginning of the kernel proper. + */ +run_etherboot: + call install + + /* Jump to .text16 segment */ + pushw %ax + pushw $1f + lret + .section ".text16", "awx", @progbits +1: + pushl $main + pushw %cs + call prot_call + popl %eax /* discard */ + + /* Boot next device */ + int $0x18 diff --git a/src/util/geniso b/src/util/geniso index 5bd5c7be5..7642ed368 100755 --- a/src/util/geniso +++ b/src/util/geniso @@ -2,14 +2,14 @@ # # Generate a isolinux ISO boot image # -# geniso foo.iso foo.zlilo +# geniso foo.iso foo.lkrn # -# the ISO image is the first argument so that a list of .zlilo images +# the ISO image is the first argument so that a list of .lkrn images # to include can be specified # case $# in 0|1) - echo Usage: $0 foo.iso foo.zlilo ... + echo Usage: $0 foo.iso foo.lkrn ... exit 1 ;; esac @@ -40,8 +40,8 @@ do continue fi b=$(basename $f) - g=${b%.zlilo} - g=${g//[^a-z0-9]}.zli + g=${b%.lkrn} + g=${g//[^a-z0-9]}.krn case "$first" in "") echo DEFAULT $g diff --git a/src/util/genliso b/src/util/genliso index b8d9a11df..0a67eb3cc 100755 --- a/src/util/genliso +++ b/src/util/genliso @@ -2,9 +2,9 @@ # # Generate a legacy floppy emulation ISO boot image # -# genliso foo.liso foo.zlilo +# genliso foo.liso foo.lkrn # -# the ISO image is the first argument so that a list of .zlilo images +# the ISO image is the first argument so that a list of .lkrn images # to include can be specified # case $0 in @@ -16,12 +16,12 @@ case $0 in esac case $# in 0|1) - echo Usage: $0 foo.liso foo.zlilo ... + echo Usage: $0 foo.liso foo.lkrn ... exit 1 ;; esac case "`mtools -V`" in -Mtools\ version\ 3.9.9*|Mtools\ version\ 4.*) +Mtools\ version\ 3.9.9*|Mtools\ version\ 3.9.1[0-9]*|Mtools\ version\ 4.*) ;; *) echo Mtools version 3.9.9 or later is required @@ -57,9 +57,9 @@ do fi # shorten name for 8.3 filesystem b=$(basename $f) - g=${b%.zlilo} + g=${b%.lkrn} g=${g//[^a-z0-9]} - g=${g:0:8}.zli + g=${g:0:8}.krn case "$first" in "") echo DEFAULT $g diff --git a/src/util/makelilo.pl b/src/util/makelilo.pl deleted file mode 100755 index 8f995bc46..000000000 --- a/src/util/makelilo.pl +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl -w - -use constant SYSSIZE_LOC => 500; # bytes from beginning of boot block -use constant MINSIZE => 32768; - -use strict; - -use bytes; - -$#ARGV >= 1 or die "Usage: $0 liloprefix file ...\n"; -open(L, "$ARGV[0]") or die "$ARGV[0]: $!\n"; -undef($/); -my $liloprefix = ; -close(L); -length($liloprefix) >= 512 or die "LILO prefix too short\n"; -shift(@ARGV); -my $totalsize = 0; -for my $file (@ARGV) { - next if (! -f $file or ! -r $file); - $totalsize += -s $file; -} -my $pad = 0; -if ($totalsize < MINSIZE) { - $pad = MINSIZE - $totalsize; - $totalsize = MINSIZE; -} -print STDERR "LILO payload is $totalsize bytes\n"; -$totalsize += 16; -$totalsize >>= 4; -substr($liloprefix, SYSSIZE_LOC, 2) = pack('v', $totalsize); -print $liloprefix; -for my $file (@ARGV) { - next unless open(I, "$file"); - undef($/); - my $data = ; - print $data; - close(I); -} -print "\x0" x $pad; -exit(0); -- cgit v1.2.3-55-g7522