Add support for booting from CD-ROM. Make it possible to enable UFS

support using make arguments.
This commit is contained in:
Thomas Moestl 2002-04-01 23:28:35 +00:00
parent 163f47b1ec
commit ad68ab89e2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=93606
2 changed files with 27 additions and 0 deletions

View file

@ -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

View file

@ -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;