diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 000000000..1ac8bf046 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,54 @@ +1999-02-14 Gordon Matzigkeit + + * shared_src/shared.h: (addr32, data32): Delete definitions. + + * stage1/stage1.S: Modify to use GAS's new .code16 semantics. + shared_src/asm.S: Likewise. + + * configure: Test to see if the `addr32' instruction is supported. + Ian Lance Taylor says that GAS's interpretation of `.code16' has + changed. Older versions always generated 32-bit code, but + implicitly inserted addr32 and data32 when .code16 was given. + Newer versions generate 16-bit code, and require manual addr32 and + data32 overrides. + + * shared_src/shared.h: Add some assertions to check that buffer + addresses are properly defined. + +1999-02-12 Gordon Matzigkeit + + * shared_src/stage2.c (run_menu): Pause if we failed to boot both + the default and fallback entries. + + * configure: Check to make sure that GAS actually honors .code16 + directives. + +1999-02-02 Gordon Matzigkeit + + * shared_src/asm.S: Fix typo that called interrupt 0xd (decimal + 13) instead of 0x13. + +1999-01-31 Gordon Matzigkeit + + * e2fs_stage1_5/Makefile: Avoid gratuitous dependencies on + Makefile. + * fat_stage1_5/Makefile: Likewise. + * ffs_stage1_5/Makefile: Likewise. + + * Makefile.end (PROGS): Add e2fs_stage1_5, fat_stage1_5, and + grubinst. + (distclean): New GNU standard rule. + +1998-10-23 Gordon Matzigkeit + + * configure: Accept `--host' as a synonym for `--target', and + accept a non-optional argument as the target name. Join the + prefix to the tool name with a hyphen. + + * shared_src/disk_io.c (print_fsys_type): Always print the + partition type. + + * shared_src/stage2.c (run_menu): Check to make sure that the + fallback entry is nonnegative. + (run_menu): For consistency, use `e' rather than enter to edit the + command entry. diff --git a/Makefile.end b/Makefile.end index 39218ff08..724a5e3f3 100644 --- a/Makefile.end +++ b/Makefile.end @@ -3,12 +3,15 @@ # part created by configure. # -PROGS= stage1 ffs_stage1_5 stage2 stage2_debug +PROGS= stage1 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ + stage2 stage2_debug all: - @for X in $(PROGS) ; do (cd $$X ; $(MAKE)) ; done + l="$(PROGS)"; for X in $$l; do (cd $$X && $(MAKE)) || exit 1; done clean: - @for X in $(PROGS) ; do (cd $$X ; $(MAKE) clean) ; done - rm -f config.log + l="$(PROGS)"; for X in $$l; do (cd $$X && $(MAKE) clean); done + rm -f bin/* +distclean: clean + rm -f Makefile config.log diff --git a/README b/README index 3067bdb07..7e67c583c 100644 --- a/README +++ b/README @@ -1,3 +1,11 @@ +This is GRUB, the GRand Unified Boot-loader. Note that this version +is maintained by Gordon Matzigkeit , until Erich +Boleyn has a chance to catch up with all the patches needed for +Debian. Please do not bother Erich about this release, because he +hasn't approved of it. + +Here is the original README: + GRUB -- GRand Unified Boot-loader @@ -66,4 +74,3 @@ Other Documentation improved! The TODO and NEWS files are always up-to-date. - diff --git a/configure b/configure index 328672ba1..1d27807eb 100644 --- a/configure +++ b/configure @@ -43,7 +43,7 @@ do case "$ac_option" in -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; - *) ac_optarg= ;; + *) ac_optarg= ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -58,6 +58,7 @@ General Options: --quiet, --silent do not print \`checking...' messages --version print the fact that this isn't autoconf ;-) Target Options: + --host=TARGET synonym for \`--target' --target=TARGET use \`TARGET' as a prefix to all of the tool names EOF exit 0 ;; @@ -66,18 +67,23 @@ EOF | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + -host | --host | --hos | --ho | --h \ + | -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -host=* | --host=* | --hos=* | --ho=* | --h=* \ + | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target="$ac_optarg" ;; -version | --version | --versio | --versi | --vers) echo "mini-configure written by Erich Boleyn with parts from autoconf-2.10" exit 0 ;; - *) + -*) echo "Warning: unrecognized configure option: \"$ac_option\"" ;; + *) + target="$ac_option" + ;; esac done @@ -117,7 +123,7 @@ that some standard local compiler, \`grep', \`sed', GNU \`gcc', and the complete GNU binutils version 2.8.1 or beyond are installed. The first 2 are used for automatic configuration, and the rest are required for building GRUB. The file \`config.log' contains the debugging output of -this run, and the subdirectory \`.conf_test_dir' contains the files and +this run, and the subdirectory \`conftestdir' contains the files and programs produced. EOF exit 0 @@ -188,8 +194,8 @@ find_symbol_munge() # Cleanup from previous incomplete tests -if [ -d .conf_test_dir ]; then - rm -rf .conf_test_dir +if [ -d conftestdir ]; then + rm -rf conftestdir fi # Clear configuration log @@ -197,8 +203,8 @@ if [ -e config.log ]; then rm -rf config.log fi -mkdir .conf_test_dir -cd .conf_test_dir +mkdir conftestdir +cd conftestdir # # Find tools @@ -218,7 +224,7 @@ for tool_var in $tool_vars ; do if [ "$tmpvar" = "" ]; then get_substr tmpvar $i ${tool_targeted} if [ "$target" != "" -a "$tmpvar" = "yes" ]; then - tool_name=$target$tool_name + tool_name=$target-$tool_name fi eval export $tool_var=$tool_name fi @@ -278,10 +284,9 @@ echo " \"$munge_func1\" and \"$munge_func2\"" >> ../config.log if [ "$munge_func1" != "$munge_func2" ]; then tool_failed ${CC} -fi - -if [ "$silent" != "yes" ]; then - echo done + test $silent = yes || echo yes +else + test $silent = yes || echo no fi # @@ -290,7 +295,7 @@ fi # if [ "$silent" != "yes" ]; then - echo -n "checking to see if ${OBJCOPY} is buggy... " + echo -n "checking whether ${OBJCOPY} works... " fi cat << EOF > test_objcopy.c @@ -324,9 +329,38 @@ for link_addr in $link_addrs ; do done if [ "$silent" != "yes" ]; then - echo done + echo yes fi +# Mass confusion! +# Older versions of GAS interpret `.code16' to mean ``generate 32-bit +# instructions, but implicitly insert addr32 and data32 bytes so +# that the code works in real mode''. +# +# Newer versions of GAS interpret `.code16' to mean ``generate 16-bit +# instructions,'' which seems right. This requires the programmer +# to explicitly insert addr32 and data32 instructions when they want +# them. +# +# We only support the newer versions, because the old versions cause +# major pain, by requiring manual assembly to get 16-bit instructions into +# stage1/stage1.S. +if [ "$silent" != "yes" ]; then + echo -n "checking whether GAS understands addr32... " +fi + +cat > test_addr32.S <> ../config.log +${CC} -nostdinc -c test_addr32.S >> ../config.log 2>&1 +check_exit_status GAS + +test $silent != yes && echo yes + # # Write out results # @@ -374,6 +408,4 @@ fi # Delete test directory # -rm -rf .conf_test_dir - - +rm -rf conftestdir diff --git a/debian/README.debian b/debian/README.debian new file mode 100644 index 000000000..bb33313c6 --- /dev/null +++ b/debian/README.debian @@ -0,0 +1,18 @@ +GRUB for Debian GNU +------------------- + +GRUB is a GPLed bootloader intended to unify bootloading across x86 +operating systems. In addition to loading Linux and FreeBSD, it +implements the Multiboot standard, which allows for flexible loading +of multiple boot images (needed for modular kernels such as the GNU +Hurd). + +One unique featue of GRUB is that it can understand filesystems at +boot time, rather than just simple blocklists. Hence, you can load +any kernel in the file system from the boot prompt without having to +edit any configuration files or run a special installation program. + +GRUB can be found at + ftp://ftp.uruk.org/public/grub/ + +Gordon Matzigkeit , Fri, 12 Feb 1999 00:41:23 -0600 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..21d30feae --- /dev/null +++ b/debian/changelog @@ -0,0 +1,46 @@ +grub (0.5-2) unstable; urgency=low + + * Assembly source cleanups. + + -- Gordon Matzigkeit Sun, 14 Feb 1999 20:33:39 -0600 + +grub (0.5-1) unstable; urgency=low + + * Put everything in /lib/grub (not /boot/grub) and don't install during + postinst so that we can't accidentally wreck a working system. This + means the package needn't be experimental anymore. + * Get rid of grubinst because it doesn't work with 0.5, and I'd rather + improve GRUB's builtin installation process. + * Use `e' rather than enter to edit. + * Minor bug fixes. + + -- Gordon Matzigkeit Sun, 31 Jan 1998 14:11:32 -0600 + +grub (0.4-2) experimental; urgency=low + + * Make postinstall script + * Create manpage for grubinst + * Make grubinst more flexible + * Address bugs 15227 and 15163 (packaging and clue endowment) + + -- Steve Dunham Thu, 1 Jan 1998 00:38:22 -0500 + +grub (0.4-2) experimental; urgency=low + + * Make postinstall script + * Create manpage for grubinst + * Make grubinst more flexible + * Address bugs 15227 and 15163 (packaging and clue endowment) + + -- Steve Dunham Thu, 1 Jan 1998 00:38:22 -0500 + +grub (0.4-1) unstable; urgency=low + + * Initial Release. + + -- Steve Dunham Wed, 19 Nov 1997 23:42:47 -0500 + +Local variables: +mode: debian-changelog +add-log-mailing-address: "gord@debian.org" +End: diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..a68f8a180 --- /dev/null +++ b/debian/control @@ -0,0 +1,15 @@ +Source: grub +Section: base +Priority: extra +Maintainer: Gordon Matzigkeit +Standards-Version: 2.5.0.0 + +Package: grub +Architecture: i386 hurd-i386 +Depends: ${shlibs:Depends} +Description: GRand Unified Bootloader + GRUB is a GPLed bootloader intended to unify bootloading across x86 + operating systems. In addition to loading Linux and FreeBSD, it + implements the Multiboot standard, which allows for flexible loading + of multiple boot images (needed for modular kernels such as the GNU + Hurd). diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000..2bb995ff2 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,27 @@ +This package was debianized by Gordon Matzigkeit . +It was downloaded from ftp://ftp.uruk.org/public/grub/grub-0.5.tar.gz + +Tom Lees implemented building the e2fs_stage1_5, Steve Dunham adapted +it to fat_stage1_5. + + +Copyright: + +GRUB is Copyright (C) 1996 Erich Boleyn + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +On Debian GNU systems, the complete text of the GNU General Public +License can be found in `/usr/doc/copyright/GPL'. diff --git a/debian/rules b/debian/rules new file mode 100644 index 000000000..551e1e44a --- /dev/null +++ b/debian/rules @@ -0,0 +1,67 @@ +#!/usr/bin/make -f +# -*-makefile-*- +# based on the sample debian/rules file for GNU hello by Ian Jackson. + +package=grub + +INSTALL = install -c +INSTALL_DATA = $(INSTALL) -m 644 +INSTALL_PROGRAM = $(INSTALL) -m 755 + +build: + $(checkdir) + ./configure + make + echo timestamp > build + +clean: + $(checkdir) + -rm -f build + -make distclean + -rm -f `find . -name "*~"` + -rm -rf debian/tmp debian/files* core debian/substvars conftestdir + +binary-indep: checkroot build + $(checkdir) +# There are no architecture-independent files to be uploaded +# generated by this package. If there were any they would be +# made here. + +binary-arch: checkroot build + $(checkdir) + -rm -rf debian/tmp +## make dirs + install -d debian/tmp debian/tmp/lib/grub debian/tmp/usr/doc/grub \ + debian/tmp/DEBIAN +## install files + + install -m 644 bin/* debian/tmp/lib/grub + + # FIXME: gzip the html files, and make sure cross-refs work fine + cp -r docs debian/tmp/usr/doc/grub + rm -f debian/tmp/usr/doc/grub/docs/COPYING + + $(INSTALL_DATA) ChangeLog debian/tmp/usr/doc/grub/ + gzip -f9 debian/tmp/usr/doc/grub/ChangeLog + $(INSTALL_DATA) debian/changelog debian/tmp/usr/doc/grub/changelog.Debian + gzip -f9 debian/tmp/usr/doc/grub/changelog.Debian + $(INSTALL_DATA) debian/copyright debian/tmp/usr/doc/grub/ + + dpkg-gencontrol + chown -R root.root debian/tmp + chmod -R go=rX debian/tmp + dpkg --build debian/tmp .. + +define checkdir + test -f debian/rules -a -f shared_src/fsys_ext2fs.c +endef + +# Below here is fairly generic really + +binary: binary-indep binary-arch + +checkroot: + $(checkdir) + test root = "`whoami`" + +.PHONY: binary binary-arch binary-indep clean checkroot diff --git a/docs/BUGS b/docs/BUGS index e384f209c..3edc7e6d1 100644 --- a/docs/BUGS +++ b/docs/BUGS @@ -1,6 +1,9 @@ Known problems/bugs: + - Try `d' to delete the selected line while editing a menu entry + (maybe only when deleting the last line). Everything goes to hell. + - FreeBSD boot command-line options are slightly problematic, and OpenBSD options are probably quite wrong. This is because they use options that are bits in a data word passed at boot time, and @@ -28,4 +31,3 @@ Known problems/bugs: - Hitting Ctrl-Alt-Delete when in GRUB locks some machines. Use Reset for now. (This apparently hasn't been observed for a while) - diff --git a/docs/NEWS b/docs/NEWS index 672367df8..b05089c5e 100644 --- a/docs/NEWS +++ b/docs/NEWS @@ -1,3 +1,8 @@ +NEWS - list of user-visible changes between releases of GRUB + +New in 0.5.2 - 1999-01-31, Gordon Matzigkeit: +* Bug fixes. +* Version 0.5: @@ -210,4 +215,3 @@ Version 0.0 dated 12/10/95: - Fixed some documentation (what little there is :-/ and a few assembly bugs in the BIOS access routines that nobody reported yet, so I won't detail it here. - diff --git a/docs/TODO b/docs/TODO index 7e8888fe4..c3273a06b 100644 --- a/docs/TODO +++ b/docs/TODO @@ -1,3 +1,15 @@ +Treat `(hd)/boot/grub/menu.lst' as searching through the hard drives +for a partition that contains /boot/grub/menu.lst. Either this, or +`(hd:0x82)' means the first partition of type 0x82. We need one of +these dynamic search mechanisms for clean Hurd install floppies. + +Syntax: + + (hd0,0) -> hd0s1 + (hd0,1,b) -> hd0s1b + (hd0) -> hd0 + +Find out the size restrictions for FAT and ext2fs stage1.5 boot blocks. Check for other patches sent in e-mail!!! There are several... @@ -18,4 +30,3 @@ ??? Add command for modifying partition types. Fix-up FreeBSD, NetBSD (and OpenBSD ?) command-line boot parameters - diff --git a/docs/boot-proposal.html b/docs/boot-proposal.html index bd414447c..2482b4156 100644 --- a/docs/boot-proposal.html +++ b/docs/boot-proposal.html @@ -404,7 +404,7 @@ the "top-level" partition number, 'part2' specifies a "sub-partition" in the top-level partition, etc. Partition numbers always start from zero. Unused partition bytes must be set to 0xFF. For example, if the disk is partitioned using a simple one-level DOS partitioning scheme, then 'part1' -contains the DOS partition number, and 'part2' and 'part3' are both zero. +contains the DOS partition number, and 'part2' and 'part3' are both 0xFF. As another example, if a disk is partitioned first into DOS partitions, and then one of those DOS partitions is subdivided into several BSD partitions using BSD's "disklabel" strategy, then 'part1' contains the DOS partition @@ -412,13 +412,13 @@ number, 'part2' contains the BSD sub-partition within that DOS partition, and 'part3' is 0xFF.

