now stage1 supports both LBA and CHS.

This commit is contained in:
okuji 1999-10-12 07:36:23 +00:00
parent bd47df86dc
commit 3764236446
14 changed files with 761 additions and 691 deletions

View file

@ -1,3 +1,82 @@
1999-10-10 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* stage2/asm.S [!STAGE1_5] (start): New label to force ld quiet.
[!STAGE1_5] (_start): Likewise.
* stage2/builtins.c (install_func): Rewritten heavily almost
from scratch. As the blocklist was moved to the first sector of
Stage 2, always write sectors of Stage 2 to the disk.
* stage1/stage1.h (STAGE1_STAGE2_SECTOR): 0x40 -> 0x41.
(STAGE1_STAGE2_ADDRESS): 0x44 -> 0x45.
(STAGE1_STAGE2_SEGMENT): 0x46 -> 0x47.
(STAGE1_BOOT_DRIVE): 0x3f -> 0x40.
1999-10-09 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
Stage1 supports both the CHS mode and the LBA mode.
* stage1/Makefile.am (nodist_pkgdata_DATA): Removed stage1_lba.
(BUILT_SOURCES): Deleted.
(CLEANFILES): Likewise.
(noinst_PROGRAMS): Removed stage1_lba.exec.
(stage1_exec_SOURCES): Removed stage2_size.h.
(stage2_size.h): Deleted.
(stage1_lba_exec_SOURCES): Likewise.
* stage1/stage1.S: Rewritten from scratch.
* stage1/stage1_lba.S: Deleted.
* stage1/stage1.h (COMPAT_VERSION_MAJOR): Set to 3.
(COMPAT_VERSION_MINOR): Set to 0.
(STAGE1_VER_MAJ_OFFS): Set to 0x3e.
(STAGE1_FIRSTLIST): Deleted.
(STAGE1_INSTALLSEG): Likewise.
(STAGE1_INSTALLADDR): Likewise.
(STAGE1_MINPARAMSIZE): Likewise.
(STAGE1_LISTSIZE): Likewise.
(STAGE1_ID_OFFSET): Likewise.
(STAGE1_ID_CHS): Likewise.
(STAGE1_ID_LBA): Likewise.
(STAGE1_STAGE2_SECTOR): New macro.
(STAGE1_STAGE2_ADDRESS): Likewise.
(STAGE1_STAGE2_SEGMENT): Likewise.
(STAGE1_BOOT_DRIVE): Likewise.
* stage2/start.S: New file.
* stage2/Makefile.am (noinst_DATA): New variable.
(CLEANFILES): Set to "$(nodist_pkgdata_DATA) $(noinst_DATA)
$(BUILT_SOURCES)".
(noinst_PROGRAMS): Removed stage2.exec, and added start.exec and
pre_stage2.exec.
(STAGE2_LINK): Deleted.
(PRE_STAGE2_LINK): New variable.
(START_LINK): Likewise.
(stage2_exec_SOURCES): Deleted.
(stage2_exec_CFLAGS): Likewise.
(stage2_exec_LDFLAGS): Likewise.
[NETBOOT_SUPPORT] (stage2_exec_LDADD): Likewise.
(pre_stage2_exec_SOURCES): New variable.
(pre_stage2_exec_CFLAGS): Likewise.
(pre_stage2_exec_LDFLAGS): Likewise.
[NETBOOT_SUPPORT] (pre_stage2_exec_LDADD): Likewise.
(BUILT_SOURCES): Likewise.
(start_exec_SOURCES): Likewise.
(start_exec_CFLAGS): Likewise.
(start_exec_LDFLAGS): Likewise.
(start_exec_DEPENDENCIES): Likewise.
(stage2_size.h): New rule.
(stage2): Likewise.
(e2fs_stage1_5_exec_SOURCES): Added start.S.
(fat_stage1_5_exec_SOURCES): Likewise.
(ffs_stage1_5_exec_SOURCES): Likewise.
(minix_stage1_5_exec_SOURCES): Likewise.
* stage2/asm.S (start): Renamed to ...
(main): ... this.
[STAGE1_5] (main): Jump to (codestart - EXT_C(main) + 0x2200)
instead of (codestart - EXT_C(start) + 0x2000).
[!STAGE1_5] (main): Jump to (codestart - EXT_C(main) + 0x8200)
instead of (codestart - EXT_C(start) + 0x8000).
[STAGE1_5] (chain_stage2): Use main instead of start.
* stage2/shared.h (BOOTSEC_LISTSIZE): New macro.
* stage2/stage1_5.c: Change the second argument for chain_stage2
to 0x8200.
1999-10-08 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp> 1999-10-08 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* configure.in (--with-binutils): New option to specify a * configure.in (--with-binutils): New option to specify a

View file

@ -1,5 +1,4 @@
# Stage 1 is built after Stage 2, so that the size of Stage 2 is # Do not change this order if you don't know what you are doing.
# encoded into Stage 1.
SUBDIRS = netboot stage2 stage1 lib grub docs debian SUBDIRS = netboot stage2 stage1 lib grub docs debian
EXTRA_DIST = BUGS EXTRA_DIST = BUGS

View file

@ -81,8 +81,7 @@ host_cpu = @host_cpu@
host_vendor = @host_vendor@ host_vendor = @host_vendor@
install_sh = @install_sh@ install_sh = @install_sh@
# Stage 1 is built after Stage 2, so that the size of Stage 2 is # Do not change this order if you don't know what you are doing.
# encoded into Stage 1.
SUBDIRS = netboot stage2 stage1 lib grub docs debian SUBDIRS = netboot stage2 stage1 lib grub docs debian

View file

@ -1,21 +1,12 @@
pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
nodist_pkgdata_DATA = stage1 stage1_lba nodist_pkgdata_DATA = stage1
BUILT_SOURCES = stage2_size.h
CLEANFILES = $(pkgdata_DATA) $(BUILT_SOURCES)
# We can't use builtins or standard includes. # We can't use builtins or standard includes.
AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
noinst_PROGRAMS = stage1.exec stage1_lba.exec noinst_PROGRAMS = stage1.exec
stage1_exec_SOURCES = stage1.S stage1.h stage2_size.h stage1_exec_SOURCES = stage1.S stage1.h
stage1_lba_exec_SOURCES = stage1_lba.S stage1.h stage2_size.h
stage2_size.h: ../stage2/stage2
-rm -f stage2_size.h
set dummy `ls -l ../stage2/stage2`; \
echo "#define STAGE2_SIZE $$6" > stage2_size.h
%: %.exec %: %.exec
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) -O binary $< $@

View file

@ -81,18 +81,14 @@ install_sh = @install_sh@
pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
nodist_pkgdata_DATA = stage1 stage1_lba nodist_pkgdata_DATA = stage1
BUILT_SOURCES = stage2_size.h
CLEANFILES = $(pkgdata_DATA) $(BUILT_SOURCES)
# We can't use builtins or standard includes. # We can't use builtins or standard includes.
AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00
noinst_PROGRAMS = stage1.exec stage1_lba.exec noinst_PROGRAMS = stage1.exec
stage1_exec_SOURCES = stage1.S stage1.h stage2_size.h stage1_exec_SOURCES = stage1.S stage1.h
stage1_lba_exec_SOURCES = stage1_lba.S stage1.h stage2_size.h
subdir = stage1 subdir = stage1
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h CONFIG_HEADER = ../config.h
@ -108,16 +104,11 @@ stage1_exec_OBJECTS = $(am_stage1_exec_OBJECTS)
stage1_exec_LDADD = $(LDADD) stage1_exec_LDADD = $(LDADD)
stage1_exec_DEPENDENCIES = stage1_exec_DEPENDENCIES =
stage1_exec_LDFLAGS = stage1_exec_LDFLAGS =
am_stage1_lba_exec_OBJECTS = stage1_lba.o
stage1_lba_exec_OBJECTS = $(am_stage1_lba_exec_OBJECTS)
stage1_lba_exec_LDADD = $(LDADD)
stage1_lba_exec_DEPENDENCIES =
stage1_lba_exec_LDFLAGS =
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CFLAGS = @CFLAGS@ CFLAGS = @CFLAGS@
CCLD = $(CC) CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(stage1_exec_SOURCES) $(stage1_lba_exec_SOURCES) DIST_SOURCES = $(stage1_exec_SOURCES)
DATA = $(nodist_pkgdata_DATA) DATA = $(nodist_pkgdata_DATA)
DIST_COMMON = Makefile.am Makefile.in DIST_COMMON = Makefile.am Makefile.in
@ -126,9 +117,9 @@ DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
GZIP_ENV = --best GZIP_ENV = --best
DEP_FILES = .deps/stage1.P .deps/stage1_lba.P DEP_FILES = .deps/stage1.P
SOURCES = $(stage1_exec_SOURCES) $(stage1_lba_exec_SOURCES) SOURCES = $(stage1_exec_SOURCES)
OBJECTS = $(am_stage1_exec_OBJECTS) $(am_stage1_lba_exec_OBJECTS) OBJECTS = $(am_stage1_exec_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
@ -163,10 +154,6 @@ maintainer-clean-compile:
stage1.exec: $(stage1_exec_OBJECTS) $(stage1_exec_DEPENDENCIES) stage1.exec: $(stage1_exec_OBJECTS) $(stage1_exec_DEPENDENCIES)
@rm -f stage1.exec @rm -f stage1.exec
$(LINK) $(stage1_exec_LDFLAGS) $(stage1_exec_OBJECTS) $(stage1_exec_LDADD) $(LIBS) $(LINK) $(stage1_exec_LDFLAGS) $(stage1_exec_OBJECTS) $(stage1_exec_LDADD) $(LIBS)
stage1_lba.exec: $(stage1_lba_exec_OBJECTS) $(stage1_lba_exec_DEPENDENCIES)
@rm -f stage1_lba.exec
$(LINK) $(stage1_lba_exec_LDFLAGS) $(stage1_lba_exec_OBJECTS) $(stage1_lba_exec_LDADD) $(LIBS)
.S.o: .S.o:
$(COMPILE) -c $< $(COMPILE) -c $<
@ -282,14 +269,12 @@ installdirs:
mostlyclean-generic: mostlyclean-generic:
clean-generic: clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic: distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES) -rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]* -rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic: maintainer-clean-generic:
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \
mostlyclean-tags mostlyclean-depend mostlyclean-generic mostlyclean-tags mostlyclean-depend mostlyclean-generic
@ -328,11 +313,6 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean maintainer-clean-generic clean mostlyclean distclean maintainer-clean
stage2_size.h: ../stage2/stage2
-rm -f stage2_size.h
set dummy `ls -l ../stage2/stage2`; \
echo "#define STAGE2_SIZE $$6" > stage2_size.h
%: %.exec %: %.exec
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) -O binary $< $@

