More bootloader changes:

* if loading from cdrom, assume we're performing an install and
	  fix up bootpath/kernel to load the proper install kernel.
	* maximum filename length in volume header is eight characters.
	  Change boot.elf to ip2xboot, boot.ip32 to ip3xboot, and boot
	  to aoutboot (which matches kernel naming scheme as well).
This commit is contained in:
sekiya 2003-11-13 08:01:17 +00:00
parent 967d9a12d5
commit 1ba2b99e3e
2 changed files with 33 additions and 18 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.6 2003/11/11 06:30:39 sekiya Exp $
# $NetBSD: Makefile,v 1.7 2003/11/13 08:01:17 sekiya Exp $
PROG= boot
@ -10,26 +10,25 @@ STRIPFLAG=
SRCS= start.S boot.c bootinfo.c conf.c devopen.c putchar.c getchar.c \
getopt.c disk.c
${PROG}: ${PROG}.elf ${PROG}.ip32
${ELF2ECOFF} ${PROG}.elf ${PROG}
@${SIZE} ${PROG}
${PROG}: ip2x${PROG} ip3x${PROG}
${ELF2ECOFF} ip2x${PROG} aout${PROG}
# XXX Temporary hack to install the ELF verision, too.
FILES+= ${PROG}.elf ${PROG}.ip32
CLEANFILES+= ${PROG}.elf ${PROG}.ip32
FILES+= ip2x${PROG} ip3x${PROG}
CLEANFILES+= ip2x${PROG} ip3x${PROG}
CLEANFILES+= ${PROG}.map
.include "../Makefile.booters"
${PROG}.ip32: ${OBJS} ${LIBS}
ip3x${PROG}: ${OBJS} ${LIBS}
${LD} -Map ${PROG}.map -x -Ttext ${LOAD_ADDRESS_IP32} ${LDBUG} \
-e start -o ${PROG}.ip32 ${OBJS} ${LIBS}
@${STRIP} -s ${PROG}.ip32
@${SIZE} ${PROG}.ip32
-e start -o ip3x${PROG} ${OBJS} ${LIBS}
@${STRIP} -s ip3x${PROG}
@${SIZE} ip3x${PROG}
${PROG}.elf: ${OBJS} ${LIBS}
ip2x${PROG}: ${OBJS} ${LIBS}
${LD} -Map ${PROG}.map -x -Ttext ${LOAD_ADDRESS} ${LDBUG} \
-e start -o ${PROG}.elf ${OBJS} ${LIBS}
@${STRIP} -s ${PROG}.elf
@${SIZE} ${PROG}.elf
-e start -o ip2x${PROG} ${OBJS} ${LIBS}
@${STRIP} -s ip2x${PROG}
@${SIZE} ip2x${PROG}

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.5 2003/11/11 06:47:00 sekiya Exp $ */
/* $NetBSD: boot.c,v 1.6 2003/11/13 08:01:17 sekiya Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -161,11 +161,25 @@ main(int argc, char **argv)
/*
* How to find partition and file to load?
*
* If OSLoaderPartition is not set, we're probably doing an install
* from removable media. Therefore, we'll fake up the bootpath from
* argv[0].
* If argv[0] contains the string "cdrom(", we're probably doing an
* install. The bootpath will therefore be partition 0 of whatever
* device we've booted from. Derive the install kernel name from
* the bootloader name ("ip32boot", "ip22boot", or "aoutboot").
*/
if (strstr(argv[0], "cdrom("))
{
strcpy(bootfile, argv[0]);
i = (strrchr(bootfile, ')') - bootfile);
bootfile[i-1] = '0';
if (strstr(bootfile, "ip3x"))
sprintf( (strrchr(bootfile, ')') + 1), "netbsd-INSTALL32_IP3x");
else
sprintf( (strrchr(bootfile, ')') + 1), "netbsd-INSTALL32_IP2x");
if ( (loadfile(bootfile, marks, LOAD_KERNEL)) >=1 )
goto finish;
}
bootpath = ARCBIOS->GetEnvironmentVariable("OSLoadPartition");
if (bootpath == NULL) {
@ -221,6 +235,8 @@ main(int argc, char **argv)
printf("Boot failed! Halting...\n");
return 0;
}
finish:
strncpy(bi_bpath.bootpath, kernel, BTINFO_BOOTPATH_LEN);
bi_add(&bi_bpath, BTINFO_BOOTPATH);