DOS extended partitions are indicated as partition numbers starting from 4 -and increasing, rather than as nested sub-partitions, even though the +and increasing, rather than as nested sub-partitions, even though the underlying disk layout of extended partitions is hierarchical in nature. For example, if the boot loader boots from the second extended partition on a disk partitioned in conventional DOS style, then 'part1' will be 5, and 'part2' and 'part3' will both be 0xFF.

-If bit 2 of the flags longword is set, the 'cmdline' field is valid, and +If bit 2 of the flags longword is set, the 'cmdline' field is valid, and contains the physical address of the the command line to be passed to the kernel. The command line is a normal C-style null-terminated string.

@@ -661,4 +661,3 @@ area.

- diff --git a/docs/filesystem.txt b/docs/filesystem.txt index d9ede6937..acb95a66f 100644 --- a/docs/filesystem.txt +++ b/docs/filesystem.txt @@ -206,7 +206,7 @@ The variables which can be read by the filesystem backend are: -- the "#define FSYS_BUF", which points to a filesystem buffer which is 32K in size, to use in any way which the filesystem backend - desires. + desires. The variables which need to be written by a filesystem backend are: @@ -295,5 +295,3 @@ Limitations: -- If the "blocksize" is greater than 8Kbytes, various buffers will overwrite themselves and the whole thing will come apart at the seams. - - diff --git a/e2fs_stage1_5/Makefile b/e2fs_stage1_5/Makefile new file mode 100644 index 000000000..3968e43cf --- /dev/null +++ b/e2fs_stage1_5/Makefile @@ -0,0 +1,46 @@ +# +# GRUB e2fs_stage1_5 makefile +# + +SHARED_FLAGS += -DFSYS_EXT2FS -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ + -DNO_BLOCK_FILES -DCONFIG_FILE_ASM=".string \"/boot/grub/stage2\"" \ + -I../shared_src + +# There are problems inheriting flags that work fine with stage1 and stage2 +# so... don't use them at all! +CFLAGS= $(SHARED_FLAGS) + +# "asm.o" absolutely has to come first in the link line! +SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_ext2fs.o + +all: ../bin/e2fs_stage1_5 + +asm.o: ../shared_src/asm.S ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/asm.S + +char_io.o: ../shared_src/char_io.c ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/char_io.c + +common.o: ../shared_src/common.c ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/common.c + +disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ + ../shared_src/pc_slice.h ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/disk_io.c + +stage1_5.o: ../shared_src/stage1_5.c ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/stage1_5.c + +fsys_ext2fs.o: ../shared_src/fsys_ext2fs.c ../shared_src/filesys.h \ + ../shared_src/pc_slice.h ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/fsys_ext2fs.c + +# "asm.o" absolutely has to come first in the link line! +e2fs_stage1_5.exec: $(SHARED_OBJS) + $(LD) -N -Ttext 2000 -o $@ $(SHARED_OBJS) + +../bin/e2fs_stage1_5: e2fs_stage1_5.exec + $(OBJCOPY) -O binary -S $< $@ + +clean: + rm -f *.o *.exec diff --git a/fat_stage1_5/Makefile b/fat_stage1_5/Makefile new file mode 100644 index 000000000..9982ec371 --- /dev/null +++ b/fat_stage1_5/Makefile @@ -0,0 +1,46 @@ +# +# GRUB fat_stage1_5 makefile +# + +SHARED_FLAGS += -DFSYS_FAT -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ + -DCONFIG_FILE_ASM=".string \"/boot/grub/stage2\"" \ + -I../shared_src + +# There are problems inheriting flags that work fine with stage1 and stage2 +# so... don't use them at all! +CFLAGS= $(SHARED_FLAGS) + +# "asm.o" absolutely has to come first in the link line! +SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_fat.o + +all: ../bin/fat_stage1_5 + +asm.o: ../shared_src/asm.S ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/asm.S + +char_io.o: ../shared_src/char_io.c ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/char_io.c + +common.o: ../shared_src/common.c ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/common.c + +disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ + ../shared_src/pc_slice.h ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/disk_io.c + +stage1_5.o: ../shared_src/stage1_5.c ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/stage1_5.c + +fsys_fat.o: ../shared_src/fsys_fat.c ../shared_src/filesys.h \ + ../shared_src/pc_slice.h ../shared_src/shared.h + $(CC) $(CFLAGS) -c ../shared_src/fsys_fat.c + +# "asm.o" absolutely has to come first in the link line! +fat_stage1_5.exec: $(SHARED_OBJS) + $(LD) -N -Ttext 2000 -o $@ $(SHARED_OBJS) + +../bin/fat_stage1_5: fat_stage1_5.exec + $(OBJCOPY) -O binary -S $< $@ + +clean: + rm -f *.o *.exec diff --git a/ffs_stage1_5/Makefile b/ffs_stage1_5/Makefile index 067e2d313..10b1c1a6a 100644 --- a/ffs_stage1_5/Makefile +++ b/ffs_stage1_5/Makefile @@ -2,6 +2,7 @@ # GRUB ffs_stage1_5 makefile # +IMPORTANT_SIZE_LIMIT = 7168 CFLAGS= $(SHARED_FLAGS) -DFSYS_FFS -DNO_DECOMPRESSION -DNO_FANCY_STUFF \ -DNO_BLOCK_FILES -DCONFIG_FILE_ASM=".string \"/boot/grub/stage2\"" \ -I../shared_src @@ -11,40 +12,43 @@ SHARED_OBJS= asm.o char_io.o common.o disk_io.o stage1_5.o fsys_ffs.o all: ../bin/ffs_stage1_5 -asm.o: ../shared_src/asm.S ../shared_src/shared.h Makefile ../Makefile +asm.o: ../shared_src/asm.S ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/asm.S -char_io.o: ../shared_src/char_io.c ../shared_src/shared.h Makefile \ - ../Makefile +char_io.o: ../shared_src/char_io.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/char_io.c -common.o: ../shared_src/common.c ../shared_src/shared.h Makefile \ - ../Makefile +common.o: ../shared_src/common.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/common.c disk_io.o: ../shared_src/disk_io.c ../shared_src/filesys.h \ - ../shared_src/pc_slice.h ../shared_src/shared.h Makefile \ - ../Makefile + ../shared_src/pc_slice.h ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/disk_io.c -stage1_5.o: ../shared_src/stage1_5.c ../shared_src/shared.h Makefile \ - ../Makefile +stage1_5.o: ../shared_src/stage1_5.c ../shared_src/shared.h $(CC) $(CFLAGS) -c ../shared_src/stage1_5.c fsys_ffs.o: ../shared_src/fsys_ffs.c ../shared_src/filesys.h \ ../shared_src/pc_slice.h ../shared_src/shared.h \ ../shared_src/defs.h ../shared_src/disk_inode.h \ ../shared_src/disk_inode_ffs.h ../shared_src/dir.h \ - ../shared_src/fs.h Makefile ../Makefile + ../shared_src/fs.h $(CC) $(CFLAGS) -c ../shared_src/fsys_ffs.c # "asm.o" absolutely has to come first in the link line! -ffs_stage1_5.exec: $(SHARED_OBJS) Makefile ../Makefile - $(LD) -N -Ttext 2000 -o ffs_stage1_5.exec $(SHARED_OBJS) +ffs_stage1_5.exec: $(SHARED_OBJS) + $(LD) -N -Ttext 2000 -o $@ $(SHARED_OBJS) -../bin/ffs_stage1_5: ffs_stage1_5.exec Makefile ../Makefile - $(OBJCOPY) -O binary ffs_stage1_5.exec ../bin/ffs_stage1_5 +ffs_stage1_5: ffs_stage1_5.exec + $(OBJCOPY) -O binary $< $@ + +../bin/ffs_stage1_5: ffs_stage1_5 + @set dummy `wc $<`; size=$$4; \ + if test $$size -le $(IMPORTANT_SIZE_LIMIT); then \ + cp $< $@; \ + else \ + echo "WARNING: stage 1.5 is too big for boot block area ($$size > $(IMPORTANT_SIZE_LIMIT))."; \ + fi clean: - rm -f $(SHARED_OBJS) ffs_stage1_5.exec - + rm -f *.o *.exec ffs_stage1_5 diff --git a/mail b/mail new file mode 100644 index 000000000..7124b92d9 --- /dev/null +++ b/mail @@ -0,0 +1,155 @@ +From nobody Mon Feb 1 15:36:44 1999 +X-From-Line: debian-hurd-request@lists.debian.org Sat Jan 09 01:50:49 1999 +Return-Path: +Delivered-To: gord@trick.fig.org +Received: (qmail 25241 invoked from network); 9 Jan 1999 01:50:48 -0000 +Received: from gen2-93ip34.cadvision.com (HELO bambam.m-tech.ab.ca) (209.91.93.34) + by ip223.net247210.cr.sk.ca with SMTP; 9 Jan 1999 01:50:48 -0000 +Received: from murphy.novare.net (gateway [10.0.0.1]) + by bambam.m-tech.ab.ca (8.8.7/8.8.7) with SMTP id SAA19193 + for ; Fri, 8 Jan 1999 18:47:34 -0700 +Received: (qmail 13337 invoked by uid 38); 9 Jan 1999 01:47:33 -0000 +Resent-Date: 9 Jan 1999 01:47:32 -0000 +Resent-Cc: recipient list not shown: ; +X-Envelope-Sender: ege@rano.demon.co.uk +To: Matthias.Pfisterer@gmx.de +CC: debian-hurd@lists.debian.org +In-reply-to: <36966815.9DA7E110@rupert.informatik.uni-stuttgart.de> (message + from Matthias Pfisterer on Fri, 08 Jan 1999 21:18:29 +0100) +Subject: Re: Debian GNU/Hurd Base Set "gnu-19990104" available now! +From: edmundo@rano.demon.co.uk +Message-Id: +Sender: Edmund GRIMLEY EVANS +Date: Sat, 9 Jan 1999 00:45:52 +0000 +Resent-Message-ID: <"nJdi8B.A.LQD.zUrl2"@murphy> +Resent-From: debian-hurd@lists.debian.org +X-Mailing-List: archive/latest/581 +X-Loop: debian-hurd@lists.debian.org +Precedence: list +Resent-Sender: debian-hurd-request@lists.debian.org +Lines: 64 +Xref: trick.fig.org list.debian-hurd:748 + +> Also, there seems to be a problem booting from internal LS-120 drives. +> Normal operating systems (Windows...) can boot from internal drives if +> the BIOS can handle it. GRUB hangs when I try to boot from an ordinary +> 3,5" disk inserted into the LS-120. I've tested GRUB 0.4, but not +> further explored this issue. It may be a problem of GRUB, but perhaps it +> is a problem of the chipset or the BIOS. I will give a detailed report +> once I've tested it with the newest version of GRUB. + +I wrote about this problem earlier in debian-hurd (2 Dec). + +I hacked my copy of GRUB so that it works from my internal LS-120. I'm +copying the relevant paragraphs again, below. + +By the way, SYSLINUX boots off my LS-120 without problems: it applies +a different algorithm for deciding whether the device is a floppy or a +hard disc. Boot sectors can be quite amusing, really ... + +Edmund + + + +As I wrote before, the GRUB boot floppy provided with gnu-0.2.tar.gz +doesn't work off my LS120 IDE floppy. Neither does the 0.5 release of +GRUB, which I built from source. However, after many failed +experiments, I managed to modify grub-0.5's boot sector so that it +works with both my ordinary and my IDE floppies. (I include the patch +below, and I will tell Erich about my experiences.) + +... + +My GRUB patch: + +It's just a hack, not a serious attempt to improve the software, but it +did give a floppy that boots off both my ordinary and my IDE floppy drives. + +In grub-0.5/stage1/stage1.S the patch is: + +< andb $BIOS_HD_FLAG, %al +< +< /* jz floppy_probe */ +< .byte 0x0f, 0x84; REL(floppy_probe) +--- +> orb $BIOS_HD_FLAG, %al +> +> /* jz floppy_probe */ +> .byte 0x0f, 0x84; REL(floppy_probe) + +If you prefer to patch the binary boot sector, the change is: + +< 24 80 +--- +> 0c 80 + +That's at address 0x55 in grub-0.5/bin/stage1; the address is +different, no doubt, in the Hurd's boot floppy, which is based on an +earlier release of GRUB, but the same change might work for that too. + +Edmund + + +-- +To UNSUBSCRIBE, email to debian-hurd-request@lists.debian.org +with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org + +To: Erich Boleyn +cc: debian-hurd@lists.debian.org +Subject: GRUB installation thoughts +X-Attribution: Gord +Gcc: nnml:archive +Mime-Version: 1.0 (generated by tm-edit 7.106) +Content-Type: text/plain; charset=US-ASCII +From: Gordon Matzigkeit +Date: 02 Feb 1999 13:24:24 -0600 +Message-ID: <86iudk1udz.fsf@trick.fig.org> +Lines: 47 +--text follows this line-- +Hi! + +I've been thinking about GRUB and how to make installation easier. +Here is my plan of how Debian GNU/Hurd installation should work: + +1) Boot from floppy or CD or whatever, and GRUB starts. You get + a menu like this: + + Install Debian GNU/Hurd + Boot an installed Debian GNU/Hurd system + Install GRUB + +2) Go through a typical Debian installation. The install process will + ask you to mark your partition(s) as type 63 (currently reserved + for the GNU Hurd, for some odd reason... I wonder how that + happened?). + +3) When the base set is installed, the system reboots from the floppy + again. At that point, all the other menu options should work. + +I'd like to implement a GRUB feature so that `(hd:0x63)' means `the +first hard disk partition that is of type 0x63'. + +So, the floppy's menu.lst can look something like this: + +title = Install Debian GNU/Hurd +root = (fd0) +kernel = /boot/gnumach.gz + +title = Boot an installed Debian GNU/Hurd system +root = (hd:0x63) +kernel = /boot/gnumach.gz + +title = Install GRUB in the Debian GNU/Hurd root partition +root = (hd:0x63) +install= (fd0)+1 (hd:0x63) (hd:0x63)/boot/grub/fs_stage1_5 0x2000 p + +The last bit of magic is to make sure gnumach uses the Multiboot +`boot_device' parameter as its default root, so that we don't need to +specify a root= option to Mach. + +Comments? + +-- + Gordon Matzigkeit //\ I'm a FIG (http://www.fig.org/) + Lovers of freedom, unite! \// I use GNU (http://www.gnu.org/) +[Unfortunately, www.fig.org is broken. Please stay tuned for details.] diff --git a/shared_src/asm.S b/shared_src/asm.S index f53cbac9d..652b581da 100644 --- a/shared_src/asm.S +++ b/shared_src/asm.S @@ -25,33 +25,23 @@ .text - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ + /* Tell GAS to generate 16-bit instructions so that this code works + in real mode. */ .code16 ENTRY(start) /* - * "start" should be loaded at 0x0:$STARTADDR. This next - * is to guarantee that. + * Guarantee that "start" is loaded at 0x0:0x8000. */ - - /* ljmp $0, $codestart */ - .byte 0xea - .word 0x8070, 0 - - /* padding */ - .byte 0 + ljmp $0, $(codestart - EXT_C(start) + 0x8000) /* * Compatibility version number * * These MUST be at byte offset 6 and 7 of the executable - * * DO NOT MOVE !!! */ + . = EXT_C(start) + 0x6 .byte COMPAT_VERSION_MAJOR, COMPAT_VERSION_MINOR /* @@ -77,7 +67,7 @@ VARIABLE(config_file) . = EXT_C(start) + 0x70 -/* the code continues... */ +/* the real mode code continues... */ codestart: cli /* we're not safe here! */ @@ -88,24 +78,23 @@ codestart: movw %ax, %es /* set up the real mode/BIOS stack */ - movl $STACKOFF, %esp movl $STACKOFF, %ebp + movl %ebp, %esp sti /* we're safe again */ /* save boot drive reference */ + addr32 movb %dl, EXT_C(boot_drive) /* reset disk system (%ah = 0) */ - int $13 + int $0x13 /* transition to protected mode */ + data32 call EXT_C(real_to_prot) - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ + /* The ".code32" directive takes GAS out of 16-bit mode. */ .code32 /* @@ -169,20 +158,11 @@ ENTRY(chain_stage1) movb EXT_C(boot_drive), %dl call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 + data32 + addr32 ljmp (offset) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 @@ -218,23 +198,14 @@ ENTRY(chain_stage2) movb EXT_C(boot_drive), %dl call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 + data32 + addr32 ljmp (offset) - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 - /* * These next two routines, "real_to_prot" and "prot_to_real" are structured * in a very specific way. Be very careful when changing them. @@ -243,16 +214,16 @@ ENTRY(chain_stage2) */ ENTRY(real_to_prot) + .code16 cli /* load the GDT register */ - addr32 data32 + addr32 lgdt gdtdesc /* turn on protected mode */ movl %cr0, %eax - data32 orl $CR0_PE_ON, %eax movl %eax, %cr0 @@ -260,6 +231,12 @@ ENTRY(real_to_prot) data32 ljmp $PROT_MODE_CSEG, $protcseg + /* + * The ".code32" directive only works in GAS, the GNU assembler! + * This gets out of "16-bit" mode. + */ + .code32 + protcseg: /* reload other segment registers */ movw $PROT_MODE_DSEG, %ax @@ -318,9 +295,10 @@ ENTRY(prot_to_real) ljmp $PSEUDO_RM_CSEG, $tmpcseg /* jump to a 16 bit segment */ tmpcseg: + .code16 + /* clear the PE bit of CR0 */ movl %cr0, %eax - data32 andl $CR0_PE_OFF, %eax movl %eax, %cr0 @@ -328,13 +306,6 @@ tmpcseg: data32 ljmp $0, $realcseg - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ - .code16 - realcseg: /* we are in real mode now * set up the real mode segment registers : DS, SS, ES @@ -352,12 +323,9 @@ realcseg: sti /* return on new stack! */ + data32 ret - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 @@ -443,18 +411,13 @@ disk_use_standard_bios: movw 0x1c(%ebp), %bx /* segment */ call EXT_C(prot_to_real) /* enter real mode */ - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movw %bx, %es /* load segment */ /* * Shift num sectors and subfunction back */ + data32 shrl $16, %ebx pushw %bx /* save num sectors */ xorw %bx, %bx @@ -472,6 +435,7 @@ disk_loop: movb $0, %bl /* did we actually succeed? */ + data32 jnc disk_exit_16 /* do we try again? */ @@ -479,18 +443,15 @@ disk_loop: cmpw $0, %si /* if this isn't the third try, go again */ + data32 jne disk_loop /* save return value */ movb %ah, %bl disk_exit_16: + data32 call EXT_C(real_to_prot) /* back to protected mode */ - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 movb %bl, %al /* return value in %eax */ @@ -524,16 +485,11 @@ ENTRY(get_diskinfo) movw 0x8(%ebp), %dx /* diskinfo(drive #) */ call EXT_C(prot_to_real) /* enter real mode */ - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movb %dl, %al andb $0x80, %al + data32 jnz hard_drive /* @@ -548,13 +504,12 @@ probe_loop: int $0x13 incw %si - - /* movb (%si), %cl */ - .byte 0x8A, 0x0C + movb (%si), %cl /* if number of sectors is 0, display error and die */ cmpb $0, %cl + data32 je probe_failed /* perform read */ @@ -566,12 +521,14 @@ probe_loop: movb $0, %dh int $0x13 + data32 jc probe_loop /* %cl is already the correct value! */ movb $1, %dh movb $79, %ch + data32 jmp probe_success probe_values: @@ -581,6 +538,7 @@ hard_drive: movb $0x8, %ah /* ask for disk info */ int $0x13 + data32 jc probe_failed /* es:di = parameter table */ @@ -595,7 +553,8 @@ probe_success: * 8 bit sector */ movb %cl, %al /* Upper two bits of cylinder count */ - andl $192,%eax + andl $192,%eax + addr32 leal 0(,%eax,4),%eax /* << 2 */ movb %ch, %al /* Lower 8 bits */ sall $16,%eax /* << 16 */ @@ -604,6 +563,7 @@ probe_success: movb %cl, %al /* max sector (and # sectors) */ movl %eax, %ebx /* save return value */ + data32 jmp got_drive probe_failed: @@ -617,12 +577,8 @@ probe_failed: movl $0, %ebx /* not present value */ got_drive: + data32 call EXT_C(real_to_prot) /* back to protected mode */ - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 /* set up return in correct register */ @@ -668,12 +624,6 @@ ENTRY(putchar) pc_notnewline: call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movb %bl, %al @@ -681,12 +631,8 @@ pc_notnewline: movw $1, %bx int $0x10 + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 pop %ebx @@ -712,18 +658,14 @@ ENTRY(get_memsize) mov 0xc(%esp), %ebx call EXT_C(prot_to_real) /* enter real mode */ - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 cmpb $0x1, %bl + data32 je xext - + int $0x12 + data32 jmp xdone xext: @@ -733,12 +675,8 @@ xext: xdone: movw %ax, %bx + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 movw %bx, %ax @@ -767,12 +705,6 @@ ENTRY(get_eisamemsize) push %edx call EXT_C(prot_to_real) /* enter real mode */ - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movw $0xe801, %ax @@ -781,12 +713,8 @@ ENTRY(get_eisamemsize) shll $16, %ebx movw %ax, %bx + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 movl $0xFFFFFFFF, %eax @@ -842,41 +770,36 @@ ENTRY(get_mem_map) movl $0x534d4150, %edx call EXT_C(prot_to_real) /* enter real mode */ - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movw %si, %es movw $0xe820, %ax int $0x15 + data32 jc xnosmap cmpl $0x534d4150, %eax + data32 jne xnosmap cmpl $0x14, %ecx + data32 jl xnosmap cmpl $0x400, %ecx + data32 jg xnosmap + data32 jmp xsmap xnosmap: movl $0, %ecx xsmap: + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 /* write length of buffer (zero if error) into "addr" */ @@ -948,17 +871,19 @@ gloop2ret: #ifdef DEBUG +ENTRY(patch_code) /* labels start with "pc_" */ .code16 -ENTRY(patch_code) /* labels start with "pc_" */ mov %cs, %ax mov %ax, %ds mov %ax, %es mov %ax, %fs mov %ax, %gs + addr32 movl $0, 0 pc_stop: hlt + data32 jmp pc_stop ENTRY(patch_code_end) @@ -1002,12 +927,6 @@ ENTRY(big_linux_boot) movl %eax, offset call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 /* final setup for linux boot */ @@ -1017,12 +936,9 @@ ENTRY(big_linux_boot) movw %ax, %ss /* jump to start */ + data32 + addr32 ljmp (offset) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 @@ -1064,12 +980,6 @@ ENTRY(cls) push %ebx /* save EBX */ call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movb $0xf, %ah @@ -1077,12 +987,8 @@ ENTRY(cls) xorb %ah, %ah int $0x10 /* Set Video mode (clears screen) */ + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 pop %ebx @@ -1110,24 +1016,14 @@ ENTRY(getxy) push %edx call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 xorb %bh, %bh /* set page to 0 */ movb $0x3, %ah int $0x10 /* get cursor position */ + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 movb %dl, %ah @@ -1160,24 +1056,14 @@ ENTRY(gotoxy) movb 0x18(%esp), %dh /* %dh = y */ call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 xorb %bh, %bh /* set page to 0 */ movb $0x2, %ah int $0x10 /* set cursor position */ + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 pop %edx @@ -1232,12 +1118,6 @@ ENTRY(set_attrib) xorl %ebx, %ebx call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movb $0x8, %ah @@ -1247,12 +1127,8 @@ ENTRY(set_attrib) movw $1, %cx int $0x10 + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 pop %ecx @@ -1286,27 +1162,18 @@ ENTRY(getrtsecs) push %edx call EXT_C(prot_to_real) /* enter real mode */ - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movb $0x2, %ah int $0x1a + data32 jnc gottime movb $0xff, %dh gottime: + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 movb %dh, %al @@ -1330,24 +1197,14 @@ ENTRY(asm_getkey) push %ebx /* save %ebx */ call EXT_C(prot_to_real) - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 int $0x16 movw %ax, %bx /* real_to_prot uses %eax */ + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 movw %bx, %ax @@ -1377,31 +1234,23 @@ ENTRY(checkkey) xorl %ebx, %ebx call EXT_C(prot_to_real) /* enter real mode */ - - /* - * The ".code16" directive only works in GAS, the GNU assembler! - * This adds 32-bit data or addressing directives so that this - * code will work in real mode! - */ .code16 movb $0x1, %ah int $0x16 + data32 jz notpending movw %ax, %bx + data32 jmp pending notpending: movl $0xFFFFFFFF, %ebx pending: + data32 call EXT_C(real_to_prot) - - /* - * The ".code32" directive only works in GAS, the GNU assembler! - * This gets out of "16-bit" mode. - */ .code32 mov %ebx, %eax @@ -1477,5 +1326,3 @@ gdt: gdtdesc: .word 0x27 /* limit */ .long gdt /* addr */ - -