View file

@ -19,7 +19,6 @@
*/ */
#include <stage1.h> #include <stage1.h>
#include <stage2_size.h>
/* /*
* defines for the code go here * defines for the code go here
@ -51,7 +50,7 @@
* parameter block. * parameter block.
*/ */
jmp after_BPB jmp after_BPB
nop /* do I care about this ??? */ nop /* do I care about this ??? */
/* /*
@ -63,6 +62,9 @@
. = _start + 4 . = _start + 4
/* scratch space */ /* scratch space */
mode:
.byte 0
disk_address_packet:
sectors: sectors:
.long 0 .long 0
heads: heads:
@ -83,8 +85,17 @@ cylinder_start:
* End of BIOS parameter block. * End of BIOS parameter block.
*/ */
stage1_id: stage1_version:
.byte STAGE1_ID_CHS .byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR
boot_drive:
.byte 0xff /* the disk to load stage2 from */
/* 0xff means use the boot drive */
stage2_sector:
.long 1
stage2_address:
.word 0x8000
stage2_segment:
.word 0x800
after_BPB: after_BPB:
@ -104,7 +115,7 @@ after_BPB:
/* /*
* Check if we have a forced disk reference here * Check if we have a forced disk reference here
*/ */
movb ABS(firstlist), %al movb ABS(boot_drive), %al
cmpb $0xff, %al cmpb $0xff, %al
je 1f je 1f
movb %al, %dl movb %al, %dl
@ -112,6 +123,82 @@ after_BPB:
/* save drive reference first thing! */ /* save drive reference first thing! */
pushw %dx pushw %dx
/* print a notification message on the screen */
MSG(notification_string)
/* do not probe LBA if the drive is a floppy */
testb $STAGE1_BIOS_HD_FLAG, %dl
jz chs_mode
/* check if LBA is supported */
movb $0x41, %ah
movw $0x55aa, %bx
int $0x13
/* use CHS if fails */
jc chs_mode
cmpw $0xaa55, %bx
jne chs_mode
/* get the geometry (limited to 2TB!) */
movb $0x48, %ah
movw $STAGE1_DRP_ADDR, %si
movw $STAGE1_DRP_SIZE, (%si)
int $0x13
/* use CHS if fails */
jc chs_mode
lba_mode:
/* save the total number of sectors */
movl 0x10(%si), %ecx
/* set %si to the disk address packet */
movw $ABS(disk_address_packet), %si
/* set the mode to non-zero */
movb $1, -1(%si)
movl ABS(stage2_sector), %ebx
cmpl %ecx, %ebx
jge geometry_error
/* the size and the reserved byte */
movw $0x0010, (%si)
/* the blocks */
movw $1, 2(%si)
/* the absolute address (low 32 bits) */
movl %ebx, 8(%si)
/* the segment of buffer address */
movw $STAGE1_BUFFERSEG, 6(%si)
xorl %eax, %eax
movw %ax, 4(%si)
movl %eax, 12(%si)
/*
* BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory
* Call with %ah = 0x42
* %dl = drive number
* %ds:%si = segment:offset of disk address packet
* Return:
* %al = 0x0 on success; err code on failure
*/
movb $0x42, %ah
int $0x13
/* should use CHS instead? */
jc read_error
movw $STAGE1_BUFFERSEG, %bx
jmp copy_buffer
chs_mode:
/* /*
* Determine the hard disk geometry from the BIOS! * Determine the hard disk geometry from the BIOS!
* We do this first, so that LS-120 IDE floppies work correctly. * We do this first, so that LS-120 IDE floppies work correctly.
@ -130,9 +217,12 @@ after_BPB:
jmp hd_probe_error jmp hd_probe_error
final_init: final_init:
/* set %si to sectors */
movw $ABS(sectors), %si movw $ABS(sectors), %si
/* set the mode to zero */
movb $0, -1(%si)
/* save number of heads */ /* save number of heads */
xorl %eax, %eax xorl %eax, %eax
movb %dh, %al movb %dh, %al
@ -156,22 +246,9 @@ final_init:
/* save number of sectors */ /* save number of sectors */
movl %eax, (%si) movl %eax, (%si)
/* this sets up for the first run through "bootloop" */
movw $ABS(firstlist - STAGE1_LISTSIZE), %di
/* this is the loop for reading the secondary boot-loader in */
bootloop:
/* check the number of sectors to read */
cmpw $0, 4(%di)
/* if zero, go to the start function */
je bootit
setup_sectors: setup_sectors:
/* load logical sector start (bottom half) */ /* load logical sector start (bottom half) */
movl (%di), %eax movl ABS(stage2_sector), %eax
/* zero %edx */ /* zero %edx */
xorl %edx, %edx xorl %edx, %edx
@ -195,29 +272,6 @@ setup_sectors:
cmpw 8(%si), %ax cmpw 8(%si), %ax
jge geometry_error jge geometry_error
/* determine the maximum sector length of this read */
movw (%si), %ax /* get number of sectors per track/head */
/* subtract sector start */
subb 10(%si), %al
/* how many do we really want to read? */
cmpw %ax, 4(%di) /* compare against total number of sectors */
/* which is greater? */
jg more_sectors
/* if less than, set to total */
movw 4(%di), %ax
more_sectors:
/* subtract from total */
subw %ax, 4(%di)
/* add into logical sector start */
addl %eax, (%di)
/* /*
* This is the loop for taking care of BIOS geometry translation (ugh!) * This is the loop for taking care of BIOS geometry translation (ugh!)
*/ */
@ -235,13 +289,10 @@ more_sectors:
/* restore %dx */ /* restore %dx */
popw %dx popw %dx
pushw %dx
/* head number */ /* head number */
movb 11(%si), %dh movb 11(%si), %dh
pushw %ax /* save %ax from destruction! */
/* /*
* BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory * BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
* Call with %ah = 0x2 * Call with %ah = 0x2
@ -259,59 +310,40 @@ more_sectors:
movw %bx, %es /* load %es segment with disk buffer */ movw %bx, %es /* load %es segment with disk buffer */
xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */
movb $0x2, %ah /* function 2 */ movw $0x0201, %ax /* function 2 */
int $0x13 int $0x13
jc read_error jc read_error
/* save source segment */ movw %es, %bx
movw %es, %dx
/* load addresses for copy from disk buffer to destination */ copy_buffer:
movw 6(%di), %es /* load destination segment */ movw ABS(stage2_segment), %es
/* restore %ax */ /*
popw %ax * We need to save %cx and %si because the startup code in
* stage2 uses them without initializing them.
/* determine the next possible destination address (presuming */
512 byte sectors!) */ pushw %cx
shlw $5, %ax /* shift %ax five bits to the left */
addw %ax, 6(%di) /* add the corrected value to the destination
address for next time */
/* get the copy length */
shlw $4, %ax
movw %ax, %cx
/* save addressing regs */
pushw %ds pushw %ds
pushw %si pushw %si
pushw %di
xorw %di, %di /* zero offset of destination addresses */ movw $0x200, %cx
xorw %si, %si /* zero offset of source addresses */ movw %bx, %ds
movw %dx, %ds /* restore the source segment */ xorw %si, %si
xorw %di, %di
cld /* sets the copy direction to forward */ cld
/* perform copy */ rep
rep /* sets a repeat */ movsb
movsb /* this runs the actual copy */
/* restore addressing regs */
popw %di
popw %si popw %si
popw %ds popw %ds
popw %cx
/* check if finished with this dataset */ /* boot stage2 */
cmpw $0, 4(%di) jmp *(stage2_address)
jne setup_sectors
/* update position to load from */
subw $STAGE1_LISTSIZE, %di
/* jump to bootloop */
jmp bootloop
/* END OF MAIN LOOP */ /* END OF MAIN LOOP */
@ -341,6 +373,7 @@ general_error:
/* go here when you need to stop the machine hard after an error condition */ /* go here when you need to stop the machine hard after an error condition */
stop: jmp stop stop: jmp stop
notification_string: .string "stage1"
geometry_error_string: .string "Geom" geometry_error_string: .string "Geom"
hd_probe_error_string: .string "Hard Disk" hd_probe_error_string: .string "Hard Disk"
read_error_string: .string "Read" read_error_string: .string "Read"
@ -368,70 +401,6 @@ message:
cmpb $0, %al cmpb $0, %al
jne 1b /* if not end of string, jmp to display */ jne 1b /* if not end of string, jmp to display */
ret ret
lastlist:
/*
* This area is an empty space between the main body of code below which
* grows up (fixed after compilation, but between releases it may change
* in size easily), and the lists of sectors to read, which grows down
* from a fixed top location.
*/
/*
* This data area is for keeping general parameters.
*/
. = _start + STAGE1_PARTSTART - STAGE1_MINPARAMSIZE - STAGE1_LISTSIZE
/* this next data area before the partition area is specifically
sized, you should update "STAGE1_MINPARAMSIZ" to reflect any
additions or deletions to this area. */
.word 0
.word 0
/* fill the first data listing with the default */
#ifdef FFS_STAGE1_5
blocklist_default_start:
.long 2 /* this is the sector start parameter, in logical
sectors from the start of the disk, sector 0 */
blocklist_default_len:
.word 14 /* this is the number of sectors to read */
blocklist_default_seg:
.word 0x0200 /* this is the segment of the starting address
to load the data into */
#else
blocklist_default_start:
.long 1 /* this is the sector start parameter, in logical
sectors from the start of the disk, sector 0 */
blocklist_default_len:
/* this is the number of sectors to read */
.word (STAGE2_SIZE + 511) >> 9
blocklist_default_seg:
.word 0x0800 /* this is the segment of the starting address
to load the data into */
#endif
firstlist: /* this label has to be after the list data!!! */
.byte 0xff /* the disk to load stage2 from */
/* 0xff means use the boot drive */
/*
* Jump here when all data loading is done. This
* goes to the second stage bootloader.
*/
bootit:
popw %dx /* this makes sure %dl is our "boot" drive */
ljmp $0, $0x8000 /* FIXME: make 0x2000 for stage1_5 */
/*
* This is the compatibility version number.
* See stage1.h for COMPAT_VERSION_* definitions used
* in stage2 and stage1_5 modules.
*
* DO NOT MOVE THIS!!!
*/
.byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR
/* /*
* This is where an MBR would go if on a hard disk. The code * This is where an MBR would go if on a hard disk. The code

View file

@ -22,8 +22,8 @@
/* Define the version numbers here, so that Stage 1 can know them. */ /* Define the version numbers here, so that Stage 1 can know them. */
#define COMPAT_VERSION_MAJOR 2 #define COMPAT_VERSION_MAJOR 3
#define COMPAT_VERSION_MINOR 2 #define COMPAT_VERSION_MINOR 0
#define COMPAT_VERSION ((COMPAT_VERSION_MINOR << 8) \ #define COMPAT_VERSION ((COMPAT_VERSION_MINOR << 8) \
| COMPAT_VERSION_MAJOR) | COMPAT_VERSION_MAJOR)
@ -33,17 +33,20 @@
/* The offset of the end of BPB (BIOS Parameter Block). */ /* The offset of the end of BPB (BIOS Parameter Block). */
#define STAGE1_BPBEND 0x3e #define STAGE1_BPBEND 0x3e
/* The offset of FIRSTLIST. */ /* The offset of STAGE2_SECTOR. */
#define STAGE1_FIRSTLIST 0x1b5 #define STAGE1_STAGE2_SECTOR 0x41
/* The offset of STAGE2_ADDRESS. */
#define STAGE1_STAGE2_ADDRESS 0x45
/* The offset of STAGE2_SEGMENT. */
#define STAGE1_STAGE2_SEGMENT 0x47
/* The offset of the major version. */ /* The offset of the major version. */
#define STAGE1_VER_MAJ_OFFS 0x1bc #define STAGE1_VER_MAJ_OFFS 0x3e
/* The offset of the install segment. */ /* The offset of BOOT_DRIVE. */
#define STAGE1_INSTALLSEG 0x1ba #define STAGE1_BOOT_DRIVE 0x40
/* The offset of the install address. */
#define STAGE1_INSTALLADDR 0x1b8
/* The offset of the start of the partition table. */ /* The offset of the start of the partition table. */
#define STAGE1_PARTSTART 0x1be #define STAGE1_PARTSTART 0x1be
@ -51,12 +54,6 @@
/* The offset of the end of the partition table. */ /* The offset of the end of the partition table. */
#define STAGE1_PARTEND 0x1fe #define STAGE1_PARTEND 0x1fe
/* The size of extra data parameters. */
#define STAGE1_MINPARAMSIZE 13
/* The size of sector list. */
#define STAGE1_LISTSIZE 8
/* The stack segment. */ /* The stack segment. */
#define STAGE1_STACKSEG 0x2000 #define STAGE1_STACKSEG 0x2000
@ -74,15 +71,4 @@
floppy. */ floppy. */
#define STAGE1_BIOS_HD_FLAG 0x80 #define STAGE1_BIOS_HD_FLAG 0x80
/* Stage 1 identifiers */
/* The offset of the id. */
#define STAGE1_ID_OFFSET STAGE1_BPBEND
/* The id for the ``normal'' stage1. */
#define STAGE1_ID_CHS 0x10
/* The id for the LBA version of stage1. */
#define STAGE1_ID_LBA 0x20
#endif /* ! STAGE1_HEADER */ #endif /* ! STAGE1_HEADER */

