On Mon, 22 Jan 2001, Carel Fellinger wrote:
Hi,
[...]
> But I found this other GPL-ed project (Smart Boot Manager or btmgr,
> see <http://www.gnuchina.org/~suzhe>). It too has support for booting
> from CD, and low and behold it works on two out of three here:)
>
> Helas, I've problems integrating it into GRUB myself and the author
> is willing to do it iff he finds the time.
>
> I thought that simply loading that code chain-booting would work,
> but I get an error like "unknown exe format". So what's the proper
> way of chain-loading a program from /boot/grub and how to compile
> and link such a pragram?
If you are interested, I have jus got it work few months ago. The
attached patch is again grub-0.5.96.
I have also disable few things in btmgr to get it working from file
instead of from floppy or disk, also I have disabled showing of partitions
in the bootmanager menu, so it shows now only whole disks, cdroms and
floppies. And another thing which I had to disable was saving of config,
because it overwrites it directly in the location where btmgr was
installed and it want work when it is installed in file. And also there is
few problems to install the btmgr to file, because the instalation program
does only installation to disk or floppy. But when you will do install to
floppy, you can grab few blocks from floppy with dd to file and it will
work I think. I have used other tricks by modifying the install program.
If you will be able to install it to file, tell me, and I will send you my
btmgr file. The second attached patch is patch for btmgr-3.6-2 to disable
things mentioned above.
Good luck with getting it working!
Best regards,
Stevo.
--
Stefan Ondrejicka <[EMAIL PROTECTED]>
Beethovenova 11, 917 08 Trnava, Slovakia
http://www.idata.sk/~ondrej/
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;