# $NetBSD: Makefile,v 1.14 2010/12/29 17:44:03 jakllsch Exp $
-SUBDIR= bootxx_ffsv1 .WAIT bootxx_ffsv2 bootxx_lfsv1 bootxx_lfsv2
-SUBDIR+=bootxx_msdos bootxx_ustarfs
+#SUBDIR= bootxx_ffsv1 .WAIT bootxx_ffsv2 bootxx_lfsv1 bootxx_lfsv2
+#SUBDIR+=bootxx_msdos bootxx_ustarfs
# Ext2fs doesn't have enough free space (it has only 1KB)
# to store this primary bootloader, but we can put it into
# an independent small 'boot' partition as NetBSD/hp300 does.
-SUBDIR+=bootxx_ext2fs
-SUBDIR+=bootxx_minixfs3
+#SUBDIR+=bootxx_ext2fs
+SUBDIR=bootxx_minixfs3
LIBOBJ= ${.OBJDIR}
.MAKEOVERRIDES+= LIBOBJ
CPPFLAGS+= -DXXfs_read=${FS}_read
CPPFLAGS+= -DXXfs_stat=${FS}_stat
CPPFLAGS+= -DFS=${FS}
+# clang generates too big bootxx_xxx
+.if (${CC} == "clang")
+CPPFLAGS+= -Os
+.endif
# CPPFLAGS+= -DBOOT_MSG_COM0
# Make sure we override any optimization options specified by the user
-.include "${.PARSEDIR}/../Makefile.inc"
-COPTS= ${OPT_SIZE.${ACTIVE_CC}}
-DBG=
+#.include "${.PARSEDIR}/../Makefile.inc"
+#COPTS= ${OPT_SIZE.${ACTIVE_CC}}
+#DBG=
CPPFLAGS+= -DNO_LBA_CHECK
static int
ob(void)
{
+#ifndef __minix
return open("boot", 0);
+#else
+ return open("boot_monitor", 0);
+#endif
}
const char *
#ifdef BOOT_FROM_MINIXFS3
bios_sector -= RF_PROTECTED_SECTORS;
- bios_sector += 32; /* XXX put somewhere as constant */
+ bios_sector += MINIX3_FIRST_SUBP_OFFSET;
*sector = bios_sector;
fd = ob();
done:
/* if we fail here, so will fstat, so keep going */
- if (fd == -1 || fstat(fd, &sb) == -1)
+ if (fd == -1 || fstat(fd, &sb) == -1) {
+#ifndef __minix
return "Can't open /boot\r\n";
+#else
+ return "Can't open /boot_monitor\r\n";
+#endif
+ }
biosdev = (uint32_t)sb.st_size;
#if 0
return "/boot too large\r\n";
#endif
- if (read(fd, (void *)SECONDARY_LOAD_ADDRESS, biosdev) != biosdev)
+ if (read(fd, (void *)SECONDARY_LOAD_ADDRESS, biosdev) != biosdev) {
+#ifndef __minix
return "/boot load failed\r\n";
+#else
+ return "/boot_monitor load failed\r\n";
+#endif
+ }
- if (*(uint32_t *)(SECONDARY_LOAD_ADDRESS + 4) != X86_BOOT_MAGIC_2)
+ if (*(uint32_t *)(SECONDARY_LOAD_ADDRESS + 4) != X86_BOOT_MAGIC_2) {
+#ifndef __minix
return "Invalid /boot file format\r\n";
+#else
+ return "Invalid /boot_monitor file format\r\n";
+#endif
+ }
/* We need to jump to the secondary bootstrap in realmode */
return 0;
pop %ecx
movl $boot_params, %esi
orb $X86_BP_FLAGS_LBA64VALID, 4(%esi)
- lcall $SECONDARY_LOAD_ADDRESS/16, $0
+ lcall $SECONDARY_LOAD_ADDRESS >> 4, $0
boot_fail:
push %ax /* error string from boot1 */