From 4ea54f2d0a4487e694216f911e77907f0bdbcc24 Mon Sep 17 00:00:00 2001 From: okuji Date: Wed, 15 Sep 1999 05:41:03 +0000 Subject: [PATCH] determine the size of Stage 2 automatically. --- ChangeLog | 21 +++++++++++++++++++++ Makefile.am | 4 +++- Makefile.in | 5 ++++- README | 12 ------------ stage1/Makefile.am | 13 ++++++++++--- stage1/Makefile.in | 14 +++++++++++--- stage1/stage1.S | 6 ++++-- stage1/stage1_lba.S | 6 ++++-- stage2/size_test | 4 ---- 9 files changed, 57 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 90929522c..6aab44524 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +1999-09-15 OKUJI Yoshinori + + * stage2/size_test: Do not check for the size of Stage 2. + * stage1/Makefile.am (stage2_size.h): Use `set' and `echo' + instead of awk, since we cannot expect awk is present. Remove + stage2_size.h before creating it. + +1999-09-15 Pavel Roskin + + * Makefile.am (SUBDIRS): Put stage1 after stage2 so that stage2 + is built before stage1. + * stage1/Makefile.am (BUILT_SOURCES): New varilable. + (CLEANFILES): Added BUILT_SOURCES. + (stage1_exec_SOURCES): Added stage2_size.h. + (stage1_lba_exec_SOURCES): Likewise. + (stage2_size.h): New rule. + * stage1/stage1.S: Include and use STAGE2_SIZE + to determine how much number of sectors to be read when loading + Stage 2. + * stage1/stage1_lba.S: Likewise. + 1999-09-15 OKUJI Yoshinori * netboot/config.h: Moved to ... diff --git a/Makefile.am b/Makefile.am index 7b3bd44ec..0dff27f1d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,6 @@ -SUBDIRS = stage1 netboot stage2 grub docs debian +# Stage 1 is built after Stage 2, so that the size of Stage 2 is +# encoded into Stage 1. +SUBDIRS = netboot stage2 stage1 grub docs debian EXTRA_DIST = BUGS # We get $(PACKAGE) and $(VERSION) from debian/changelog. diff --git a/Makefile.in b/Makefile.in index d65b503b8..6b55a10c1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -82,8 +82,11 @@ host_cpu = @host_cpu@ host_vendor = @host_vendor@ install_sh = @install_sh@ +# Stage 1 is built after Stage 2, so that the size of Stage 2 is +# encoded into Stage 1. -SUBDIRS = stage1 netboot stage2 grub docs debian + +SUBDIRS = netboot stage2 stage1 grub docs debian EXTRA_DIST = BUGS subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 diff --git a/README b/README index 522a293ef..7ec6e5125 100644 --- a/README +++ b/README @@ -25,12 +25,6 @@ ftp.XX.kernel.org (XX is the country code, such as `jp'). These below are required when you develop GRUB or when you get it from the CVS: -* autoconf 19990301 and later - - Autoconf 2.13 has a bug that can't handle any macro with arguments, -so you need to get the later version from the CVS. See -http://sourceware.cygnus.com/autoconf/ for more information. - * automake 19990620 and later The new feature, per-executable flags, is requred, so you need to get @@ -70,12 +64,6 @@ Just hit enter when CVS prompts you for a password. IMPORTANT SIZE LIMITS: - - For the various stage2's, if they are being loaded from a block-list - in the stage1, then be sure your blocklist is big enough. The - automated install will generally do this for you, it's just when - dropping it on a raw floppy, you get the default compiled in, which - is 512 * 130 disk sectors, or 66560 bytes. - - For the FFS stage1.5, if you want to fit into the "bootloader" area of an FFS partition, it cannot be larger than 512 * 14 disk sectors, or 7168 bytes. diff --git a/stage1/Makefile.am b/stage1/Makefile.am index 1abfc3f70..38fa2e152 100644 --- a/stage1/Makefile.am +++ b/stage1/Makefile.am @@ -1,14 +1,21 @@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) nodist_pkgdata_DATA = stage1 stage1_lba -CLEANFILES = $(pkgdata_DATA) + +BUILT_SOURCES = stage2_size.h +CLEANFILES = $(pkgdata_DATA) $(BUILT_SOURCES) # We can't use builtins or standard includes. AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 noinst_PROGRAMS = stage1.exec stage1_lba.exec -stage1_exec_SOURCES = stage1.S stage1.h -stage1_lba_exec_SOURCES = stage1_lba.S stage1.h +stage1_exec_SOURCES = stage1.S stage1.h stage2_size.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 $(OBJCOPY) -O binary $< $@ diff --git a/stage1/Makefile.in b/stage1/Makefile.in index c51a8b88a..7d6e4ec4a 100644 --- a/stage1/Makefile.in +++ b/stage1/Makefile.in @@ -83,15 +83,17 @@ install_sh = @install_sh@ pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) nodist_pkgdata_DATA = stage1 stage1_lba -CLEANFILES = $(pkgdata_DATA) + +BUILT_SOURCES = stage2_size.h +CLEANFILES = $(pkgdata_DATA) $(BUILT_SOURCES) # We can't use builtins or standard includes. AM_CFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc LDFLAGS = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 noinst_PROGRAMS = stage1.exec stage1_lba.exec -stage1_exec_SOURCES = stage1.S stage1.h -stage1_lba_exec_SOURCES = stage1_lba.S stage1.h +stage1_exec_SOURCES = stage1.S stage1.h stage2_size.h +stage1_lba_exec_SOURCES = stage1_lba.S stage1.h stage2_size.h subdir = stage1 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h @@ -288,6 +290,7 @@ distclean-generic: -rm -f config.cache config.log stamp-h stamp-h[0-9]* maintainer-clean-generic: + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) mostlyclean-am: mostlyclean-noinstPROGRAMS mostlyclean-compile \ mostlyclean-tags mostlyclean-depend mostlyclean-generic @@ -326,6 +329,11 @@ installdirs mostlyclean-generic distclean-generic clean-generic \ 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 $(OBJCOPY) -O binary $< $@ diff --git a/stage1/stage1.S b/stage1/stage1.S index f615d3672..da55123c4 100644 --- a/stage1/stage1.S +++ b/stage1/stage1.S @@ -19,7 +19,8 @@ */ #include - +#include + /* * defines for the code go here */ @@ -398,7 +399,8 @@ lastlist: #else .long 1 /* this is the sector start parameter, in logical sectors from the start of the disk, sector 0 */ - .word 130 /* this is the number of sectors to read */ + /* this is the number of sectors to read */ + .word (STAGE2_SIZE + 511) / 512 .word 0x0800 /* this is the segment of the starting address to load the data into */ #endif diff --git a/stage1/stage1_lba.S b/stage1/stage1_lba.S index 8e9777f1d..747915e90 100644 --- a/stage1/stage1_lba.S +++ b/stage1/stage1_lba.S @@ -19,7 +19,8 @@ */ #include - +#include + /* * defines for the code go here */ @@ -345,7 +346,8 @@ lastlist: #else .long 1 /* this is the sector start parameter, in logical sectors from the start of the disk, sector 0 */ - .word 130 /* this is the number of sectors to read */ + /* this is the number of sectors to read */ + .word (STAGE2_SIZE + 511) / 512 .word 0x0800 /* this is the segment of the starting address to load the data into */ #endif diff --git a/stage2/size_test b/stage2/size_test index e5e6ada9a..5cc917ddd 100644 --- a/stage2/size_test +++ b/stage2/size_test @@ -50,9 +50,5 @@ check e2fs_stage1_5 31744 # Likewise. check minix_stage1_5 31744 -# This limitation is arbitrary; If you want to make this larger, just -# modify Stage 1. -check stage2 66560 - # Success. exit 0