determine the size of Stage 2 automatically.

This commit is contained in:
okuji 1999-09-15 05:41:03 +00:00
parent e8d6ef494e
commit 4ea54f2d0a
9 changed files with 57 additions and 28 deletions

View file

@ -1,3 +1,24 @@
1999-09-15 OKUJI Yoshinori <okuji@kuicr.kyoto-u.ac.jp>
* 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 <pavel_roskin@geocities.com>
* 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 <stage2_size.h> 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 <okuji@kuicr.kyoto-u.ac.jp>
* netboot/config.h: Moved to ...

View file

@ -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.

View file

@ -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

12
README
View file

@ -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.

View file

@ -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 $< $@

View file

@ -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 $< $@

View file

@ -19,7 +19,8 @@
*/
#include <stage1.h>
#include <stage2_size.h>
/*
* 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

View file

@ -19,7 +19,8 @@
*/
#include <stage1.h>
#include <stage2_size.h>
/*
* 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

View file

@ -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