From ad68ab89e2c36e378d03ab777464dcc8a24a43a0 Mon Sep 17 00:00:00 2001 From: Thomas Moestl Date: Mon, 1 Apr 2002 23:28:35 +0000 Subject: [PATCH] Add support for booting from CD-ROM. Make it possible to enable UFS support using make arguments. --- sys/boot/sparc64/loader/Makefile | 8 ++++++++ sys/boot/sparc64/loader/main.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile index 64e686b52e48..0fda8d4484de 100644 --- a/sys/boot/sparc64/loader/Makefile +++ b/sys/boot/sparc64/loader/Makefile @@ -7,6 +7,8 @@ NEWVERSWHAT= "bootstrap loader" sparc64 CFLAGS= -mno-app-regs LOADER_DISK_SUPPORT?= no +LOADER_UFS_SUPPORT?= no +LOADER_CD9660_SUPPORT?= no LOADER_NET_SUPPORT?= yes LOADER_NFS_SUPPORT?= yes LOADER_TFTP_SUPPORT?= yes @@ -14,6 +16,12 @@ LOADER_TFTP_SUPPORT?= yes .if ${LOADER_DISK_SUPPORT} == "yes" CFLAGS+= -DLOADER_DISK_SUPPORT .endif +.if ${LOADER_UFS_SUPPORT} == "yes" +CFLAGS+= -DLOADER_UFS_SUPPORT +.endif +.if ${LOADER_CD9660_SUPPORT} == "yes" +CFLAGS+= -DLOADER_CD9660_SUPPORT +.endif .if ${LOADER_NET_SUPPORT} == "yes" CFLAGS+= -DLOADER_NET_SUPPORT .endif diff --git a/sys/boot/sparc64/loader/main.c b/sys/boot/sparc64/loader/main.c index 406de397028a..b85286b3a74f 100644 --- a/sys/boot/sparc64/loader/main.c +++ b/sys/boot/sparc64/loader/main.c @@ -105,6 +105,9 @@ struct fs_ops *file_system[] = { #ifdef LOADER_UFS_SUPPORT &ufs_fsops, #endif +#ifdef LOADER_CD9660_SUPPORT + &cd9660_fsops, +#endif #ifdef LOADER_NET_SUPPORT &nfs_fsops, #endif @@ -388,6 +391,22 @@ main(int (*openfirm)(void *)) 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 file system 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 file systems. + * 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;