From f85b90abd2073c769ea4f9e49ab618428c60ddfc Mon Sep 17 00:00:00 2001 From: okuji Date: Sat, 27 May 2000 07:40:53 +0000 Subject: [PATCH] add diskless support. --- AUTHORS | 2 + ChangeLog | 51 ++++++++ NEWS | 4 + THANKS | 1 + configure | 182 ++++++++++++++++------------- configure.in | 11 ++ stage2/Makefile.am | 56 ++++++++- stage2/Makefile.in | 281 ++++++++++++++++++++++++++++++++++++++++++--- stage2/asm.S | 8 +- stage2/common.c | 41 +++++-- stage2/nbi.h | 27 +++++ stage2/nbloader.S | 49 ++++++++ stage2/pxeloader.S | 36 ++++++ 13 files changed, 643 insertions(+), 106 deletions(-) create mode 100644 stage2/nbi.h create mode 100644 stage2/nbloader.S create mode 100644 stage2/pxeloader.S diff --git a/AUTHORS b/AUTHORS index 31d663a15..300832d0c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -28,3 +28,5 @@ Per Lundberg added graphics support to the Multiboot Specification. Jochen Hoenicke rewrote stage2/fsys_fat.c and wrote stage2/fsys_reiserfs.c. + +Christoph Plattner added support for Net Boot Image Proposal. diff --git a/ChangeLog b/ChangeLog index e2f8be269..5d5b96c79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,54 @@ +2000-05-27 OKUJI Yoshinori + + Add diskless support, mostly based on patches by Christoph + Plattner , but also based on a patch + by Chip Salzenberg for PXE. Of course, I've + modified both the patches thoroughly to adapt them to my + preference. + + * configure.in (--enable-diskless): New option. Set a + conditional DISKLESS_SUPPORT. + * stage2/Makefile.am (noinst_HEADERS): Added nbi.h. + (EXTRA_PROGRAMS): New variable. + (pkgdata_DATA) [DISKLESS_SUPPORT]: Added + nbgrub and pxegrub. + (noinst_DATA) [DISKLESS_SUPPORT]: Added nbloader, pxeloader and + diskless. + (noinst_PROGRAMS) [DISKLESS_SUPPORT]: Added nbloader.exec, + pxeloader.exec and diskless.exec. + (PXELOADER_LINK): New variable. + (BUILT_SOURCES) [DISKLESS_SUPPORT]: Added diskless_size.h. + (diskless_exec_SOURCES): New variable. + (diskless_exec_CFLAGS): Likewise. + (diskless_exec_LDFLAGS): Likewise. + (diskless_exec_LDADD): Likewise. + (diskless_size.h): New target. + (nbloader_exec_SOURCES): New variable. + (nbloader_exec_CFLAGS): Likewise. + (nbloader_exec_LDFLAGS): Likewise. + (nbloader_exec-nbloader.o): New dependency. + (nbgrub): New target. + (pxeloader_exec_SOURCES): new variable. + (pxeloader_exec_CFLAGS): Likewise. + (pxeloader_exec_LDFLAGS): Likewise. + (pxegrub): New target. + * stage2/asm.S (install_partition): Set to 0xFFFFFF instead of + 0x020000. What was the benefit from the previous setting? + (codestart) [SUPPORT_DISKLESS]: Don't move %dl to BOOT_DRIVE. + (boot_drive) [SUPPORT_DISKLESS]: Set to NETWORK_DRIVE instead of + zero. + * stage2/common.c: Include instead of "shared.h", + just for a cosmetic reason. + [SUPPORT_DISKLESS]: Include etherboot.h. + [SUPPORT_DISKLESS] (setup_diskless_environment): New internal + function. + (init_bios_info) [SUPPORT_DISKLESS]: Call + setup_diskless_environment after the memory initialization is + finished. Return if fails. + * stage2/nbloader.S: New file. + * stage2/pxeloader.S: Likewise. + * stage2/nbi.h: Likewise. + 2000-05-25 OKUJI Yoshinori * netboot/fsys_tftp.c (buf_fill): Warn when amazing things diff --git a/NEWS b/NEWS index 561b0d0c9..14165a938 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,10 @@ New in 0.5.95 - XXXX-XX-XX: enters a correct password. * Recognize the Linux extended partition type. * Pass a correct memory size to Linux and *BSD. +* Diskless support is added. Now configure accepts --enable-diskless, + and "make" will produce two additional images, ``nbgrub'' for Net Boot + Image Proposal and ``pxegrub'' for Preboot Execution Environment. See + the documentation, for more details. New in 0.5.94 - 2000-03-06: * Stage 1 supports both the LBA mode and the CHS mode. diff --git a/THANKS b/THANKS index c7cd75535..bc165335e 100644 --- a/THANKS +++ b/THANKS @@ -12,6 +12,7 @@ Bradford Hovinen Brian Brunswick Bryan Ford Chip Salzenberg +Christoph Plattner Dan J. Walters Edmund GRIMLEY EVANS Edward Killips diff --git a/configure b/configure index fb7034a83..e100f65fd 100644 --- a/configure +++ b/configure @@ -109,6 +109,8 @@ ac_help="$ac_help set the default memory location for WD/SMC" ac_help="$ac_help --enable-cs-scan=LIST probe for CS89x0 base address using LIST" +ac_help="$ac_help + --enable-diskless enable diskless support" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -650,7 +652,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:654: checking for a BSD compatible install" >&5 +echo "configure:656: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -703,7 +705,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 -echo "configure:707: checking whether build environment is sane" >&5 +echo "configure:709: checking whether build environment is sane" >&5 # Just in case sleep 1 echo timestamp > conftestfile @@ -775,7 +777,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:779: checking for $ac_word" >&5 +echo "configure:781: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -805,7 +807,7 @@ test -n "$AWK" && break done echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:809: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:811: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -931,7 +933,7 @@ else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } fi echo $ac_n "checking host system type""... $ac_c" 1>&6 -echo "configure:935: checking host system type" >&5 +echo "configure:937: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -965,7 +967,7 @@ esac # echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 -echo "configure:969: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo "configure:971: checking whether to enable maintainer-specific portions of Makefiles" >&5 # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then enableval="$enable_maintainer_mode" @@ -991,7 +993,7 @@ if test "x$enable_maintainer_mode" = xyes; then # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:995: checking for $ac_word" >&5 +echo "configure:997: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1038,7 +1040,7 @@ fi # echo $ac_n "checking build system type""... $ac_c" 1>&6 -echo "configure:1042: checking build system type" >&5 +echo "configure:1044: checking build system type" >&5 build_alias=$build case "$build_alias" in @@ -1064,7 +1066,7 @@ fi # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1068: checking for $ac_word" >&5 +echo "configure:1070: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1096,7 +1098,7 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1100: checking for $ac_word" >&5 +echo "configure:1102: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1126,7 +1128,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1130: checking for $ac_word" >&5 +echo "configure:1132: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1177,7 +1179,7 @@ fi # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1181: checking for $ac_word" >&5 +echo "configure:1183: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1209,7 +1211,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:1213: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:1215: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -1220,12 +1222,12 @@ cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext << EOF -#line 1224 "configure" +#line 1226 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:1229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -1251,12 +1253,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:1255: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:1257: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:1260: checking whether we are using GNU C" >&5 +echo "configure:1262: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1265,7 +1267,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1269: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1271: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -1284,7 +1286,7 @@ ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:1288: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:1290: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1317,7 +1319,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:1321: checking how to run the C preprocessor" >&5 +echo "configure:1323: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -1332,13 +1334,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1342: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1344: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1349,13 +1351,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1361: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1366,13 +1368,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1376: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -1405,7 +1407,7 @@ echo "$ac_t""$CPP" 1>&6 depcc="$CC" depcpp="$CPP" echo $ac_n "checking dependency style of $depcc""... $ac_c" 1>&6 -echo "configure:1409: checking dependency style of $depcc" >&5 +echo "configure:1411: checking dependency style of $depcc" >&5 if eval "test \"`echo '$''{'am_cv_CC_dependencies_compiler_type'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1461,7 +1463,7 @@ if test "x$with_binutils" != x; then # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1465: checking for $ac_word" >&5 +echo "configure:1467: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1498,7 +1500,7 @@ else # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1502: checking for $ac_word" >&5 +echo "configure:1504: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1538,7 +1540,7 @@ if test "x$ac_cv_prog_gcc" = xyes; then STAGE1_CFLAGS="-O2" GRUB_CFLAGS="-O2" echo $ac_n "checking whether optimization for size works""... $ac_c" 1>&6 -echo "configure:1542: checking whether optimization for size works" >&5 +echo "configure:1544: checking whether optimization for size works" >&5 if eval "test \"`echo '$''{'size_flag'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1546,14 +1548,14 @@ else saved_CFLAGS=$CFLAGS CFLAGS="-Os -g" cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1559: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* size_flag=yes else @@ -1587,7 +1589,7 @@ if test "x$with_binutils" != x; then # Extract the first word of "objcopy", so it can be a program name with args. set dummy objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1591: checking for $ac_word" >&5 +echo "configure:1593: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1623,7 +1625,7 @@ else # Extract the first word of "${ac_tool_prefix}objcopy", so it can be a program name with args. set dummy ${ac_tool_prefix}objcopy; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1627: checking for $ac_word" >&5 +echo "configure:1629: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_OBJCOPY'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1657,7 +1659,7 @@ fi # Defined in acinclude.m4. echo $ac_n "checking if C symbols get an underscore after compilation""... $ac_c" 1>&6 -echo "configure:1661: checking if C symbols get an underscore after compilation" >&5 +echo "configure:1663: checking if C symbols get an underscore after compilation" >&5 if eval "test \"`echo '$''{'grub_cv_asm_uscore'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1670,7 +1672,7 @@ func (int *list) } EOF -if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'; { (eval echo configure:1674: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then +if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c'; { (eval echo configure:1676: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.s; then true else { echo "configure: error: ${CC-cc} failed to produce assembly code" 1>&2; exit 1; } @@ -1696,7 +1698,7 @@ fi echo "$ac_t""$grub_cv_asm_uscore" 1>&6 echo $ac_n "checking whether ${OBJCOPY} works for absolute addresses""... $ac_c" 1>&6 -echo "configure:1700: checking whether ${OBJCOPY} works for absolute addresses" >&5 +echo "configure:1702: checking whether ${OBJCOPY} works for absolute addresses" >&5 if eval "test \"`echo '$''{'grub_cv_prog_objcopy_absolute'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1708,21 +1710,21 @@ cmain (void) } EOF -if { (eval echo configure:1712: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then : +if { (eval echo configure:1714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.o; then : else { echo "configure: error: ${CC-cc} cannot compile C source code" 1>&2; exit 1; } fi grub_cv_prog_objcopy_absolute=yes for link_addr in 2000 8000 7C00; do - if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'; { (eval echo configure:1718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : + if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'; { (eval echo configure:1720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : else { echo "configure: error: ${CC-cc} cannot link at address $link_addr" 1>&2; exit 1; } fi - if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : + if { ac_try='${OBJCOPY-objcopy} -O binary conftest.exec conftest'; { (eval echo configure:1724: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then : else { echo "configure: error: ${OBJCOPY-objcopy} cannot create binary files" 1>&2; exit 1; } fi - if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1726: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then + if test ! -f conftest.old || { ac_try='cmp -s conftest.old conftest'; { (eval echo configure:1728: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then mv -f conftest conftest.old else grub_cv_prog_objcopy_absolute=no @@ -1739,7 +1741,7 @@ fi echo $ac_n "checking whether addr32 must be in the same line as the instruction""... $ac_c" 1>&6 -echo "configure:1743: checking whether addr32 must be in the same line as the instruction" >&5 +echo "configure:1745: checking whether addr32 must be in the same line as the instruction" >&5 if eval "test \"`echo '$''{'grub_cv_asm_prefix_requirement'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1748,7 +1750,7 @@ else l1: addr32 movb %al, l1 EOF -if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then +if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1754: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then grub_cv_asm_prefix_requirement=yes else grub_cv_asm_prefix_requirement=no @@ -1780,7 +1782,7 @@ echo "$ac_t""$grub_cv_asm_prefix_requirement" 1>&6 echo $ac_n "checking for .code16 addr32 assembler support""... $ac_c" 1>&6 -echo "configure:1784: checking for .code16 addr32 assembler support" >&5 +echo "configure:1786: checking for .code16 addr32 assembler support" >&5 if eval "test \"`echo '$''{'grub_cv_asm_addr32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1795,7 +1797,7 @@ else sed -e s/@ADDR32@/addr32\;/ < conftest.s.in > conftest.s fi -if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then +if { ac_try='${CC-cc} ${CFLAGS} -c conftest.s'; { (eval echo configure:1801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } && test -s conftest.o; then grub_cv_asm_addr32=yes else grub_cv_asm_addr32=no @@ -1812,19 +1814,19 @@ fi echo $ac_n "checking if start is defined by the compiler""... $ac_c" 1>&6 -echo "configure:1816: checking if start is defined by the compiler" >&5 +echo "configure:1818: checking if start is defined by the compiler" >&5 if eval "test \"`echo '$''{'grub_cv_check_start_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* grub_cv_check_start_symbol=yes else @@ -1848,19 +1850,19 @@ echo "$ac_t""$grub_cv_check_start_symbol" 1>&6 echo $ac_n "checking if _start is defined by the compiler""... $ac_c" 1>&6 -echo "configure:1852: checking if _start is defined by the compiler" >&5 +echo "configure:1854: checking if _start is defined by the compiler" >&5 if eval "test \"`echo '$''{'grub_cv_check_uscore_start_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* grub_cv_check_uscore_start_symbol=yes else @@ -1889,19 +1891,19 @@ fi echo $ac_n "checking if __bss_start is defined by the compiler""... $ac_c" 1>&6 -echo "configure:1893: checking if __bss_start is defined by the compiler" >&5 +echo "configure:1895: checking if __bss_start is defined by the compiler" >&5 if eval "test \"`echo '$''{'grub_cv_check_uscore_uscore_bss_start_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* grub_cv_check_uscore_uscore_bss_start_symbol=yes else @@ -1925,19 +1927,19 @@ echo "$ac_t""$grub_cv_check_uscore_uscore_bss_start_symbol" 1>&6 echo $ac_n "checking if _edata is defined by the compiler""... $ac_c" 1>&6 -echo "configure:1929: checking if _edata is defined by the compiler" >&5 +echo "configure:1931: checking if _edata is defined by the compiler" >&5 if eval "test \"`echo '$''{'grub_cv_check_uscore_edata_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* grub_cv_check_uscore_edata_symbol=yes else @@ -1961,19 +1963,19 @@ echo "$ac_t""$grub_cv_check_uscore_edata_symbol" 1>&6 echo $ac_n "checking if edata is defined by the compiler""... $ac_c" 1>&6 -echo "configure:1965: checking if edata is defined by the compiler" >&5 +echo "configure:1967: checking if edata is defined by the compiler" >&5 if eval "test \"`echo '$''{'grub_cv_check_edata_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* grub_cv_check_edata_symbol=yes else @@ -2003,19 +2005,19 @@ fi echo $ac_n "checking if end is defined by the compiler""... $ac_c" 1>&6 -echo "configure:2007: checking if end is defined by the compiler" >&5 +echo "configure:2009: checking if end is defined by the compiler" >&5 if eval "test \"`echo '$''{'grub_cv_check_end_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* grub_cv_check_end_symbol=yes else @@ -2039,19 +2041,19 @@ echo "$ac_t""$grub_cv_check_end_symbol" 1>&6 echo $ac_n "checking if _end is defined by the compiler""... $ac_c" 1>&6 -echo "configure:2043: checking if _end is defined by the compiler" >&5 +echo "configure:2045: checking if _end is defined by the compiler" >&5 if eval "test \"`echo '$''{'grub_cv_check_uscore_end_symbol'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* grub_cv_check_uscore_end_symbol=yes else @@ -2089,7 +2091,7 @@ fi # Get the filename or the whole disk and open it. # Known to work on NetBSD. echo $ac_n "checking for opendisk in -lutil""... $ac_c" 1>&6 -echo "configure:2093: checking for opendisk in -lutil" >&5 +echo "configure:2095: checking for opendisk in -lutil" >&5 ac_lib_var=`echo util'_'opendisk | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2097,7 +2099,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lutil $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2114: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2136,7 +2138,7 @@ fi # Unless the user specify --without-curses, check for curses. if test "x$with_curses" != "xno"; then echo $ac_n "checking for wgetch in -lncurses""... $ac_c" 1>&6 -echo "configure:2140: checking for wgetch in -lncurses" >&5 +echo "configure:2142: checking for wgetch in -lncurses" >&5 ac_lib_var=`echo ncurses'_'wgetch | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2144,7 +2146,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lncurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2161: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2178,7 +2180,7 @@ EOF else echo "$ac_t""no" 1>&6 echo $ac_n "checking for wgetch in -lcurses""... $ac_c" 1>&6 -echo "configure:2182: checking for wgetch in -lcurses" >&5 +echo "configure:2184: checking for wgetch in -lcurses" >&5 ac_lib_var=`echo curses'_'wgetch | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2186,7 +2188,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2232,17 +2234,17 @@ for ac_hdr in string.h strings.h ncurses/curses.h ncurses.h curses.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2236: checking for $ac_hdr" >&5 +echo "configure:2238: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2246: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2248: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2731,6 +2733,28 @@ if test "${enable_cs_scan+set}" = set; then fi +# Check whether --enable-diskless or --disable-diskless was given. +if test "${enable_diskless+set}" = set; then + enableval="$enable_diskless" + : +fi + + + +if test "x$enable_diskless" = xyes; then + DISKLESS_SUPPORT_TRUE= + DISKLESS_SUPPORT_FALSE='#' +else + DISKLESS_SUPPORT_TRUE='#' + DISKLESS_SUPPORT_FALSE= +fi + +# Sanity check. +if test "x$enable_diskless" = xyes; then + if test "x$NET_CFLAGS" = x; then + { echo "configure: error: You must enable at least one network driver" 1>&2; exit 1; } + fi +fi @@ -2915,6 +2939,8 @@ s%@OBJCOPY@%$OBJCOPY%g s%@GRUB_LIBS@%$GRUB_LIBS%g s%@NETBOOT_SUPPORT_TRUE@%$NETBOOT_SUPPORT_TRUE%g s%@NETBOOT_SUPPORT_FALSE@%$NETBOOT_SUPPORT_FALSE%g +s%@DISKLESS_SUPPORT_TRUE@%$DISKLESS_SUPPORT_TRUE%g +s%@DISKLESS_SUPPORT_FALSE@%$DISKLESS_SUPPORT_FALSE%g s%@FSYS_CFLAGS@%$FSYS_CFLAGS%g s%@NET_CFLAGS@%$NET_CFLAGS%g s%@NET_EXTRAFLAGS@%$NET_EXTRAFLAGS%g diff --git a/configure.in b/configure.in index 93091191a..fe09bbae1 100644 --- a/configure.in +++ b/configure.in @@ -464,6 +464,17 @@ AC_ARG_ENABLE(cs-scan, [ --enable-cs-scan=LIST probe for CS89x0 base address using LIST], [NET_EXTRAFLAGS="$NET_EXTRAFLAGS -DCS_SCAN=$enable_cs_scan"]) +dnl Diskless +AC_ARG_ENABLE(diskless, + [ --enable-diskless enable diskless support]) +AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes) + +# Sanity check. +if test "x$enable_diskless" = xyes; then + if test "x$NET_CFLAGS" = x; then + AC_MSG_ERROR([You must enable at least one network driver]) + fi +fi dnl Now substitute the variables. AC_SUBST(FSYS_CFLAGS) diff --git a/stage2/Makefile.am b/stage2/Makefile.am index 09dc403f3..cfa69a75e 100644 --- a/stage2/Makefile.am +++ b/stage2/Makefile.am @@ -5,7 +5,7 @@ noinst_SCRIPTS = $(TESTS) # For dist target. noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ fat.h filesys.h freebsd.h fs.h i386-elf.h imgact_aout.h \ - mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h + mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h nbi.h EXTRA_DIST = $(noinst_SCRIPTS) # For . @@ -22,16 +22,30 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \ # Stage 2 and Stage 1.5's. pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) + +EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec + +if DISKLESS_SUPPORT +pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ + minix_stage1_5 reiserfs_stage1_5 nbgrub pxegrub +noinst_DATA = pre_stage2 start nbloader pxeloader diskless +noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \ + fat_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec \ + reiserfs_stage1_5.exec nbloader.exec pxeloader.exec \ + diskless.exec +else pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ minix_stage1_5 reiserfs_stage1_5 noinst_DATA = pre_stage2 start noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \ fat_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec \ reiserfs_stage1_5.exec +endif MOSTLYCLEANFILES = $(noinst_PROGRAMS) PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 +PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 if NETBOOT_SUPPORT STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 @@ -54,7 +68,12 @@ if NETBOOT_SUPPORT pre_stage2_exec_LDADD = ../netboot/libdrivers.a endif +if DISKLESS_SUPPORT +BUILT_SOURCES = stage2_size.h diskless_size.h +else BUILT_SOURCES = stage2_size.h +endif + CLEANFILES = $(pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES) stage2_size.h: pre_stage2 @@ -112,6 +131,41 @@ reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ -DNO_BLOCK_FILES=1 reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) +# For diskless target. +diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) +diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ + -DSUPPORT_DISKLESS=1 +diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) +diskless_exec_LDADD = ../netboot/libdrivers.a + +diskless_size.h: diskless + -rm -f $@ + set dummy `ls -l $^`; \ + echo "#define DISKLESS_SIZE $$6" > $@ + +# For nbloader target. +nbloader_exec_SOURCES = nbloader.S +nbloader_exec_CFLAGS = $(STAGE2_COMPILE) +nbloader_exec_LDFLAGS = $(START_LINK) + +# XXX: See the comment for start_exec-start.o. +nbloader_exec-nbloader.o: diskless_size.h + +# For nbgrub target. +nbgrub: nbloader diskless + -rm -f $@ + cat $^ > $@ + +# For pxeloader target. +pxeloader_exec_SOURCES = pxeloader.S +pxeloader_exec_CFLAGS = $(STAGE2_COMPILE) +pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) + +# For pxegrub target. +pxegrub: pxeloader diskless + -rm -f $@ + cat $^ > $@ + # General rule for making a raw binary. %: %.exec $(OBJCOPY) -O binary $< $@ diff --git a/stage2/Makefile.in b/stage2/Makefile.in index e2c3e843b..39f5dcdd7 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -93,7 +93,7 @@ noinst_SCRIPTS = $(TESTS) # For dist target. noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ fat.h filesys.h freebsd.h fs.h i386-elf.h imgact_aout.h \ - mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h + mb_header.h mb_info.h pc_slice.h shared.h smp-imps.h nbi.h EXTRA_DIST = $(noinst_SCRIPTS) @@ -113,18 +113,26 @@ libgrub_a_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 \ # Stage 2 and Stage 1.5's. pkgdatadir = $(datadir)/$(PACKAGE)/$(host_cpu)-$(host_vendor) -pkgdata_DATA = stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ - minix_stage1_5 reiserfs_stage1_5 - -noinst_DATA = pre_stage2 start -noinst_PROGRAMS = pre_stage2.exec start.exec e2fs_stage1_5.exec \ - fat_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec \ - reiserfs_stage1_5.exec +EXTRA_PROGRAMS = nbloader.exec pxeloader.exec diskless.exec +@DISKLESS_SUPPORT_TRUE@pkgdata_DATA = @DISKLESS_SUPPORT_TRUE@stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ +@DISKLESS_SUPPORT_TRUE@ minix_stage1_5 reiserfs_stage1_5 nbgrub pxegrub +@DISKLESS_SUPPORT_FALSE@pkgdata_DATA = @DISKLESS_SUPPORT_FALSE@stage2 e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \ +@DISKLESS_SUPPORT_FALSE@ minix_stage1_5 reiserfs_stage1_5 +@DISKLESS_SUPPORT_TRUE@noinst_DATA = @DISKLESS_SUPPORT_TRUE@pre_stage2 start nbloader pxeloader diskless +@DISKLESS_SUPPORT_FALSE@noinst_DATA = @DISKLESS_SUPPORT_FALSE@pre_stage2 start +@DISKLESS_SUPPORT_TRUE@noinst_PROGRAMS = @DISKLESS_SUPPORT_TRUE@pre_stage2.exec start.exec e2fs_stage1_5.exec \ +@DISKLESS_SUPPORT_TRUE@ fat_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec \ +@DISKLESS_SUPPORT_TRUE@ reiserfs_stage1_5.exec nbloader.exec pxeloader.exec \ +@DISKLESS_SUPPORT_TRUE@ diskless.exec +@DISKLESS_SUPPORT_FALSE@noinst_PROGRAMS = @DISKLESS_SUPPORT_FALSE@pre_stage2.exec start.exec e2fs_stage1_5.exec \ +@DISKLESS_SUPPORT_FALSE@ fat_stage1_5.exec ffs_stage1_5.exec minix_stage1_5.exec \ +@DISKLESS_SUPPORT_FALSE@ reiserfs_stage1_5.exec MOSTLYCLEANFILES = $(noinst_PROGRAMS) PRE_STAGE2_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8200 START_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,8000 +PXELOADER_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,7C00 @NETBOOT_SUPPORT_TRUE@STAGE2_COMPILE = @NETBOOT_SUPPORT_TRUE@$(STAGE2_CFLAGS) -fno-builtin -nostdinc \ @NETBOOT_SUPPORT_TRUE@ -I$(top_srcdir)/netboot -DSUPPORT_NETBOOT=1 @NETBOOT_SUPPORT_FALSE@STAGE2_COMPILE = @NETBOOT_SUPPORT_FALSE@$(STAGE2_CFLAGS) -fno-builtin -nostdinc @@ -142,8 +150,9 @@ pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) @NETBOOT_SUPPORT_TRUE@pre_stage2_exec_LDADD = @NETBOOT_SUPPORT_TRUE@../netboot/libdrivers.a +@DISKLESS_SUPPORT_TRUE@BUILT_SOURCES = @DISKLESS_SUPPORT_TRUE@stage2_size.h diskless_size.h +@DISKLESS_SUPPORT_FALSE@BUILT_SOURCES = @DISKLESS_SUPPORT_FALSE@stage2_size.h -BUILT_SOURCES = stage2_size.h CLEANFILES = $(pkgdata_DATA) $(noinst_DATA) $(BUILT_SOURCES) start_exec_SOURCES = start.S @@ -195,6 +204,24 @@ reiserfs_stage1_5_exec_CFLAGS = $(STAGE1_5_COMPILE) -DFSYS_REISERFS=1 \ -DNO_BLOCK_FILES=1 reiserfs_stage1_5_exec_LDFLAGS = $(STAGE1_5_LINK) + +# For diskless target. +diskless_exec_SOURCES = $(pre_stage2_exec_SOURCES) +diskless_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) \ + -DSUPPORT_DISKLESS=1 + +diskless_exec_LDFLAGS = $(PRE_STAGE2_LINK) +diskless_exec_LDADD = ../netboot/libdrivers.a + +# For nbloader target. +nbloader_exec_SOURCES = nbloader.S +nbloader_exec_CFLAGS = $(STAGE2_COMPILE) +nbloader_exec_LDFLAGS = $(START_LINK) + +# For pxeloader target. +pxeloader_exec_SOURCES = pxeloader.S +pxeloader_exec_CFLAGS = $(STAGE2_COMPILE) +pxeloader_exec_LDFLAGS = $(PXELOADER_LINK) subdir = stage2 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h @@ -217,6 +244,15 @@ libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS) AR = ar PROGRAMS = $(noinst_PROGRAMS) +am_diskless_exec_OBJECTS = diskless_exec-asm.o diskless_exec-bios.o \ +diskless_exec-boot.o diskless_exec-builtins.o diskless_exec-common.o \ +diskless_exec-char_io.o diskless_exec-cmdline.o diskless_exec-disk_io.o \ +diskless_exec-gunzip.o diskless_exec-fsys_ext2fs.o \ +diskless_exec-fsys_fat.o diskless_exec-fsys_ffs.o \ +diskless_exec-fsys_minix.o diskless_exec-fsys_reiserfs.o \ +diskless_exec-smp-imps.o diskless_exec-stage2.o +diskless_exec_OBJECTS = $(am_diskless_exec_OBJECTS) +diskless_exec_DEPENDENCIES = ../netboot/libdrivers.a am_e2fs_stage1_5_exec_OBJECTS = e2fs_stage1_5_exec-start.o \ e2fs_stage1_5_exec-asm.o e2fs_stage1_5_exec-common.o \ e2fs_stage1_5_exec-char_io.o e2fs_stage1_5_exec-disk_io.o \ @@ -249,6 +285,10 @@ minix_stage1_5_exec-bios.o minix_stage1_5_exec_OBJECTS = $(am_minix_stage1_5_exec_OBJECTS) minix_stage1_5_exec_LDADD = $(LDADD) minix_stage1_5_exec_DEPENDENCIES = +am_nbloader_exec_OBJECTS = nbloader_exec-nbloader.o +nbloader_exec_OBJECTS = $(am_nbloader_exec_OBJECTS) +nbloader_exec_LDADD = $(LDADD) +nbloader_exec_DEPENDENCIES = am_pre_stage2_exec_OBJECTS = pre_stage2_exec-asm.o \ pre_stage2_exec-bios.o pre_stage2_exec-boot.o \ pre_stage2_exec-builtins.o pre_stage2_exec-common.o \ @@ -261,6 +301,10 @@ 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 +am_pxeloader_exec_OBJECTS = pxeloader_exec-pxeloader.o +pxeloader_exec_OBJECTS = $(am_pxeloader_exec_OBJECTS) +pxeloader_exec_LDADD = $(LDADD) +pxeloader_exec_DEPENDENCIES = am_reiserfs_stage1_5_exec_OBJECTS = reiserfs_stage1_5_exec-start.o \ reiserfs_stage1_5_exec-asm.o reiserfs_stage1_5_exec-common.o \ reiserfs_stage1_5_exec-char_io.o reiserfs_stage1_5_exec-disk_io.o \ @@ -279,16 +323,28 @@ COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CF CFLAGS = @CFLAGS@ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -DIST_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) \ -$(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) +DIST_SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) \ +$(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) \ +$(ffs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) \ +$(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) \ +$(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) \ +$(start_exec_SOURCES) DATA = $(noinst_DATA) $(pkgdata_DATA) HEADERS = $(noinst_HEADERS) depcomp = $(SHELL) $(top_srcdir)/depcomp -DEP_FILES = @AMDEP@ $(DEPDIR)/e2fs_stage1_5_exec-asm.Po \ +DEP_FILES = @AMDEP@ $(DEPDIR)/diskless_exec-asm.Po \ +$(DEPDIR)/diskless_exec-bios.Po $(DEPDIR)/diskless_exec-boot.Po \ +$(DEPDIR)/diskless_exec-builtins.Po $(DEPDIR)/diskless_exec-char_io.Po \ +$(DEPDIR)/diskless_exec-cmdline.Po $(DEPDIR)/diskless_exec-common.Po \ +$(DEPDIR)/diskless_exec-disk_io.Po \ +$(DEPDIR)/diskless_exec-fsys_ext2fs.Po \ +$(DEPDIR)/diskless_exec-fsys_fat.Po $(DEPDIR)/diskless_exec-fsys_ffs.Po \ +$(DEPDIR)/diskless_exec-fsys_minix.Po \ +$(DEPDIR)/diskless_exec-fsys_reiserfs.Po \ +$(DEPDIR)/diskless_exec-gunzip.Po $(DEPDIR)/diskless_exec-smp-imps.Po \ +$(DEPDIR)/diskless_exec-stage2.Po $(DEPDIR)/e2fs_stage1_5_exec-asm.Po \ $(DEPDIR)/e2fs_stage1_5_exec-bios.Po \ $(DEPDIR)/e2fs_stage1_5_exec-char_io.Po \ $(DEPDIR)/e2fs_stage1_5_exec-common.Po \ @@ -323,7 +379,8 @@ $(DEPDIR)/minix_stage1_5_exec-common.Po \ $(DEPDIR)/minix_stage1_5_exec-disk_io.Po \ $(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po \ $(DEPDIR)/minix_stage1_5_exec-stage1_5.Po \ -$(DEPDIR)/minix_stage1_5_exec-start.Po $(DEPDIR)/pre_stage2_exec-asm.Po \ +$(DEPDIR)/minix_stage1_5_exec-start.Po \ +$(DEPDIR)/nbloader_exec-nbloader.Po $(DEPDIR)/pre_stage2_exec-asm.Po \ $(DEPDIR)/pre_stage2_exec-bios.Po $(DEPDIR)/pre_stage2_exec-boot.Po \ $(DEPDIR)/pre_stage2_exec-builtins.Po \ $(DEPDIR)/pre_stage2_exec-char_io.Po \ @@ -338,6 +395,7 @@ $(DEPDIR)/pre_stage2_exec-fsys_reiserfs.Po \ $(DEPDIR)/pre_stage2_exec-gunzip.Po \ $(DEPDIR)/pre_stage2_exec-smp-imps.Po \ $(DEPDIR)/pre_stage2_exec-stage2.Po \ +$(DEPDIR)/pxeloader_exec-pxeloader.Po \ $(DEPDIR)/reiserfs_stage1_5_exec-asm.Po \ $(DEPDIR)/reiserfs_stage1_5_exec-bios.Po \ $(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po \ @@ -352,8 +410,8 @@ DIST_COMMON = $(noinst_HEADERS) Makefile.am Makefile.in compile DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) GZIP_ENV = --best -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) $(reiserfs_stage1_5_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_pre_stage2_exec_OBJECTS) $(am_reiserfs_stage1_5_exec_OBJECTS) $(am_start_exec_OBJECTS) +SOURCES = $(libgrub_a_SOURCES) $(diskless_exec_SOURCES) $(e2fs_stage1_5_exec_SOURCES) $(fat_stage1_5_exec_SOURCES) $(ffs_stage1_5_exec_SOURCES) $(minix_stage1_5_exec_SOURCES) $(nbloader_exec_SOURCES) $(pre_stage2_exec_SOURCES) $(pxeloader_exec_SOURCES) $(reiserfs_stage1_5_exec_SOURCES) $(start_exec_SOURCES) +OBJECTS = $(am_libgrub_a_OBJECTS) $(am_diskless_exec_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_nbloader_exec_OBJECTS) $(am_pre_stage2_exec_OBJECTS) $(am_pxeloader_exec_OBJECTS) $(am_reiserfs_stage1_5_exec_OBJECTS) $(am_start_exec_OBJECTS) all: all-redirect .SUFFIXES: @@ -411,6 +469,27 @@ clean-noinstPROGRAMS: distclean-noinstPROGRAMS: maintainer-clean-noinstPROGRAMS: +diskless_exec-asm.o: asm.S + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-asm.o `test -f asm.S || echo '$(srcdir)/'`asm.S +diskless_exec-bios.o: bios.c +diskless_exec-boot.o: boot.c +diskless_exec-builtins.o: builtins.c +diskless_exec-common.o: common.c +diskless_exec-char_io.o: char_io.c +diskless_exec-cmdline.o: cmdline.c +diskless_exec-disk_io.o: disk_io.c +diskless_exec-gunzip.o: gunzip.c +diskless_exec-fsys_ext2fs.o: fsys_ext2fs.c +diskless_exec-fsys_fat.o: fsys_fat.c +diskless_exec-fsys_ffs.o: fsys_ffs.c +diskless_exec-fsys_minix.o: fsys_minix.c +diskless_exec-fsys_reiserfs.o: fsys_reiserfs.c +diskless_exec-smp-imps.o: smp-imps.c +diskless_exec-stage2.o: stage2.c + +diskless.exec: $(diskless_exec_OBJECTS) $(diskless_exec_DEPENDENCIES) + @rm -f diskless.exec + $(LINK) $(diskless_exec_LDFLAGS) $(diskless_exec_OBJECTS) $(diskless_exec_LDADD) $(LIBS) 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 `test -f start.S || echo '$(srcdir)/'`start.S e2fs_stage1_5_exec-asm.o: asm.S @@ -467,6 +546,12 @@ minix_stage1_5_exec-bios.o: bios.c minix_stage1_5.exec: $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_DEPENDENCIES) @rm -f minix_stage1_5.exec $(LINK) $(minix_stage1_5_exec_LDFLAGS) $(minix_stage1_5_exec_OBJECTS) $(minix_stage1_5_exec_LDADD) $(LIBS) +nbloader_exec-nbloader.o: nbloader.S + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nbloader_exec_CFLAGS) $(CFLAGS) -c -o nbloader_exec-nbloader.o `test -f nbloader.S || echo '$(srcdir)/'`nbloader.S + +nbloader.exec: $(nbloader_exec_OBJECTS) $(nbloader_exec_DEPENDENCIES) + @rm -f nbloader.exec + $(LINK) $(nbloader_exec_LDFLAGS) $(nbloader_exec_OBJECTS) $(nbloader_exec_LDADD) $(LIBS) pre_stage2_exec-asm.o: asm.S $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-asm.o `test -f asm.S || echo '$(srcdir)/'`asm.S pre_stage2_exec-bios.o: bios.c @@ -488,6 +573,12 @@ pre_stage2_exec-stage2.o: stage2.c pre_stage2.exec: $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_DEPENDENCIES) @rm -f pre_stage2.exec $(LINK) $(pre_stage2_exec_LDFLAGS) $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_LDADD) $(LIBS) +pxeloader_exec-pxeloader.o: pxeloader.S + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pxeloader_exec_CFLAGS) $(CFLAGS) -c -o pxeloader_exec-pxeloader.o `test -f pxeloader.S || echo '$(srcdir)/'`pxeloader.S + +pxeloader.exec: $(pxeloader_exec_OBJECTS) $(pxeloader_exec_DEPENDENCIES) + @rm -f pxeloader.exec + $(LINK) $(pxeloader_exec_LDFLAGS) $(pxeloader_exec_OBJECTS) $(pxeloader_exec_LDADD) $(LIBS) reiserfs_stage1_5_exec-start.o: start.S $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(reiserfs_stage1_5_exec_CFLAGS) $(CFLAGS) -c -o reiserfs_stage1_5_exec-start.o `test -f start.S || echo '$(srcdir)/'`start.S reiserfs_stage1_5_exec-asm.o: asm.S @@ -562,6 +653,22 @@ distclean-tags: maintainer-clean-tags: +@AMDEP@include $(DEPDIR)/diskless_exec-asm.Po +@AMDEP@include $(DEPDIR)/diskless_exec-bios.Po +@AMDEP@include $(DEPDIR)/diskless_exec-boot.Po +@AMDEP@include $(DEPDIR)/diskless_exec-builtins.Po +@AMDEP@include $(DEPDIR)/diskless_exec-char_io.Po +@AMDEP@include $(DEPDIR)/diskless_exec-cmdline.Po +@AMDEP@include $(DEPDIR)/diskless_exec-common.Po +@AMDEP@include $(DEPDIR)/diskless_exec-disk_io.Po +@AMDEP@include $(DEPDIR)/diskless_exec-fsys_ext2fs.Po +@AMDEP@include $(DEPDIR)/diskless_exec-fsys_fat.Po +@AMDEP@include $(DEPDIR)/diskless_exec-fsys_ffs.Po +@AMDEP@include $(DEPDIR)/diskless_exec-fsys_minix.Po +@AMDEP@include $(DEPDIR)/diskless_exec-fsys_reiserfs.Po +@AMDEP@include $(DEPDIR)/diskless_exec-gunzip.Po +@AMDEP@include $(DEPDIR)/diskless_exec-smp-imps.Po +@AMDEP@include $(DEPDIR)/diskless_exec-stage2.Po @AMDEP@include $(DEPDIR)/e2fs_stage1_5_exec-asm.Po @AMDEP@include $(DEPDIR)/e2fs_stage1_5_exec-bios.Po @AMDEP@include $(DEPDIR)/e2fs_stage1_5_exec-char_io.Po @@ -607,6 +714,7 @@ maintainer-clean-tags: @AMDEP@include $(DEPDIR)/minix_stage1_5_exec-fsys_minix.Po @AMDEP@include $(DEPDIR)/minix_stage1_5_exec-stage1_5.Po @AMDEP@include $(DEPDIR)/minix_stage1_5_exec-start.Po +@AMDEP@include $(DEPDIR)/nbloader_exec-nbloader.Po @AMDEP@include $(DEPDIR)/pre_stage2_exec-asm.Po @AMDEP@include $(DEPDIR)/pre_stage2_exec-bios.Po @AMDEP@include $(DEPDIR)/pre_stage2_exec-boot.Po @@ -623,6 +731,7 @@ maintainer-clean-tags: @AMDEP@include $(DEPDIR)/pre_stage2_exec-gunzip.Po @AMDEP@include $(DEPDIR)/pre_stage2_exec-smp-imps.Po @AMDEP@include $(DEPDIR)/pre_stage2_exec-stage2.Po +@AMDEP@include $(DEPDIR)/pxeloader_exec-pxeloader.Po @AMDEP@include $(DEPDIR)/reiserfs_stage1_5_exec-asm.Po @AMDEP@include $(DEPDIR)/reiserfs_stage1_5_exec-bios.Po @AMDEP@include $(DEPDIR)/reiserfs_stage1_5_exec-char_io.Po @@ -757,6 +866,126 @@ libgrub_a-stage2.o: stage2.c @AMDEP@CCDEPMODE = @CCDEPMODE@ +diskless_exec-bios.o: bios.c +@AMDEP@ source='bios.c' object='diskless_exec-bios.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-bios.Po' tmpdepfile='$(DEPDIR)/diskless_exec-bios.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-bios.o `test -f bios.c || echo '$(srcdir)/'`bios.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-boot.o: boot.c +@AMDEP@ source='boot.c' object='diskless_exec-boot.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-boot.Po' tmpdepfile='$(DEPDIR)/diskless_exec-boot.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-boot.o `test -f boot.c || echo '$(srcdir)/'`boot.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-builtins.o: builtins.c +@AMDEP@ source='builtins.c' object='diskless_exec-builtins.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-builtins.Po' tmpdepfile='$(DEPDIR)/diskless_exec-builtins.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-builtins.o `test -f builtins.c || echo '$(srcdir)/'`builtins.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-common.o: common.c +@AMDEP@ source='common.c' object='diskless_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-common.Po' tmpdepfile='$(DEPDIR)/diskless_exec-common.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.o `test -f common.c || echo '$(srcdir)/'`common.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-char_io.o: char_io.c +@AMDEP@ source='char_io.c' object='diskless_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-char_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-char_io.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-char_io.o `test -f char_io.c || echo '$(srcdir)/'`char_io.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-cmdline.o: cmdline.c +@AMDEP@ source='cmdline.c' object='diskless_exec-cmdline.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-cmdline.Po' tmpdepfile='$(DEPDIR)/diskless_exec-cmdline.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-cmdline.o `test -f cmdline.c || echo '$(srcdir)/'`cmdline.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-disk_io.o: disk_io.c +@AMDEP@ source='disk_io.c' object='diskless_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-disk_io.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-disk_io.o `test -f disk_io.c || echo '$(srcdir)/'`disk_io.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-gunzip.o: gunzip.c +@AMDEP@ source='gunzip.c' object='diskless_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/diskless_exec-gunzip.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.o `test -f gunzip.c || echo '$(srcdir)/'`gunzip.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-fsys_ext2fs.o: fsys_ext2fs.c +@AMDEP@ source='fsys_ext2fs.c' object='diskless_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ext2fs.o `test -f fsys_ext2fs.c || echo '$(srcdir)/'`fsys_ext2fs.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-fsys_fat.o: fsys_fat.c +@AMDEP@ source='fsys_fat.c' object='diskless_exec-fsys_fat.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-fsys_fat.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_fat.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_fat.o `test -f fsys_fat.c || echo '$(srcdir)/'`fsys_fat.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-fsys_ffs.o: fsys_ffs.c +@AMDEP@ source='fsys_ffs.c' object='diskless_exec-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ffs.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_ffs.o `test -f fsys_ffs.c || echo '$(srcdir)/'`fsys_ffs.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-fsys_minix.o: fsys_minix.c +@AMDEP@ source='fsys_minix.c' object='diskless_exec-fsys_minix.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-fsys_minix.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_minix.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_minix.o `test -f fsys_minix.c || echo '$(srcdir)/'`fsys_minix.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-fsys_reiserfs.o: fsys_reiserfs.c +@AMDEP@ source='fsys_reiserfs.c' object='diskless_exec-fsys_reiserfs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-fsys_reiserfs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_reiserfs.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_reiserfs.o `test -f fsys_reiserfs.c || echo '$(srcdir)/'`fsys_reiserfs.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-smp-imps.o: smp-imps.c +@AMDEP@ source='smp-imps.c' object='diskless_exec-smp-imps.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-smp-imps.Po' tmpdepfile='$(DEPDIR)/diskless_exec-smp-imps.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-smp-imps.o `test -f smp-imps.c || echo '$(srcdir)/'`smp-imps.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + +diskless_exec-stage2.o: stage2.c +@AMDEP@ source='stage2.c' object='diskless_exec-stage2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP@ depfile='$(DEPDIR)/diskless_exec-stage2.Po' tmpdepfile='$(DEPDIR)/diskless_exec-stage2.TPo' @AMDEPBACKSLASH@ +@AMDEP@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-stage2.o `test -f stage2.c || echo '$(srcdir)/'`stage2.c + +@AMDEP@CCDEPMODE = @CCDEPMODE@ + e2fs_stage1_5_exec-common.o: common.c @AMDEP@ source='common.c' object='e2fs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ @@ -1279,6 +1508,24 @@ stage2: pre_stage2 start -rm -f stage2 cat start pre_stage2 > stage2 +diskless_size.h: diskless + -rm -f $@ + set dummy `ls -l $^`; \ + echo "#define DISKLESS_SIZE $$6" > $@ + +# XXX: See the comment for start_exec-start.o. +nbloader_exec-nbloader.o: diskless_size.h + +# For nbgrub target. +nbgrub: nbloader diskless + -rm -f $@ + cat $^ > $@ + +# For pxegrub target. +pxegrub: pxeloader diskless + -rm -f $@ + cat $^ > $@ + # General rule for making a raw binary. %: %.exec $(OBJCOPY) -O binary $< $@ diff --git a/stage2/asm.S b/stage2/asm.S index 9d1e942e6..31f352f94 100644 --- a/stage2/asm.S +++ b/stage2/asm.S @@ -70,7 +70,7 @@ ENTRY(main) . = EXT_C(main) + 0x8 VARIABLE(install_partition) - .long 0x020000 + .long 0xFFFFFF VARIABLE(stage2_id) .byte STAGE2_ID VARIABLE(force_lba) @@ -107,8 +107,10 @@ codestart: sti /* we're safe again */ +#ifndef DISKLESS_SUPPORT /* save boot drive reference */ ADDR32 movb %dl, EXT_C(boot_drive) +#endif /* reset disk system (%ah = 0) */ int $0x13 @@ -2071,7 +2073,11 @@ protstack: .long PROTSTACKINIT VARIABLE(boot_drive) +#ifdef SUPPORT_DISKLESS + .long NETWORK_DRIVE +#else .long 0 +#endif /* an address can only be long-jumped to if it is in memory, this is used by multiple routines */ diff --git a/stage2/common.c b/stage2/common.c index 1a39c4ad1..007d1989c 100644 --- a/stage2/common.c +++ b/stage2/common.c @@ -19,7 +19,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "shared.h" +#include + +#ifdef SUPPORT_DISKLESS +# include +#endif /* * Shared BIOS/boot data. @@ -125,6 +129,25 @@ mmap_avail_at (unsigned long bottom) } #endif /* ! STAGE1_5 */ +#ifdef SUPPORT_DISKLESS +/* Set up the diskless environment so that GRUB can get a configuration + file from a network. */ +static int +setup_diskless_environment (void) +{ + /* For now, there is no difference between BOOTP and DHCP in GRUB. */ + if (! bootp ()) + { + grub_printf ("BOOTP/DHCP fails.\n"); + return 0; + } + + /* This will be erased soon, though... */ + print_network_configuration (); + return 1; +} +#endif /* SUPPORT_DISKLESS */ + /* This queries for BIOS information. */ void init_bios_info (void) @@ -240,16 +263,16 @@ init_bios_info (void) #endif /* STAGE1_5 */ - /* - * Set boot drive and partition. - */ - +#ifdef SUPPORT_DISKLESS + /* If SUPPORT_DISKLESS is defined, initialize the network here. */ + if (! setup_diskless_environment ()) + return; +#endif + + /* Set boot drive and partition. */ saved_drive = boot_drive; saved_partition = install_partition; - /* - * Start main routine here. - */ - + /* Start main routine here. */ cmain (); } diff --git a/stage2/nbi.h b/stage2/nbi.h new file mode 100644 index 000000000..eabe907bb --- /dev/null +++ b/stage2/nbi.h @@ -0,0 +1,27 @@ +/* nbi.h - definitions for Net Boot Image */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, Inc. + * + * 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef GRUB_NBI_HEADER +#define GRUB_NBI_HEADER + +#define NBI_MAGIC 0x1B031336 +#define NBI_DEST_ADDR 0x8000 + +#endif /* ! GRUB_NBI_HEADER */ diff --git a/stage2/nbloader.S b/stage2/nbloader.S new file mode 100644 index 000000000..1095b926b --- /dev/null +++ b/stage2/nbloader.S @@ -0,0 +1,49 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, Inc. + * + * 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include +#include + + .file "nbloader.S" + .text + + /* Just a dummy entry */ +.globl _start; _start: + + /* + * netboot image header + */ + + .long NBI_MAGIC + .long 0x00000004 + /* load address of the first block */ + .word NBI_DEST_ADDR + .word 0x0000 + /* start addr of the code (stage 2) */ + .word NBI_DEST_ADDR + 0x0200 + .word 0x0000 + + .long 0x04000004 + .long NBI_DEST_ADDR + 0x0200 + .long DISKLESS_SIZE + 0x200 + .long DISKLESS_SIZE + 0x200 + + /* This ensures that the length of this image will be 1 sector */ + . = _start + 0x200 - 1 + .byte 0 diff --git a/stage2/pxeloader.S b/stage2/pxeloader.S new file mode 100644 index 000000000..80e95fe7e --- /dev/null +++ b/stage2/pxeloader.S @@ -0,0 +1,36 @@ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2000 Free Software Foundation, Inc. + * + * 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + .file "pxeloader.S" + .text + + /* Start with the prehistoric environment... */ + .code16 + + /* Let's go */ +.globl _start; _start: + + /* Jump to the real world */ + ljmp $0, $0x8200 + + /* This region is a junk. Do you say that this is wasteful? + But I like that the memory layout of the body is consistent + among different stage2s rather than scamping just for 1.5KB. */ + . = _start + 0x8200 - 0x7C00 - 1 + .byte 0