diff -ruN grub-0.5.96/grub/asmstub.c grub-0.5.96-my/grub/asmstub.c --- grub-0.5.96/grub/asmstub.c Fri Sep 29 20:55:27 2000 +++ grub-0.5.96-my/grub/asmstub.c Wed Nov 1 22:18:25 2000 @@ -301,6 +301,13 @@ stop (); } +/* For Smart Boot Manager main.bin kernel */ +void +sbm_boot (void) +{ + stop (); +} + /* sets it to linear or wired A20 operation */ void gateA20 (int linear) diff -ruN grub-0.5.96/stage2/asm.S grub-0.5.96-my/stage2/asm.S --- grub-0.5.96/stage2/asm.S Wed Sep 6 05:02:39 2000 +++ grub-0.5.96-my/stage2/asm.S Wed Nov 1 22:23:32 2000 @@ -1737,6 +1737,33 @@ /* error */ call EXT_C(stop) +/* + * sbm_boot() + * + * Copy SBM kernel from staging area to 0x1000:0x0000, + * then jump to the entry point of the Smart Boot Manager (0x1000:0x0000) + */ +ENTRY(sbm_boot) + /* copy kernel */ + cld + movl $SBM_KERNEL_MAXSIZE, %ecx + movl $SBM_STAGING_AREA, %esi + movl $SBM_KERNEL, %edi + + rep + movsb + + call EXT_C(prot_to_real) + + .code16 + + /* jump to start */ + /* ljmp 0x1000:0x0000 */ + .byte 0xea + .word 0x0000 + .word SBM_KERNEL_SEG + + .code32 /* * console_cls() diff -ruN grub-0.5.96/stage2/boot.c grub-0.5.96-my/stage2/boot.c --- grub-0.5.96/stage2/boot.c Mon Sep 11 22:55:02 2000 +++ grub-0.5.96-my/stage2/boot.c Wed Nov 1 22:17:37 2000 @@ -365,6 +365,24 @@ else errnum = ERR_WONT_FIT; } + else if (!grub_memcmp(buffer + SBM_SIGNATURE_OFFSET, SBM_SIGNATURE, 4)) + { + int kernel_size; + unsigned short version_byte; + int mnr,mjr; + + version_byte = *((unsigned short *)(buffer + SBM_VERSION_OFFSET)); + mnr = version_byte & 0x0F; + mjr = version_byte >> 8; + + grub_seek (0); + kernel_size = grub_read ((char *) SBM_STAGING_AREA, -1); + grub_close(); + + printf(" [SmartBootManager, size=0x%x, version=%d.%d]\n", kernel_size, mjr, mnr); + + return KERNEL_TYPE_SBM; + } else /* no recognizable format */ errnum = ERR_EXEC_FORMAT; diff -ruN grub-0.5.96/stage2/builtins.c grub-0.5.96-my/stage2/builtins.c --- grub-0.5.96/stage2/builtins.c Fri Oct 6 15:05:12 2000 +++ grub-0.5.96-my/stage2/builtins.c Wed Nov 1 22:19:47 2000 @@ -293,6 +293,11 @@ multi_boot ((int) entry_addr, (int) &mbi); break; + case KERNEL_TYPE_SBM: + /* SmartBootManager */ + sbm_boot(); + break; + default: errnum = ERR_BOOT_COMMAND; return 1; @@ -3985,6 +4204,7 @@ &builtin_map, &builtin_module, &builtin_modulenounzip, + &builtin_partmap, &builtin_partnew, &builtin_parttype, &builtin_password, diff -ruN grub-0.5.96/stage2/shared.h grub-0.5.96-my/stage2/shared.h --- grub-0.5.96/stage2/shared.h Fri Sep 29 02:41:42 2000 +++ grub-0.5.96-my/stage2/shared.h Wed Nov 1 22:25:18 2000 @@ -164,6 +164,17 @@ #define CL_BASE_ADDR RAW_ADDR (0x90000) /* + * Smart Boot Manager things + */ +#define SBM_STAGING_AREA RAW_ADDR (0x100000) +#define SBM_KERNEL RAW_ADDR (0x10000) +#define SBM_KERNEL_SEG 0x1000 +#define SBM_KERNEL_MAXSIZE 0x8000 +#define SBM_SIGNATURE_OFFSET 0x4 +#define SBM_SIGNATURE "SBMK" +#define SBM_VERSION_OFFSET 0x8 + +/* * General disk stuff */ @@ -627,6 +638,9 @@ /* booting a multiboot executable */ void multi_boot (int start, int mb_info) __attribute__ ((noreturn)); +/* do some funky stuff, then boot Smart Boot Manager */ +void sbm_boot (void) __attribute__ ((noreturn)); + /* If LINEAR is nonzero, then set the Intel processor to linear mode. Otherwise, bit 20 of all memory accesses is always forced to zero, causing a wraparound effect for bugwards compatibility with the @@ -742,6 +756,7 @@ KERNEL_TYPE_BIG_LINUX, /* Big Linux. */ KERNEL_TYPE_FREEBSD, /* FreeBSD. */ KERNEL_TYPE_NETBSD, /* NetBSD. */ + KERNEL_TYPE_SBM, /* SmartBootManager. */ KERNEL_TYPE_CHAINLOADER /* Chainloader. */ } kernel_t;