diff options
author | jake <jake@FreeBSD.org> | 2002-11-10 19:17:36 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2002-11-10 19:17:36 +0000 |
commit | 73d398d702d8489985977353b7f67aaabb9d840c (patch) | |
tree | afef4c9c5cb095c3438e4a1874a05286c64fec0e /sys/boot/sparc64 | |
parent | 1ff96af1eab5b5285540c2bb95862f1687e10252 (diff) | |
download | FreeBSD-src-73d398d702d8489985977353b7f67aaabb9d840c.zip FreeBSD-src-73d398d702d8489985977353b7f67aaabb9d840c.tar.gz |
Change the device path representation in libofw to use the full firmware
path, instead of an internal i386 specific one. Don't try to interpret
a disklabel in ofw_disk.c, open the partition's device node directly and
let the firmware do it. This fixes booting from a partition other than 'a'
on sparc64, which is needed to support more installation methods.
No objection: ppc
Diffstat (limited to 'sys/boot/sparc64')
-rw-r--r-- | sys/boot/sparc64/loader/Makefile | 6 | ||||
-rw-r--r-- | sys/boot/sparc64/loader/main.c | 52 | ||||
-rw-r--r-- | sys/boot/sparc64/loader/metadata.c | 15 |
3 files changed, 25 insertions, 48 deletions
diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile index cb7a8fa..0d77ee7 100644 --- a/sys/boot/sparc64/loader/Makefile +++ b/sys/boot/sparc64/loader/Makefile @@ -16,6 +16,7 @@ LOADER_CD9660_SUPPORT?= yes LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes +LOADER_ZIP_SUPPORT?= yes LOADER_GZIP_SUPPORT?= yes LOADER_BZIP2_SUPPORT?= no @@ -28,6 +29,9 @@ CFLAGS+= -DLOADER_UFS_SUPPORT .if ${LOADER_CD9660_SUPPORT} == "yes" CFLAGS+= -DLOADER_CD9660_SUPPORT .endif +.if ${LOADER_ZIP_SUPPORT} == "yes" +CFLAGS+= -DLOADER_ZIP_SUPPORT +.endif .if ${LOADER_GZIP_SUPPORT} == "yes" CFLAGS+= -DLOADER_GZIP_SUPPORT .endif @@ -81,7 +85,7 @@ LIBSTAND= -lstand .endif CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ -LDADD= ${LIBFICL} ${LIBSTAND} ${LIBOFW} +LDADD= ${LIBFICL} ${LIBOFW} ${LIBSTAND} vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT} diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index 43e3c77..3354bc2 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -75,7 +75,6 @@ vm_offset_t heapva; phandle_t pmemh; /* OFW memory handle */ struct memory_slice memslices[18]; -struct ofw_devdesc bootdev; /* * Machine dependent structures that the machine independent @@ -368,9 +367,6 @@ main(int (*openfirm)(void *)) archsw.arch_copyout = ofw_copyout; archsw.arch_readin = sparc64_readin; archsw.arch_autoload = sparc64_autoload; -#ifdef ELF_CRC32 - archsw.arch_crc32 = sparc64_crc32; -#endif init_heap(); setheap((void *)heapva, (void *)(heapva + HEAPSZ)); @@ -398,46 +394,32 @@ main(int (*openfirm)(void *)) chosenh = OF_finddevice("/chosen"); OF_getprop(chosenh, "bootpath", bootpath, sizeof(bootpath)); - bootdev.d_type = ofw_devicetype(bootpath); - switch (bootdev.d_type) { - case DEVT_DISK: - bootdev.d_dev = &ofwdisk; - /* - * Sun compatible bootable CD-ROMs have a disk label placed - * before the cd9660 data, with the actual filesystem being - * in the first partition, while the other partitions contain - * pseudo disk labels with embedded boot blocks for different - * architectures, which may be followed by UFS filesystems. - * The firmware will set the boot path to the partition it - * boots from ('f' in the sun4u case), but we want the kernel - * to be loaded from the cd9660 fs ('a'), so the boot path - * needs to be altered. - */ - if (strstr(bootpath, "cdrom") != NULL && - bootpath[strlen(bootpath) - 2] == ':') { - bootpath[strlen(bootpath) - 1] = 'a'; - printf("Boot path set to %s\n", bootpath); - } - strncpy(bootdev.d_kind.ofwdisk.path, bootpath, 64); - ofw_parseofwdev(&bootdev, bootpath); - break; - case DEVT_NET: - bootdev.d_dev = &netdev; - strncpy(bootdev.d_kind.netif.path, bootpath, 64); - bootdev.d_kind.netif.unit = 0; - break; + /* + * Sun compatible bootable CD-ROMs have a disk label placed + * before the cd9660 data, with the actual filesystem being + * in the first partition, while the other partitions contain + * pseudo disk labels with embedded boot blocks for different + * architectures, which may be followed by UFS filesystems. + * The firmware will set the boot path to the partition it + * boots from ('f' in the sun4u case), but we want the kernel + * to be loaded from the cd9660 fs ('a'), so the boot path + * needs to be altered. + */ + if (bootpath[strlen(bootpath) - 2] == ':' && + bootpath[strlen(bootpath) - 1] == 'f') { + bootpath[strlen(bootpath) - 1] = 'a'; + printf("Boot path set to %s\n", bootpath); } - env_setenv("currdev", EV_VOLATILE, ofw_fmtdev(&bootdev), + env_setenv("currdev", EV_VOLATILE, bootpath, ofw_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, ofw_fmtdev(&bootdev), + env_setenv("loaddev", EV_VOLATILE, bootpath, env_noset, env_nounset); printf("\n"); printf("%s, Revision %s\n", bootprog_name, bootprog_rev); printf("(%s, %s)\n", bootprog_maker, bootprog_date); printf("bootpath=\"%s\"\n", bootpath); - printf("loaddev=%s\n", getenv("loaddev")); /* Give control to the machine independent loader code. */ interact(); diff --git a/sys/boot/sparc64/loader/metadata.c b/sys/boot/sparc64/loader/metadata.c index 7f0b873..5de7e7d 100644 --- a/sys/boot/sparc64/loader/metadata.c +++ b/sys/boot/sparc64/loader/metadata.c @@ -261,7 +261,6 @@ md_load(char *args, vm_offset_t *modulep) struct preloaded_file *kfp; struct preloaded_file *xp; struct file_metadata *md; - struct ofw_devdesc *rootdev; vm_offset_t kernend; vm_offset_t addr; vm_offset_t envp; @@ -276,17 +275,9 @@ md_load(char *args, vm_offset_t *modulep) * This should perhaps go to MI code and/or have $rootdev tested/set by * MI code before launching the kernel. */ - rootdevname = getenv("rootdev"); - ofw_getdev((void **)(&rootdev), rootdevname, NULL); - if (rootdev == NULL) { /* bad $rootdev/$currdev */ - printf("can't determine root device\n"); - return(EINVAL); - } - - /* Try reading the /etc/fstab file to select the root device */ - getrootmount(ofw_fmtdev((void *)rootdev)); - - free(rootdev); + if ((rootdevname = getenv("rootdev")) == NULL) + rootdevname = getenv("currdev"); + getrootmount(rootdevname); /* find the last module in the chain */ addr = 0; |