View file

@ -23,44 +23,62 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \
pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
minix_stage1_5 minix_stage1_5
CLEANFILES = $(pkgdata_DATA) noinst_DATA = pre_stage2 start
noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \ noinst_PROGRAMS = pre_stage2.exec start.exec \
e2fs_stage1_5.exec fat_stage1_5.exec \
ffs_stage1_5.exec minix_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec
MOSTLYCLEANFILES = $(noinst_PROGRAMS) MOSTLYCLEANFILES = $(noinst_PROGRAMS)
STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
# asm.S absolutely needs to come first!
# For stage2 target. # For stage2 target.
stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \ pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \
char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \ char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \
fsys_fat.c fsys_ffs.c fsys_minix.c smp-imps.c stage2.c fsys_fat.c fsys_ffs.c fsys_minix.c smp-imps.c stage2.c
stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
stage2_exec_LDFLAGS = $(STAGE2_LINK) pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
if NETBOOT_SUPPORT if NETBOOT_SUPPORT
stage2_exec_LDADD = ../netboot/libdrivers.a pre_stage2_exec_LDADD = ../netboot/libdrivers.a
endif endif
BUILT_SOURCES = stage2_size.h
CLEANFILES = $(nodist_pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES)
stage2_size.h: pre_stage2
-rm -f stage2_size.h
set dummy `ls -l ../stage2/stage2`; \
echo "#define STAGE2_SIZE $$6" > stage2_size.h
start_exec_SOURCES = start.S
start_exec_CFLAGS = $(STAGE2_COMPILE)
start_exec_LDFLAGS = $(START_LINK)
start_exec_DEPENDENCIES = stage2_size.h
stage2: pre_stage2 start
-rm -f stage2
cat start pre_stage2 > stage2
# For e2fs_stage1_5 target. # For e2fs_stage1_5 target.
e2fs_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_ext2fs.c bios.c stage1_5.c fsys_ext2fs.c bios.c
e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
-DNO_BLOCK_FILES=1 -DNO_BLOCK_FILES=1
e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For fat_stage1_5 target. # For fat_stage1_5 target.
fat_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_fat.c bios.c stage1_5.c fsys_fat.c bios.c
fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1
fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For ffs_stage1_5 target. # For ffs_stage1_5 target.
ffs_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_ffs.c bios.c stage1_5.c fsys_ffs.c bios.c
ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \ ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
@ -68,7 +86,7 @@ ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For minix_stage1_5 target. # For minix_stage1_5 target.
minix_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_minix.c bios.c stage1_5.c fsys_minix.c bios.c
minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
-DNO_BLOCK_FILES=1 -DNO_BLOCK_FILES=1

View file

@ -110,31 +110,40 @@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor)
nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ nodist_pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
minix_stage1_5 minix_stage1_5
CLEANFILES = $(pkgdata_DATA) noinst_DATA = pre_stage2 start
noinst_PROGRAMS = stage2.exec e2fs_stage1_5.exec fat_stage1_5.exec \ CLEANFILES = $(BUILT_SOURCES)
noinst_PROGRAMS = pre_stage2.exec start.exec \
e2fs_stage1_5.exec fat_stage1_5.exec \
ffs_stage1_5.exec minix_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec
MOSTLYCLEANFILES = $(noinst_PROGRAMS) MOSTLYCLEANFILES = $(noinst_PROGRAMS)
STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200
START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000
STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc
STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
# asm.S absolutely needs to come first!
# For stage2 target. # For stage2 target.
stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \ pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \
char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \ char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \
fsys_fat.c fsys_ffs.c fsys_minix.c smp-imps.c stage2.c fsys_fat.c fsys_ffs.c fsys_minix.c smp-imps.c stage2.c
stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
stage2_exec_LDFLAGS = $(STAGE2_LINK) pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
@NETBOOT_SUPPORT_TRUE@stage2_exec_LDADD = @NETBOOT_SUPPORT_TRUE@../netboot/libdrivers.a @NETBOOT_SUPPORT_TRUE@pre_stage2_exec_LDADD = @NETBOOT_SUPPORT_TRUE@../netboot/libdrivers.a
BUILT_SOURCES = stage2_size.h
start_exec_SOURCES = start.S
start_exec_CFLAGS = $(STAGE2_COMPILE)
start_exec_LDFLAGS = $(START_LINK)
start_exec_DEPENDENCIES = stage2_size.h
# For e2fs_stage1_5 target. # For e2fs_stage1_5 target.
e2fs_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ e2fs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_ext2fs.c bios.c stage1_5.c fsys_ext2fs.c bios.c
e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \ e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
@ -143,14 +152,14 @@ e2fs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_EXT2FS=1 \
e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) e2fs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For fat_stage1_5 target. # For fat_stage1_5 target.
fat_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ fat_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_fat.c bios.c stage1_5.c fsys_fat.c bios.c
fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1 fat_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FAT=1
fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) fat_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For ffs_stage1_5 target. # For ffs_stage1_5 target.
ffs_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ ffs_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_ffs.c bios.c stage1_5.c fsys_ffs.c bios.c
@ -160,7 +169,7 @@ ffs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_FFS=1 \
ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) ffs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK)
# For minix_stage1_5 target. # For minix_stage1_5 target.
minix_stage1_5_exec_SOURCES = asm.S common.c char_io.c disk_io.c \ minix_stage1_5_exec_SOURCES = start.S asm.S common.c char_io.c disk_io.c \
stage1_5.c fsys_minix.c bios.c stage1_5.c fsys_minix.c bios.c
minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \ minix_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_MINIX=1 \
@ -189,43 +198,52 @@ libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS)
AR = ar AR = ar
PROGRAMS = $(noinst_PROGRAMS) PROGRAMS = $(noinst_PROGRAMS)
am_e2fs_stage1_5_exec_OBJECTS = e2fs_stage1_5_exec-asm.o \ am_e2fs_stage1_5_exec_OBJECTS = e2fs_stage1_5_exec-start.o \
e2fs_stage1_5_exec-common.o e2fs_stage1_5_exec-char_io.o \ e2fs_stage1_5_exec-asm.o e2fs_stage1_5_exec-common.o \
e2fs_stage1_5_exec-disk_io.o e2fs_stage1_5_exec-stage1_5.o \ e2fs_stage1_5_exec-char_io.o e2fs_stage1_5_exec-disk_io.o \
e2fs_stage1_5_exec-fsys_ext2fs.o e2fs_stage1_5_exec-bios.o e2fs_stage1_5_exec-stage1_5.o e2fs_stage1_5_exec-fsys_ext2fs.o \
e2fs_stage1_5_exec-bios.o
e2fs_stage1_5_exec_OBJECTS = $(am_e2fs_stage1_5_exec_OBJECTS) e2fs_stage1_5_exec_OBJECTS = $(am_e2fs_stage1_5_exec_OBJECTS)
e2fs_stage1_5_exec_LDADD = $(LDADD) e2fs_stage1_5_exec_LDADD = $(LDADD)
e2fs_stage1_5_exec_DEPENDENCIES = e2fs_stage1_5_exec_DEPENDENCIES =
am_fat_stage1_5_exec_OBJECTS = fat_stage1_5_exec-asm.o \ am_fat_stage1_5_exec_OBJECTS = fat_stage1_5_exec-start.o \
fat_stage1_5_exec-common.o fat_stage1_5_exec-char_io.o \ fat_stage1_5_exec-asm.o fat_stage1_5_exec-common.o \
fat_stage1_5_exec-disk_io.o fat_stage1_5_exec-stage1_5.o \ fat_stage1_5_exec-char_io.o fat_stage1_5_exec-disk_io.o \
fat_stage1_5_exec-fsys_fat.o fat_stage1_5_exec-bios.o fat_stage1_5_exec-stage1_5.o fat_stage1_5_exec-fsys_fat.o \
fat_stage1_5_exec-bios.o
fat_stage1_5_exec_OBJECTS = $(am_fat_stage1_5_exec_OBJECTS) fat_stage1_5_exec_OBJECTS = $(am_fat_stage1_5_exec_OBJECTS)
fat_stage1_5_exec_LDADD = $(LDADD) fat_stage1_5_exec_LDADD = $(LDADD)
fat_stage1_5_exec_DEPENDENCIES = fat_stage1_5_exec_DEPENDENCIES =
am_ffs_stage1_5_exec_OBJECTS = ffs_stage1_5_exec-asm.o \ am_ffs_stage1_5_exec_OBJECTS = ffs_stage1_5_exec-start.o \
ffs_stage1_5_exec-common.o ffs_stage1_5_exec-char_io.o \ ffs_stage1_5_exec-asm.o ffs_stage1_5_exec-common.o \
ffs_stage1_5_exec-disk_io.o ffs_stage1_5_exec-stage1_5.o \ ffs_stage1_5_exec-char_io.o ffs_stage1_5_exec-disk_io.o \
ffs_stage1_5_exec-fsys_ffs.o ffs_stage1_5_exec-bios.o ffs_stage1_5_exec-stage1_5.o ffs_stage1_5_exec-fsys_ffs.o \
ffs_stage1_5_exec-bios.o
ffs_stage1_5_exec_OBJECTS = $(am_ffs_stage1_5_exec_OBJECTS) ffs_stage1_5_exec_OBJECTS = $(am_ffs_stage1_5_exec_OBJECTS)
ffs_stage1_5_exec_LDADD = $(LDADD) ffs_stage1_5_exec_LDADD = $(LDADD)
ffs_stage1_5_exec_DEPENDENCIES = ffs_stage1_5_exec_DEPENDENCIES =
am_minix_stage1_5_exec_OBJECTS = minix_stage1_5_exec-asm.o \ am_minix_stage1_5_exec_OBJECTS = minix_stage1_5_exec-start.o \
minix_stage1_5_exec-common.o minix_stage1_5_exec-char_io.o \ minix_stage1_5_exec-asm.o minix_stage1_5_exec-common.o \
minix_stage1_5_exec-disk_io.o minix_stage1_5_exec-stage1_5.o \ minix_stage1_5_exec-char_io.o minix_stage1_5_exec-disk_io.o \
minix_stage1_5_exec-fsys_minix.o minix_stage1_5_exec-bios.o minix_stage1_5_exec-stage1_5.o minix_stage1_5_exec-fsys_minix.o \
minix_stage1_5_exec-bios.o
minix_stage1_5_exec_OBJECTS = $(am_minix_stage1_5_exec_OBJECTS) minix_stage1_5_exec_OBJECTS = $(am_minix_stage1_5_exec_OBJECTS)
minix_stage1_5_exec_LDADD = $(LDADD) minix_stage1_5_exec_LDADD = $(LDADD)
minix_stage1_5_exec_DEPENDENCIES = minix_stage1_5_exec_DEPENDENCIES =
am_stage2_exec_OBJECTS = stage2_exec-asm.o stage2_exec-bios.o \ am_pre_stage2_exec_OBJECTS = pre_stage2_exec-asm.o \
stage2_exec-boot.o stage2_exec-builtins.o stage2_exec-common.o \ pre_stage2_exec-bios.o pre_stage2_exec-boot.o \
stage2_exec-char_io.o stage2_exec-cmdline.o stage2_exec-disk_io.o \ pre_stage2_exec-builtins.o pre_stage2_exec-common.o \
stage2_exec-gunzip.o stage2_exec-fsys_ext2fs.o stage2_exec-fsys_fat.o \ pre_stage2_exec-char_io.o pre_stage2_exec-cmdline.o \
stage2_exec-fsys_ffs.o stage2_exec-fsys_minix.o stage2_exec-smp-imps.o \ pre_stage2_exec-disk_io.o pre_stage2_exec-gunzip.o \
stage2_exec-stage2.o pre_stage2_exec-fsys_ext2fs.o pre_stage2_exec-fsys_fat.o \
stage2_exec_OBJECTS = $(am_stage2_exec_OBJECTS) pre_stage2_exec-fsys_ffs.o pre_stage2_exec-fsys_minix.o \
@NETBOOT_SUPPORT_TRUE@stage2_exec_DEPENDENCIES = \ pre_stage2_exec-smp-imps.o pre_stage2_exec-stage2.o
pre_stage2_exec_OBJECTS = $(am_pre_stage2_exec_OBJECTS)
@NETBOOT_SUPPORT_TRUE@pre_stage2_exec_DEPENDENCIES = \
@NETBOOT_SUPPORT_TRUE@../netboot/libdrivers.a @NETBOOT_SUPPORT_TRUE@../netboot/libdrivers.a
am_start_exec_OBJECTS = start_exec-start.o
start_exec_OBJECTS = $(am_start_exec_OBJECTS)
start_exec_LDADD = $(LDADD)
SCRIPTS = $(noinst_SCRIPTS) SCRIPTS = $(noinst_SCRIPTS)
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
@ -234,12 +252,14 @@ CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
DIST_SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) \ DIST_SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) \
$(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) \ $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) \
$(minix_stage1_5_exec_SOURCES) $(stage2_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(pre_stage2_exec_SOURCES) \
DATA = $(nodist_pkgdata_DATA) $(start_exec_SOURCES)
DATA = $(nodist_pkgdata_DATA) $(noinst_DATA)
HEADERS = $(noinst_HEADERS) HEADERS = $(noinst_HEADERS)
DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in compile DIST_COMMON = $(noinst_DATA) $(noinst_HEADERS) Makefile.am Makefile.in \
compile
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -249,9 +269,9 @@ DEP_FILES = .deps/asm.P .deps/bios.P .deps/boot.P .deps/builtins.P \
.deps/char_io.P .deps/cmdline.P .deps/common.P .deps/disk_io.P \ .deps/char_io.P .deps/cmdline.P .deps/common.P .deps/disk_io.P \
.deps/fsys_ext2fs.P .deps/fsys_fat.P .deps/fsys_ffs.P \ .deps/fsys_ext2fs.P .deps/fsys_fat.P .deps/fsys_ffs.P \
.deps/fsys_minix.P .deps/gunzip.P .deps/smp-imps.P .deps/stage1_5.P \ .deps/fsys_minix.P .deps/gunzip.P .deps/smp-imps.P .deps/stage1_5.P \
.deps/stage2.P .deps/stage2.P .deps/start.P
SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(stage2_exec_SOURCES) SOURCES = $(libgrub_a_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(start_exec_SOURCES)
OBJECTS = $(am_libgrub_a_OBJECTS) $(am_e2fs_stage1_5_exec_OBJECTS) $(am_fat_stage1_5_exec_OBJECTS) $(am_ffs_stage1_5_exec_OBJECTS) $(am_minix_stage1_5_exec_OBJECTS) $(am_stage2_exec_OBJECTS) OBJECTS = $(am_libgrub_a_OBJECTS) $(am_e2fs_stage1_5_exec_OBJECTS) $(am_fat_stage1_5_exec_OBJECTS) $(am_ffs_stage1_5_exec_OBJECTS) $(am_minix_stage1_5_exec_OBJECTS) $(am_pre_stage2_exec_OBJECTS) $(am_start_exec_OBJECTS)
all: all-redirect all: all-redirect
.SUFFIXES: .SUFFIXES:
@ -308,6 +328,8 @@ clean-noinstPROGRAMS:
distclean-noinstPROGRAMS: distclean-noinstPROGRAMS:
maintainer-clean-noinstPROGRAMS: maintainer-clean-noinstPROGRAMS:
e2fs_stage1_5_exec-start.o: start.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-start.o $<
e2fs_stage1_5_exec-asm.o: asm.S e2fs_stage1_5_exec-asm.o: asm.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-asm.o $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(e2fs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o e2fs_stage1_5_exec-asm.o $<
e2fs_stage1_5_exec-common.o: common.c e2fs_stage1_5_exec-common.o: common.c
@ -320,6 +342,8 @@ e2fs_stage1_5_exec-bios.o: bios.c
e2fs_stage1_5.exec: $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_DEPENDENCIES) e2fs_stage1_5.exec: $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_DEPENDENCIES)
@rm -f e2fs_stage1_5.exec @rm -f e2fs_stage1_5.exec
$(LINK) $(e2fs_stage1_5_exec_LDFLAGS) $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_LDADD) $(LIBS) $(LINK) $(e2fs_stage1_5_exec_LDFLAGS) $(e2fs_stage1_5_exec_OBJECTS) $(e2fs_stage1_5_exec_LDADD) $(LIBS)
fat_stage1_5_exec-start.o: start.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-start.o $<
fat_stage1_5_exec-asm.o: asm.S fat_stage1_5_exec-asm.o: asm.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-asm.o $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(fat_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o fat_stage1_5_exec-asm.o $<
fat_stage1_5_exec-common.o: common.c fat_stage1_5_exec-common.o: common.c
@ -332,6 +356,8 @@ fat_stage1_5_exec-bios.o: bios.c
fat_stage1_5.exec: $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_DEPENDENCIES) fat_stage1_5.exec: $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_DEPENDENCIES)
@rm -f fat_stage1_5.exec @rm -f fat_stage1_5.exec
$(LINK) $(fat_stage1_5_exec_LDFLAGS) $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_LDADD) $(LIBS) $(LINK) $(fat_stage1_5_exec_LDFLAGS) $(fat_stage1_5_exec_OBJECTS) $(fat_stage1_5_exec_LDADD) $(LIBS)
ffs_stage1_5_exec-start.o: start.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-start.o $<
ffs_stage1_5_exec-asm.o: asm.S ffs_stage1_5_exec-asm.o: asm.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-asm.o $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ffs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o ffs_stage1_5_exec-asm.o $<
ffs_stage1_5_exec-common.o: common.c ffs_stage1_5_exec-common.o: common.c
@ -344,6 +370,8 @@ ffs_stage1_5_exec-bios.o: bios.c
ffs_stage1_5.exec: $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_DEPENDENCIES) ffs_stage1_5.exec: $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_DEPENDENCIES)
@rm -f ffs_stage1_5.exec @rm -f ffs_stage1_5.exec
$(LINK) $(ffs_stage1_5_exec_LDFLAGS) $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_LDADD) $(LIBS) $(LINK) $(ffs_stage1_5_exec_LDFLAGS) $(ffs_stage1_5_exec_OBJECTS) $(ffs_stage1_5_exec_LDADD) $(LIBS)
minix_stage1_5_exec-start.o: start.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-start.o $<
minix_stage1_5_exec-asm.o: asm.S minix_stage1_5_exec-asm.o: asm.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-asm.o $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(minix_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o minix_stage1_5_exec-asm.o $<
minix_stage1_5_exec-common.o: common.c minix_stage1_5_exec-common.o: common.c
@ -356,26 +384,32 @@ minix_stage1_5_exec-bios.o: bios.c
minix_stage1_5.exec: $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_DEPENDENCIES) minix_stage1_5.exec: $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_DEPENDENCIES)
@rm -f minix_stage1_5.exec @rm -f minix_stage1_5.exec
$(LINK) $(minix_stage1_5_exec_LDFLAGS) $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_LDADD) $(LIBS) $(LINK) $(minix_stage1_5_exec_LDFLAGS) $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_LDADD) $(LIBS)
stage2_exec-asm.o: asm.S pre_stage2_exec-asm.o: asm.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o stage2_exec-asm.o $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-asm.o $<
stage2_exec-bios.o: bios.c pre_stage2_exec-bios.o: bios.c
stage2_exec-boot.o: boot.c pre_stage2_exec-boot.o: boot.c
stage2_exec-builtins.o: builtins.c pre_stage2_exec-builtins.o: builtins.c
stage2_exec-common.o: common.c pre_stage2_exec-common.o: common.c
stage2_exec-char_io.o: char_io.c pre_stage2_exec-char_io.o: char_io.c
stage2_exec-cmdline.o: cmdline.c pre_stage2_exec-cmdline.o: cmdline.c
stage2_exec-disk_io.o: disk_io.c pre_stage2_exec-disk_io.o: disk_io.c
stage2_exec-gunzip.o: gunzip.c pre_stage2_exec-gunzip.o: gunzip.c
stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c pre_stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c
stage2_exec-fsys_fat.o: fsys_fat.c pre_stage2_exec-fsys_fat.o: fsys_fat.c
stage2_exec-fsys_ffs.o: fsys_ffs.c pre_stage2_exec-fsys_ffs.o: fsys_ffs.c
stage2_exec-fsys_minix.o: fsys_minix.c pre_stage2_exec-fsys_minix.o: fsys_minix.c
stage2_exec-smp-imps.o: smp-imps.c pre_stage2_exec-smp-imps.o: smp-imps.c
stage2_exec-stage2.o: stage2.c pre_stage2_exec-stage2.o: stage2.c
stage2.exec: $(stage2_exec_OBJECTS) $(stage2_exec_DEPENDENCIES) pre_stage2.exec: $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_DEPENDENCIES)
@rm -f stage2.exec @rm -f pre_stage2.exec
$(LINK) $(stage2_exec_LDFLAGS) $(stage2_exec_OBJECTS) $(stage2_exec_LDADD) $(LIBS) $(LINK) $(pre_stage2_exec_LDFLAGS) $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_LDADD) $(LIBS)
start_exec-start.o: start.S
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(start_exec_CFLAGS) $(CFLAGS) -c -o start_exec-start.o $<
start.exec: $(start_exec_OBJECTS) $(start_exec_DEPENDENCIES)
@rm -f start.exec
$(LINK) $(start_exec_LDFLAGS) $(start_exec_OBJECTS) $(start_exec_LDADD) $(LIBS)
.S.o: .S.o:
$(COMPILE) -c $< $(COMPILE) -c $<
.c.o: .c.o:
@ -1167,18 +1201,18 @@ minix_stage1_5_exec-bios.lo: bios.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-bios.o: bios.c pre_stage2_exec-bios.o: bios.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-bios.lo: bios.c pre_stage2_exec-bios.lo: bios.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1186,18 +1220,18 @@ stage2_exec-bios.lo: bios.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-boot.o: boot.c pre_stage2_exec-boot.o: boot.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-boot.lo: boot.c pre_stage2_exec-boot.lo: boot.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1205,18 +1239,18 @@ stage2_exec-boot.lo: boot.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-builtins.o: builtins.c pre_stage2_exec-builtins.o: builtins.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-builtins.lo: builtins.c pre_stage2_exec-builtins.lo: builtins.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1224,18 +1258,18 @@ stage2_exec-builtins.lo: builtins.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-common.o: common.c pre_stage2_exec-common.o: common.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-common.lo: common.c pre_stage2_exec-common.lo: common.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1243,18 +1277,18 @@ stage2_exec-common.lo: common.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-char_io.o: char_io.c pre_stage2_exec-char_io.o: char_io.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-char_io.lo: char_io.c pre_stage2_exec-char_io.lo: char_io.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1262,18 +1296,18 @@ stage2_exec-char_io.lo: char_io.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-cmdline.o: cmdline.c pre_stage2_exec-cmdline.o: cmdline.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-cmdline.lo: cmdline.c pre_stage2_exec-cmdline.lo: cmdline.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1281,18 +1315,18 @@ stage2_exec-cmdline.lo: cmdline.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-disk_io.o: disk_io.c pre_stage2_exec-disk_io.o: disk_io.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-disk_io.lo: disk_io.c pre_stage2_exec-disk_io.lo: disk_io.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1300,18 +1334,18 @@ stage2_exec-disk_io.lo: disk_io.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-gunzip.o: gunzip.c pre_stage2_exec-gunzip.o: gunzip.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-gunzip.lo: gunzip.c pre_stage2_exec-gunzip.lo: gunzip.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1319,18 +1353,18 @@ stage2_exec-gunzip.lo: gunzip.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c pre_stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-fsys_ext2fs.lo: fsys_ext2fs.c pre_stage2_exec-fsys_ext2fs.lo: fsys_ext2fs.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1338,18 +1372,18 @@ stage2_exec-fsys_ext2fs.lo: fsys_ext2fs.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-fsys_fat.o: fsys_fat.c pre_stage2_exec-fsys_fat.o: fsys_fat.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-fsys_fat.lo: fsys_fat.c pre_stage2_exec-fsys_fat.lo: fsys_fat.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1357,18 +1391,18 @@ stage2_exec-fsys_fat.lo: fsys_fat.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-fsys_ffs.o: fsys_ffs.c pre_stage2_exec-fsys_ffs.o: fsys_ffs.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-fsys_ffs.lo: fsys_ffs.c pre_stage2_exec-fsys_ffs.lo: fsys_ffs.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1376,18 +1410,18 @@ stage2_exec-fsys_ffs.lo: fsys_ffs.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-fsys_minix.o: fsys_minix.c pre_stage2_exec-fsys_minix.o: fsys_minix.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-fsys_minix.lo: fsys_minix.c pre_stage2_exec-fsys_minix.lo: fsys_minix.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1395,18 +1429,18 @@ stage2_exec-fsys_minix.lo: fsys_minix.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-smp-imps.o: smp-imps.c pre_stage2_exec-smp-imps.o: smp-imps.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-smp-imps.lo: smp-imps.c pre_stage2_exec-smp-imps.lo: smp-imps.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1414,18 +1448,18 @@ stage2_exec-smp-imps.lo: smp-imps.c
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm -f .deps/$(*D)/$(*F).pp rm -f .deps/$(*D)/$(*F).pp
stage2_exec-stage2.o: stage2.c pre_stage2_exec-stage2.o: stage2.c
@echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \ @-cp .deps/$(*D)/$(*F).pp .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
| sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
>> .deps/$(*D)/$(*F).P; \ >> .deps/$(*D)/$(*F).P; \
rm .deps/$(*D)/$(*F).pp rm .deps/$(*D)/$(*F).pp
stage2_exec-stage2.lo: stage2.c pre_stage2_exec-stage2.lo: stage2.c
@echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \ @echo '$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o $@ $<'; \
$(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $< $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -Wp,-MD,.deps/$(*D)/$(*F).pp -c -o $@ $<
@-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
< .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \ < .deps/$(*D)/$(*F).pp > .deps/$(*D)/$(*F).P; \
tr ' ' '\012' < .deps/$(*D)/$(*F).pp \ tr ' ' '\012' < .deps/$(*D)/$(*F).pp \
@ -1522,6 +1556,7 @@ distclean-generic:
-rm -f config.cache config.log stamp-h stamp-h[0-9]* -rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic: maintainer-clean-generic:
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \ mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-noinstPROGRAMS mostlyclean-tags \ mostlyclean-noinstPROGRAMS mostlyclean-tags \
mostlyclean-depend mostlyclean-generic mostlyclean-depend mostlyclean-generic
@ -1565,6 +1600,15 @@ installdirs mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean maintainer-clean-generic clean mostlyclean distclean maintainer-clean
stage2_size.h: pre_stage2
-rm -f stage2_size.h
set dummy `ls -l ../stage2/stage2`; \
echo "#define STAGE2_SIZE $$6" > stage2_size.h
stage2: pre_stage2 start
-rm -f stage2
cat start pre_stage2 > stage2
# General rule for making a raw binary. # General rule for making a raw binary.
%: %.exec %: %.exec
$(OBJCOPY) -O binary $< $@ $(OBJCOPY) -O binary $< $@

View file

@ -30,18 +30,26 @@
in real mode. */ in real mode. */
.code16 .code16
ENTRY(start) #ifndef STAGE1_5
/* Suppress ld warnings. */
.globl _start
_start:
/* /*
* Guarantee that "start" is loaded at 0x0:0x8000 in stage2 and * In stage2, do not link start.S with the rest of the source
* at 0x0:0x2000 in stage1.5. * files directly, so define the start symbols here just to
* force ld quiet. These are not referred anyway.
*/
.globl start, _start
start:
_start:
#endif /* ! STAGE1_5 */
ENTRY(main)
/*
* Guarantee that "main" is loaded at 0x0:0x8200 in stage2 and
* at 0x0:0x2200 in stage1.5.
*/ */
#ifndef STAGE1_5 #ifndef STAGE1_5
ljmp $0, $(codestart - EXT_C(start) + 0x8000) ljmp $0, $(codestart - EXT_C(main) + 0x8200)
#else #else
ljmp $0, $(codestart - EXT_C(start) + 0x2000) ljmp $0, $(codestart - EXT_C(main) + 0x2200)
#endif #endif
/* /*
@ -50,14 +58,14 @@ _start:
* These MUST be at byte offset 6 and 7 of the executable * These MUST be at byte offset 6 and 7 of the executable
* DO NOT MOVE !!! * DO NOT MOVE !!!
*/ */
. = EXT_C(start) + 0x6 . = EXT_C(main) + 0x6
.byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR .byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR
/* /*
* This is a special data area 8 bytes from the beginning. * This is a special data area 8 bytes from the beginning.
*/ */
. = EXT_C(start) + 0x8 . = EXT_C(main) + 0x8
VARIABLE(install_partition) VARIABLE(install_partition)
.long 0x020000 .long 0x020000
@ -77,7 +85,7 @@ VARIABLE(config_file)
* Leave some breathing room for the config file name. * Leave some breathing room for the config file name.
*/ */
. = EXT_C(start) + 0x70 . = EXT_C(main) + 0x70
/* the real mode code continues... */ /* the real mode code continues... */
codestart: codestart:
@ -203,7 +211,7 @@ ENTRY(chain_stage2)
/* set up to pass the partition where stage2 is located in */ /* set up to pass the partition where stage2 is located in */
movl EXT_C(current_partition), %eax movl EXT_C(current_partition), %eax
movl %eax, EXT_C(install_partition)-EXT_C(start)(%ebx) movl %eax, (EXT_C(install_partition)-EXT_C(main))(%ebx)
/* set up to pass the drive where stage2 is located in */ /* set up to pass the drive where stage2 is located in */
movb EXT_C(current_drive), %dl movb EXT_C(current_drive), %dl

View file

@ -744,13 +744,17 @@ static int
install_func (char *arg, int flags) install_func (char *arg, int flags)
{ {
char *stage1_file, *dest_dev, *file, *addr; char *stage1_file, *dest_dev, *file, *addr;
char buffer[SECTOR_SIZE], old_sect[SECTOR_SIZE]; char *stage1_buffer = (char *) RAW_ADDR (0x100000);
char *old_sect = stage1_buffer + SECTOR_SIZE;
char *stage2_first_buffer = old_sect + SECTOR_SIZE;
char *stage2_second_buffer = stage2_first_buffer + SECTOR_SIZE;
char *dummy = stage2_second_buffer + SECTOR_SIZE;
int new_drive = 0xFF; int new_drive = 0xFF;
int dest_drive, dest_sector; int dest_drive, dest_sector;
int i; int i;
struct geometry dest_geom; struct geometry dest_geom;
int write_stage2_sect = 0; int saved_sector;
int stage2_sect; int stage2_first_sector, stage2_second_sector;
char *ptr; char *ptr;
int installaddr, installlist; int installaddr, installlist;
/* Point to the location of the name of a configuration file in Stage 2. */ /* Point to the location of the name of a configuration file in Stage 2. */
@ -764,7 +768,7 @@ install_func (char *arg, int flags)
if (debug) if (debug)
printf ("[%d]", sector); printf ("[%d]", sector);
stage2_sect = sector; saved_sector = sector;
} }
/* Write SECTOR to INSTALLLIST, and update INSTALLADDR and /* Write SECTOR to INSTALLLIST, and update INSTALLADDR and
@ -776,7 +780,7 @@ install_func (char *arg, int flags)
if (*((unsigned long *) (installlist - 4)) if (*((unsigned long *) (installlist - 4))
+ *((unsigned short *) installlist) != sector + *((unsigned short *) installlist) != sector
|| installlist == BOOTSEC_LOCATION + STAGE1_FIRSTLIST + 4) || installlist == (int) stage2_first_buffer + SECTOR_SIZE + 4)
{ {
installlist -= 8; installlist -= 8;
@ -814,91 +818,60 @@ install_func (char *arg, int flags)
else else
ptr = skip_to (0, addr); ptr = skip_to (0, addr);
#ifndef NO_DECOMPRESSION
/* Do not decompress Stage 1 or Stage 2. */
no_decompression = 1;
#endif
/* Read Stage 1. */ /* Read Stage 1. */
if (! grub_open (stage1_file) if (! grub_open (stage1_file)
|| ! grub_read (buffer, SECTOR_SIZE) == SECTOR_SIZE) || ! grub_read (stage1_buffer, SECTOR_SIZE) == SECTOR_SIZE)
return 1; goto fail;
/* Read the old sector from DEST_DEV. */ /* Read the old sector from DEST_DEV. */
if (! set_device (dest_dev) if (! set_device (dest_dev)
|| ! open_partition () || ! open_partition ()
|| ! devread (0, 0, SECTOR_SIZE, old_sect)) || ! devread (0, 0, SECTOR_SIZE, old_sect))
return 1; goto fail;
/* Store the information for the destination device. */ /* Store the information for the destination device. */
dest_drive = current_drive; dest_drive = current_drive;
dest_geom = buf_geom; dest_geom = buf_geom;
dest_sector = part_start; dest_sector = part_start;
#ifndef NO_DECOMPRESSION /* Copy the possible DOS BPB, 59 bytes at byte offset 3. */
/* Do not decompress Stage 2. */ grub_memmove (stage1_buffer + BOOTSEC_BPB_OFFSET,
no_decompression = 1;
#endif
/* copy possible DOS BPB, 59 bytes at byte offset 3 */
grub_memmove (buffer + BOOTSEC_BPB_OFFSET,
old_sect + BOOTSEC_BPB_OFFSET, old_sect + BOOTSEC_BPB_OFFSET,
BOOTSEC_BPB_LENGTH); BOOTSEC_BPB_LENGTH);
/* if for a hard disk, copy possible MBR/extended part table */ /* If for a hard disk, copy the possible MBR/extended part table. */
if ((dest_drive & 0x80) && current_partition == 0xFFFFFF) if ((dest_drive & 0x80) && current_partition == 0xFFFFFF)
grub_memmove (buffer + BOOTSEC_PART_OFFSET, grub_memmove (stage1_buffer + BOOTSEC_PART_OFFSET,
old_sect + BOOTSEC_PART_OFFSET, old_sect + BOOTSEC_PART_OFFSET,
BOOTSEC_PART_LENGTH); BOOTSEC_PART_LENGTH);
/* Check for the version and the signature of Stage 1. */ /* Check for the version and the signature of Stage 1. */
if (*((short *)(buffer + STAGE1_VER_MAJ_OFFS)) != COMPAT_VERSION if (*((short *)(stage1_buffer + STAGE1_VER_MAJ_OFFS)) != COMPAT_VERSION
|| (*((unsigned short *) (buffer + BOOTSEC_SIG_OFFSET)) || (*((unsigned short *) (stage1_buffer + BOOTSEC_SIG_OFFSET))
!= BOOTSEC_SIGNATURE) != BOOTSEC_SIGNATURE))
|| (! (dest_drive & 0x80)
&& (*((unsigned char *) (buffer + BOOTSEC_PART_OFFSET)) == 0x80
|| buffer[BOOTSEC_PART_OFFSET] == 0))
|| (buffer[STAGE1_ID_OFFSET] != STAGE1_ID_LBA
&& buffer[STAGE1_ID_OFFSET] != STAGE1_ID_CHS))
{ {
errnum = ERR_BAD_VERSION; errnum = ERR_BAD_VERSION;
return 1; goto fail;
}
/* If DEST_DRIVE is a floppy, Stage 2 must have the iteration probe
routine. */
if (! (dest_drive & 0x80)
&& (*((unsigned char *) (stage1_buffer + BOOTSEC_PART_OFFSET)) == 0x80
|| stage1_buffer[BOOTSEC_PART_OFFSET] == 0))
{
errnum = ERR_BAD_VERSION;
goto fail;
} }
/* Open Stage 2. */ /* Open Stage 2. */
if (! grub_open (file)) if (! grub_open (file))
return 1; goto fail;
/* If STAGE1_FILE is the LBA version, do a sanity check. */
if (buffer[STAGE1_ID_OFFSET] == STAGE1_ID_LBA)
{
/* The geometry of the drive in which FILE is located. */
struct geometry load_geom;
/* Check if CURRENT_DRIVE is a floppy disk. */
if (! (current_drive & 0x80))
{
errnum = ERR_DEV_VALUES;
return 1;
}
/* Get the geometry of CURRENT_DRIVE. */
if (get_diskinfo (current_drive, &load_geom))
{
errnum = ERR_NO_DISK;
return 1;
}
#ifdef GRUB_UTIL
/* XXX Can we determine if LBA is supported in
the grub shell as well? */
grub_printf ("Warning: make sure that the access mode for "
"(hd%d) is LBA.\n",
current_drive - 0x80);
#else
/* Check if LBA is supported. */
if (! (load_geom.flags & BIOSDISK_FLAG_LBA_EXTENSION))
{
errnum = ERR_DEV_VALUES;
return 1;
}
#endif
}
if (! new_drive) if (! new_drive)
new_drive = current_drive; new_drive = current_drive;
@ -907,48 +880,31 @@ install_func (char *arg, int flags)
" be installed on a\ndifferent drive than the drive where" " be installed on a\ndifferent drive than the drive where"
" the Stage 2 resides.\n"); " the Stage 2 resides.\n");
memmove ((char*) BOOTSEC_LOCATION, buffer, SECTOR_SIZE); *((unsigned char *) (stage1_buffer + STAGE1_BOOT_DRIVE)) = new_drive;
*((unsigned char *) (BOOTSEC_LOCATION + STAGE1_FIRSTLIST))
= new_drive;
i = BOOTSEC_LOCATION+STAGE1_FIRSTLIST - 4;
while (*((unsigned long *) i))
{
if (i < BOOTSEC_LOCATION + STAGE1_FIRSTLIST - 256
|| (*((int *) (i - 4)) & 0x80000000)
|| *((unsigned short *) i) >= 0xA00
|| *((short *) (i + 2)) == 0)
{
errnum = ERR_BAD_VERSION;
return 1;
}
*((int *) i) = 0;
*((int *) (i - 4)) = 0;
i -= 8;
}
installlist = BOOTSEC_LOCATION + STAGE1_FIRSTLIST + 4;
/* Read the first sector of Stage 2. */ /* Read the first sector of Stage 2. */
disk_read_hook = disk_read_savesect_func; disk_read_hook = disk_read_savesect_func;
if (! grub_read ((char *) SCRATCHADDR, SECTOR_SIZE) == SECTOR_SIZE) if (grub_read (stage2_first_buffer, SECTOR_SIZE) != SECTOR_SIZE)
{ goto fail;
disk_read_hook = 0;
return 1; stage2_first_sector = saved_sector;
}
/* Read the second sector of Stage 2. */
if (grub_read (stage2_second_buffer, SECTOR_SIZE) != SECTOR_SIZE)
goto fail;
stage2_second_sector = saved_sector;
/* Check for the version of Stage 2. */ /* Check for the version of Stage 2. */
if (*((short *) (SCRATCHADDR + STAGE2_VER_MAJ_OFFS)) != COMPAT_VERSION) if (*((short *) (stage2_second_buffer + STAGE2_VER_MAJ_OFFS))
!= COMPAT_VERSION)
{ {
errnum = ERR_BAD_VERSION; errnum = ERR_BAD_VERSION;
return 1; goto fail;
} }
/* Check for the Stage 2 id. */ /* Check for the Stage 2 id. */
if (*((unsigned char *) (SCRATCHADDR + STAGE2_STAGE2_ID)) if (stage2_second_buffer[STAGE2_STAGE2_ID] != STAGE2_ID_STAGE2)
!= STAGE2_ID_STAGE2)
is_stage1_5 = 1; is_stage1_5 = 1;
/* If INSTALLADDR is not specified explicitly in the command-line, /* If INSTALLADDR is not specified explicitly in the command-line,
@ -963,33 +919,57 @@ install_func (char *arg, int flags)
installaddr = 0x2000; installaddr = 0x2000;
} }
*((unsigned short *) (BOOTSEC_LOCATION + STAGE1_INSTALLADDR)) *((unsigned long *) (stage1_buffer + STAGE1_STAGE2_SECTOR))
= stage2_first_sector;
*((unsigned short *) (stage1_buffer + STAGE1_STAGE2_ADDRESS))
= installaddr; = installaddr;
*((unsigned short *) (stage1_buffer + STAGE1_STAGE2_SEGMENT))
= installaddr >> 4;
/* Read the whole of Stage 2. */ i = (int) stage2_first_buffer + SECTOR_SIZE - 4;
filepos = 0; while (*((unsigned long *) i))
disk_read_hook = disk_read_blocklist_func;
if (! grub_read ((char *) RAW_ADDR (0x100000), -1))
{ {
disk_read_hook = 0; if (i < (int) stage2_first_buffer
return 1; || (*((int *) (i - 4)) & 0x80000000)
|| *((unsigned short *) i) >= 0xA00
|| *((short *) (i + 2)) == 0)
{
errnum = ERR_BAD_VERSION;
goto fail;
}
*((int *) i) = 0;
*((int *) (i - 4)) = 0;
i -= 8;
} }
installlist = (int) stage2_first_buffer + SECTOR_SIZE + 4;
installaddr += SECTOR_SIZE;
/* Read the whole of Stage2 except for the first sector. */
filepos = SECTOR_SIZE;
disk_read_hook = disk_read_blocklist_func;
if (! grub_read (dummy, -1))
goto fail;
disk_read_hook = 0;
/* Find a string for the configuration filename. */ /* Find a string for the configuration filename. */
config_file_location = ((char *) (SCRATCHADDR + STAGE2_VER_STR_OFFS)); config_file_location = stage2_second_buffer + STAGE2_VER_STR_OFFS;
while (*(config_file_location++)) while (*(config_file_location++))
; ;
if (*ptr == 'p') if (*ptr == 'p')
{ {
write_stage2_sect = 1; *((long *) (stage2_second_buffer + STAGE2_INSTALLPART))
*((long *) (SCRATCHADDR + STAGE2_INSTALLPART)) = current_partition; = current_partition;
if (is_stage1_5) if (is_stage1_5)
{ {
/* Reset the device information in FILE if it is a Stage 1.5. */ /* Reset the device information in FILE if it is a Stage 1.5. */
int device = 0xFFFFFFFF; unsigned long device = 0xFFFFFFFF;
grub_memmove (config_file_location, (char *) &device, sizeof (int)); grub_memmove (config_file_location, (char *) &device,
sizeof (device));
} }
ptr = skip_to (0, ptr); ptr = skip_to (0, ptr);
@ -997,15 +977,13 @@ install_func (char *arg, int flags)
if (*ptr) if (*ptr)
{ {
write_stage2_sect = 1;
if (! is_stage1_5) if (! is_stage1_5)
/* If it is a Stage 2, just copy PTR to CONFIG_FILE_LOCATION. */ /* If it is a Stage 2, just copy PTR to CONFIG_FILE_LOCATION. */
grub_strcpy (config_file_location, ptr); grub_strcpy (config_file_location, ptr);
else else
{ {
char *config_file; char *config_file;
int device; unsigned long device;
int tmp = current_drive; int tmp = current_drive;
/* Translate the external device syntax to the internal device /* Translate the external device syntax to the internal device
@ -1019,8 +997,9 @@ install_func (char *arg, int flags)
device = current_drive << 24 | current_partition; device = current_drive << 24 | current_partition;
current_drive = tmp; current_drive = tmp;
grub_memmove (config_file_location, (char *) &device, sizeof (int)); grub_memmove (config_file_location, (char *) &device,
grub_strcpy (config_file_location + sizeof (int), config_file); sizeof (device));
grub_strcpy (config_file_location + sizeof (device), config_file);
} }
} }
@ -1028,30 +1007,41 @@ install_func (char *arg, int flags)
buf_track = -1; buf_track = -1;
/* Write the modified first sector of Stage2 to the disk. */ /* Write the modified first sector of Stage2 to the disk. */
if (write_stage2_sect grub_memmove ((char *) SCRATCHADDR, stage2_first_buffer, SECTOR_SIZE);
&& biosdisk (BIOSDISK_WRITE, current_drive, &buf_geom, if (biosdisk (BIOSDISK_WRITE, current_drive, &buf_geom,
stage2_sect, 1, SCRATCHSEG)) stage2_first_sector, 1, SCRATCHSEG))
{ {
errnum = ERR_WRITE; errnum = ERR_WRITE;
disk_read_hook = 0; goto fail;
return 1;
} }
if (biosdisk (BIOSDISK_WRITE, dest_drive, &dest_geom, /* Write the modified second sector of Stage2 to the disk. */
dest_sector, 1, (BOOTSEC_LOCATION >> 4))) grub_memmove ((char *) SCRATCHADDR, stage2_second_buffer, SECTOR_SIZE);
if (biosdisk (BIOSDISK_WRITE, current_drive, &buf_geom,
stage2_second_sector, 1, SCRATCHSEG))
{ {
errnum = ERR_WRITE; errnum = ERR_WRITE;
disk_read_hook = 0; goto fail;
return 1;
} }
/* Write the modified sector of Stage 1 to the disk. */
grub_memmove ((char *) SCRATCHADDR, stage1_buffer, SECTOR_SIZE);
if (biosdisk (BIOSDISK_WRITE, dest_drive, &dest_geom,
dest_sector, 1, SCRATCHSEG))
{
errnum = ERR_WRITE;
goto fail;
}
fail:
disk_read_hook = 0; disk_read_hook = 0;
#ifndef NO_DECOMPRESSION #ifndef NO_DECOMPRESSION
no_decompression = 0; no_decompression = 0;
#endif #endif
return 0; return errnum;
} }
static struct builtin builtin_install = static struct builtin builtin_install =

View file

@ -165,6 +165,7 @@ extern char *grub_scratch_mem;
#define BOOTSEC_PART_OFFSET 0x1BE #define BOOTSEC_PART_OFFSET 0x1BE
#define BOOTSEC_PART_LENGTH 0x40 #define BOOTSEC_PART_LENGTH 0x40
#define BOOTSEC_SIG_OFFSET 0x1FE #define BOOTSEC_SIG_OFFSET 0x1FE
#define BOOTSEC_LISTSIZE 8
/* /*
* GRUB specific information * GRUB specific information

View file

@ -30,7 +30,7 @@ cmain (void)
*/ */
if (grub_open (config_file) && grub_read ((char *) 0x8000, -1)) if (grub_open (config_file) && grub_read ((char *) 0x8000, -1))
chain_stage2 (0, 0x8000); chain_stage2 (0, 0x8200);
/* /*
* If not, then print error message and die. * If not, then print error message and die.

View file

@ -18,8 +18,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <stage1.h> #define ASM_FILE
#include <shared.h>
#ifndef STAGE1_5
#include <stage2_size.h> #include <stage2_size.h>
#endif
/* /*
* defines for the code go here * defines for the code go here
@ -28,12 +32,16 @@
/* Absolute addresses /* Absolute addresses
This makes the assembler generate the address without support This makes the assembler generate the address without support
from the linker. (ELF can't relocate 16-bit addresses!) */ from the linker. (ELF can't relocate 16-bit addresses!) */
#define ABS(x) (x-_start+0x7c00) #ifdef STAGE1_5
# define ABS(x) (x-_start+0x2000)
#else
# define ABS(x) (x-_start+0x8000)
#endif /* STAGE1_5 */
/* Print message string */ /* Print message string */
#define MSG(x) movw $ABS(x), %si; call message #define MSG(x) movw $ABS(x), %si; call message
.file "stage1_lba.S" .file "start.S"
.text .text
@ -41,97 +49,31 @@
in real mode. */ in real mode. */
.code16 .code16
.globl _start; _start: .globl start, _start
start:
_start:
/* /*
* _start is loaded at 0x7c00 and is jumped to with CS:IP 0:0x7c00 * _start is loaded at 0x8000 and is jumped to with
* CS:IP 0:0x8000 in stage2.
*/ */
/* /*
* Beginning of the sector is compatible with the FAT/HPFS BIOS * we continue to use the stack for stage1 and assume that
* parameter block. * some registers are set to correct values. See stage1.S
* for more information.
*/ */
jmp after_BPB
nop /* do I care about this ??? */
/*
* This space is for the BIOS parameter block!!!! Don't change
* the first jump, nor start the code anywhere but right after
* this area.
*/
. = _start + 4
/* scratch space */
disk_address_packet:
/* Actually, must set these values at the runtime. */
.byte 0x10
.byte 0
.word 0
.long 0
.quad 0
/* more space... */
. = _start + STAGE1_BPBEND
/*
* End of BIOS parameter block.
*/
stage1_id:
.byte STAGE1_ID_LBA
after_BPB:
/* general setup */
cli /* we're not safe here! */
/* set up %ds and %ss as offset from 0 */
xorw %ax, %ax
movw %ax, %ds
movw %ax, %ss
/* set up the REAL stack */
movw $STAGE1_STACKSEG, %sp
sti /* we're safe again */
/*
* Check if we have a forced disk reference here
*/
movb ABS(firstlist), %al
cmpb $0xff, %al
je 1f
movb %al, %dl
1:
/* save drive reference first thing! */ /* save drive reference first thing! */
pushw %dx pushw %dx
/* check if LBA is supported */ /* print a notification message on the screen */
movb $0x41, %ah pushw %si
movw $0x55aa, %bx MSG(notification_string)
int $0x13 popw %si
jc lba_probe_error
cmpw $0xaa55, %bx
jne lba_probe_error
/* get the geometry (limited to 2TB!) */
movb $0x48, %ah
movw $STAGE1_DRP_ADDR, %si
movw $STAGE1_DRP_SIZE, (%si)
int $0x13
jc lba_probe_error
/* save the total number of sectors */
movl 0x10(%si), %ecx
/* set %si to disk address packet */
movw $ABS(disk_address_packet), %si
/* this sets up for the first run through "bootloop" */ /* this sets up for the first run through "bootloop" */
movw $ABS(firstlist - STAGE1_LISTSIZE), %di movw $ABS(firstlist - BOOTSEC_LISTSIZE), %di
/* this is the loop for reading the secondary boot-loader in */ /* this is the loop for reading the secondary boot-loader in */
bootloop: bootloop:
@ -143,6 +85,13 @@ bootloop:
je bootit je bootit
setup_sectors: setup_sectors:
/* check if we use LBA or CHS */
cmpb $0, -1(%si)
/* jump to chs_mode if zero */
je chs_mode
lba_mode:
/* load logical sector start */ /* load logical sector start */
movl (%di), %ebx movl (%di), %ebx
@ -158,12 +107,12 @@ setup_sectors:
cmpw %ax, 4(%di) /* compare against total number of sectors */ cmpw %ax, 4(%di) /* compare against total number of sectors */
/* which is greater? */ /* which is greater? */
jg more_sectors jg 1f
/* if less than, set to total */ /* if less than, set to total */
movw 4(%di), %ax movw 4(%di), %ax
more_sectors: 1:
/* subtract from total */ /* subtract from total */
subw %ax, 4(%di) subw %ax, 4(%di)
@ -182,9 +131,10 @@ more_sectors:
movl %ebx, 8(%si) movl %ebx, 8(%si)
/* the segment of buffer address */ /* the segment of buffer address */
movw $STAGE1_BUFFERSEG, 6(%si) movw $BUFFERSEG, 6(%si)
pushw %ax /* save %ax from destruction! */ /* save %ax from destruction! */
pushw %ax
/* zero %eax */ /* zero %eax */
xorl %eax, %eax xorl %eax, %eax
@ -210,6 +160,109 @@ more_sectors:
jc read_error jc read_error
movw $BUFFERSEG, %bx
jmp copy_buffer
chs_mode:
/* load logical sector start (bottom half) */
movl (%di), %eax
/* zero %edx */
xorl %edx, %edx
/* divide by number of sectors */
divl (%si)
/* save sector start */
movb %dl, 10(%si)
xorl %edx, %edx /* zero %edx */
divl 4(%si) /* divide by number of heads */
/* save head start */
movb %dl, 11(%si)
/* save cylinder start */
movw %ax, 12(%si)
/* do we need too many cylinders? */
cmpw 8(%si), %ax
jge geometry_error
/* determine the maximum sector length of this read */
movw (%si), %ax /* get number of sectors per track/head */
/* subtract sector start */
subb 10(%si), %al
/* how many do we really want to read? */
cmpw %ax, 4(%di) /* compare against total number of sectors */
/* which is greater? */
jg 2f
/* if less than, set to total */
movw 4(%di), %ax
2:
/* subtract from total */
subw %ax, 4(%di)
/* add into logical sector start */
addl %eax, (%di)
/*
* This is the loop for taking care of BIOS geometry translation (ugh!)
*/
/* get high bits of cylinder */
movb 13(%si), %dl
shlb $6, %dl /* shift left by 6 bits */
movb 10(%si), %cl /* get sector */
incb %cl /* normalize sector (sectors go
from 1-N, not 0-(N-1) ) */
orb %dl, %cl /* composite together */
movb 12(%si), %ch /* sector+hcyl in cl, cylinder in ch */
/* restore %dx */
popw %dx
pushw %dx
/* head number */
movb 11(%si), %dh
pushw %ax /* save %ax from destruction! */
/*
* BIOS call "INT 0x13 Function 0x2" to read sectors from disk into memory
* Call with %ah = 0x2
* %al = number of sectors
* %ch = cylinder
* %cl = sector (bits 6-7 are high bits of "cylinder")
* %dh = head
* %dl = drive (0x80 for hard disk, 0x0 for floppy disk)
* %es:%bx = segment:offset of buffer
* Return:
* %al = 0x0 on success; err code on failure
*/
movw $BUFFERSEG, %bx
movw %bx, %es /* load %es segment with disk buffer */
xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */
movb $0x2, %ah /* function 2 */
int $0x13
jc read_error
/* save source segment */
movw %es, %bx
copy_buffer:
/* load addresses for copy from disk buffer to destination */ /* load addresses for copy from disk buffer to destination */
movw 6(%di), %es /* load destination segment */ movw 6(%di), %es /* load destination segment */
@ -222,20 +275,18 @@ more_sectors:
addw %ax, 6(%di) /* add the corrected value to the destination addw %ax, 6(%di) /* add the corrected value to the destination
address for next time */ address for next time */
/* save addressing regs */
pushw %ds
pushw %si
pushw %di
pushw %cx
/* get the copy length */ /* get the copy length */
shlw $4, %ax shlw $4, %ax
movw %ax, %cx movw %ax, %cx
/* save addressing regs */
pushw %ds
pushw %si
pushw %di
xorw %di, %di /* zero offset of destination addresses */ xorw %di, %di /* zero offset of destination addresses */
xorw %si, %si /* zero offset of source addresses */ xorw %si, %si /* zero offset of source addresses */
movw $STAGE1_BUFFERSEG, %ax movw %bx, %ds /* restore the source segment */
movw %ax, %ds
cld /* sets the copy direction to forward */ cld /* sets the copy direction to forward */
@ -244,7 +295,6 @@ more_sectors:
movsb /* this runs the actual copy */ movsb /* this runs the actual copy */
/* restore addressing regs */ /* restore addressing regs */
popw %cx
popw %di popw %di
popw %si popw %si
popw %ds popw %ds
@ -254,13 +304,22 @@ more_sectors:
jne setup_sectors jne setup_sectors
/* update position to load from */ /* update position to load from */
subw $STAGE1_LISTSIZE, %di subw $BOOTSEC_LISTSIZE, %di
/* jump to bootloop */ /* jump to bootloop */
jmp bootloop jmp bootloop
/* END OF MAIN LOOP */ /* END OF MAIN LOOP */
bootit:
popw %dx /* this makes sure %dl is our "boot" drive */
#ifdef STAGE1_5
ljmp $0, $0x2200
#else /* ! STAGE1_5 */
ljmp $0, $0x8200
#endif /* ! STAGE1_5 */
/* /*
* BIOS Geometry translation error (past the end of the disk geometry!). * BIOS Geometry translation error (past the end of the disk geometry!).
*/ */
@ -268,13 +327,6 @@ geometry_error:
MSG(geometry_error_string) MSG(geometry_error_string)
jmp general_error jmp general_error
/*
* Disk probe failure.
*/
lba_probe_error:
MSG(lba_probe_error_string)
jmp general_error
/* /*
* Read error on the disk. * Read error on the disk.
*/ */
@ -287,8 +339,13 @@ general_error:
/* go here when you need to stop the machine hard after an error condition */ /* go here when you need to stop the machine hard after an error condition */
stop: jmp stop stop: jmp stop
#ifdef STAGE1_5
notification_string: .string " stage1.5"
#else
notification_string: .string " stage2"
#endif
geometry_error_string: .string "Geom" geometry_error_string: .string "Geom"
lba_probe_error_string: .string "LBA"
read_error_string: .string "Read" read_error_string: .string "Read"
general_error_string: .string " Error" general_error_string: .string " Error"
@ -323,79 +380,28 @@ lastlist:
* from a fixed top location. * from a fixed top location.
*/ */
/*
* This data area is for keeping general parameters.
*/
. = _start + STAGE1_PARTSTART - STAGE1_MINPARAMSIZE - STAGE1_LISTSIZE
/* this next data area before the partition area is specifically
sized, you should update "STAGE1_MINPARAMSIZE" to reflect any
additions or deletions to this area. */
.word 0 .word 0
.word 0 .word 0
. = _start + 0x200 - BOOTSEC_LISTSIZE
/* fill the first data listing with the default */ /* fill the first data listing with the default */
#ifdef FFS_STAGE1_5
blocklist_default_start: blocklist_default_start:
.long 2 /* this is the sector start parameter, in logical .long 2 /* this is the sector start parameter, in logical
sectors from the start of the disk, sector 0 */ sectors from the start of the disk, sector 0 */
blocklist_default_len:
.word 14 /* this is the number of sectors to read */
blocklist_default_seg:
.word 0x0200 /* this is the segment of the starting address
to load the data into */
#else
blocklist_default_start:
.long 1 /* this is the sector start parameter, in logical
sectors from the start of the disk, sector 0 */
blocklist_default_len: blocklist_default_len:
/* this is the number of sectors to read */ /* this is the number of sectors to read */
#ifdef STAGE1_5
.word 0 /* the command "install" will fill this up */
#else
.word (STAGE2_SIZE + 511) >> 9 .word (STAGE2_SIZE + 511) >> 9
#endif
blocklist_default_seg: blocklist_default_seg:
.word 0x0800 /* this is the segment of the starting address #ifdef STAGE1_5
.word 0x220
#else
.word 0x820 /* this is the segment of the starting address
to load the data into */ to load the data into */
#endif #endif
firstlist: /* this label has to be after the list data!!! */ firstlist: /* this label has to be after the list data!!! */
.byte 0xff /* the disk to load stage2 from */
/* 0xff means use the boot drive */
/*
* Jump here when all data loading is done. This
* goes to the second stage bootloader.
*/
bootit:
popw %dx /* this makes sure %dl is our "boot" drive */
ljmp $0, $0x8000 /* FIXME: make 0x2000 for stage1_5 */
/*
* This is the compatibility version number.
* See stage1.h for COMPAT_VERSION_* definitions used
* in stage2 and stage1_5 modules.
*
* DO NOT MOVE THIS!!!
*/
.byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR
/*
* This is where an MBR would go if on a hard disk. The code
* here isn't even referenced unless we're on a floppy. Kinda
* sneaky, huh?
*/
. = _start + STAGE1_PARTSTART
/* These values are not useful in stage1_lba at all, but these
prevent the installation command `install' from failing. */
probe_values:
.byte 36, 18, 15, 9, 0
/* This space cannot be used by any bootloader, uggh... */
. = _start + STAGE1_PARTEND
/* the last 2 bytes in the sector 0 contain the signature */
.word STAGE1_SIGNATURE