Skip to contentSkip to conversation

aout support almost working now

DISCUSSION walt 3 participants 5 messages Feb 6, 2008 – Feb 7, 2008

lore
Share & tools
lore

walt

author
#0 lore raw

With Bean's last two commits I can almost replace legacy with grub2 at least on x86. I have still one problem with the aout support that Bean posted as a patch on Jan 27.

Using legacy, which loads the FreeBSD /boot/loader as the 'kernel', loader then reads its config files from the /boot directory so it knows what parameters to pass to the real kernel and also what menu items to show the user.

Using grub2 with Bean's aout patch, I can load /boot/loader and then boot it successfully, but it seems that 'loader' can't find its config files in the /boot directory. This is what it prints:

Can't work out which disk we are booting from. Guessed BIOS device 0xffffffff not found by probes, defaulting to disk0: can't load "kernel".

At least on my machine, disk0 is the floppy drive and loader does actually go to try to read it before printing the error messages I listed, and then it drops to its interactive prompt.

By examining the loader's variables it's clear that it never found its usual config files in /boot.

BTW, I did set 'root' and 'prefix' to point at the correct partition before booting the loader.

Any ideas what else to try?

#1 lore raw
Quoted 21 lines · walt

With Bean's last two commits I can almost replace legacy with grub2 at least on x86. I have still one problem with the aout support that Bean posted as a patch on Jan 27.

Using legacy, which loads the FreeBSD /boot/loader as the 'kernel', loader then reads its config files from the /boot directory so it knows what parameters to pass to the real kernel and also what menu items to show the user.

Using grub2 with Bean's aout patch, I can load /boot/loader and then boot it successfully, but it seems that 'loader' can't find its config files in the /boot directory. This is what it prints:

Can't work out which disk we are booting from. Guessed BIOS device 0xffffffff not found by probes, defaulting to disk0: can't load "kernel".

At least on my machine, disk0 is the floppy drive and loader does actually go to try to read it before printing the error messages I listed, and then it drops to its interactive prompt.

Quoted 7 lines

By examining the loader's variables it's clear that it never found its usual config files in /boot.

BTW, I did set 'root' and 'prefix' to point at the correct partition before booting the loader.

Any ideas what else to try?

i think the %edx should be set before jumping to code, try this patch:

kern/i386/loader.S +2 -0
index 266f4ef..88f3045 100644
@@ -137,6 +137,7 @@ FUNCTION(grub_multiboot_real_boot)
 	cli
 	
 	/* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
 	movl	$MULTIBOOT_MAGIC2,%eax
 	popl	%ecx
 	jmp 	*%ecx
@@ -159,6 +160,7 @@ FUNCTION(grub_multiboot2_real_boot)
         cli
 
         /* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
         movl    $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
         popl    %ecx
         jmp     *%ecx

Please note that this is not a proper patch, it assume booting from the (hd0,0,a). you can adjust the value of %edx if you boot from other partition.

Signature · 1 line
Bean
author
#2 lore raw
Quoted 53 lines · Bean
Quoted 21 lines · walt

With Bean's last two commits I can almost replace legacy with grub2 at least on x86. I have still one problem with the aout support that Bean posted as a patch on Jan 27.

Using legacy, which loads the FreeBSD /boot/loader as the 'kernel', loader then reads its config files from the /boot directory so it knows what parameters to pass to the real kernel and also what menu items to show the user.

Using grub2 with Bean's aout patch, I can load /boot/loader and then boot it successfully, but it seems that 'loader' can't find its config files in the /boot directory. This is what it prints:

Can't work out which disk we are booting from. Guessed BIOS device 0xffffffff not found by probes, defaulting to disk0: can't load "kernel".

At least on my machine, disk0 is the floppy drive and loader does actually go to try to read it before printing the error messages I listed, and then it drops to its interactive prompt.

Quoted 7 lines

By examining the loader's variables it's clear that it never found its usual config files in /boot.

BTW, I did set 'root' and 'prefix' to point at the correct partition before booting the loader.

Any ideas what else to try?

i think the %edx should be set before jumping to code, try this patch:

kern/i386/loader.S +2 -0
index 266f4ef..88f3045 100644
@@ -137,6 +137,7 @@ FUNCTION(grub_multiboot_real_boot)
  	cli
 
  	/* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
  	movl	$MULTIBOOT_MAGIC2,%eax
  	popl	%ecx
  	jmp 	*%ecx
@@ -159,6 +160,7 @@ FUNCTION(grub_multiboot2_real_boot)
          cli
 
          /* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
          movl    $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
          popl    %ecx
          jmp     *%ecx
Quoted 3 lines

Please note that this is not a proper patch, it assume booting from the (hd0,0,a). you can adjust the value of %edx if you boot from other partition.

Sorry, I don't know what adjustment to make. I did find a macro for MULTIBOOT_INFO_DISK_INFO but it's never actually used anywhere :o/

I'm trying to load (hd0,3,a) -- can you show me the right value for %edx ?

Thanks.

#3 lore raw
Quoted 21 lines · walt
Quoted 21 lines
kern/i386/loader.S +2 -0
index 266f4ef..88f3045 100644
@@ -137,6 +137,7 @@ FUNCTION(grub_multiboot_real_boot)
 	cli
 
 	/* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
 	movl	$MULTIBOOT_MAGIC2,%eax
 	popl	%ecx
 	jmp 	*%ecx
@@ -159,6 +160,7 @@ FUNCTION(grub_multiboot2_real_boot)
         cli
 
         /* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
         movl    $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
         popl    %ecx
         jmp     *%ecx
Quoted 8 lines
Quoted 3 lines

Please note that this is not a proper patch, it assume booting from the (hd0,0,a). you can adjust the value of %edx if you boot from other partition.

Sorry, I don't know what adjustment to make. I did find a macro for MULTIBOOT_INFO_DISK_INFO but it's never actually used anywhere :o/

I'm trying to load (hd0,3,a) -- can you show me the right value for %edx ?

If he guessed right, you don't need to do anything special, and 0x80 will work for you.

The patch is not correct because it breaks setups in which boot disk is not the first one. But that doesn't seem to affect you.

Signature · 5 lines
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)
author
#4 lore raw
Quoted 29 lines · Robert Millan
Quoted 28 lines · walt
Quoted 21 lines
kern/i386/loader.S +2 -0
index 266f4ef..88f3045 100644
@@ -137,6 +137,7 @@ FUNCTION(grub_multiboot_real_boot)
 	cli
 
 	/* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
 	movl	$MULTIBOOT_MAGIC2,%eax
 	popl	%ecx
 	jmp 	*%ecx
@@ -159,6 +160,7 @@ FUNCTION(grub_multiboot2_real_boot)
         cli
 
         /* Move the magic value into eax and jump to the kernel.  */
+	movl	$0x80, %edx
         movl    $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
         popl    %ecx
         jmp     *%ecx
Quoted 3 lines

Please note that this is not a proper patch, it assume booting from the (hd0,0,a). you can adjust the value of %edx if you boot from other partition.

Sorry, I don't know what adjustment to make. I did find a macro for MULTIBOOT_INFO_DISK_INFO but it's never actually used anywhere :o/

Quoted 7 lines
Quoted 1 line

I'm trying to load (hd0,3,a) -- can you show me the right value for %edx ?

If he guessed right, you don't need to do anything special, and 0x80 will work for you.

The patch is not correct because it breaks setups in which boot disk is not the first one. But that doesn't seem to affect you.

Sorry to report that this patch changes nothing :o( Behavior is exactly the same.

However, that particular section of code seems to be for multiboot kernels, and the FreeBSD kernel is not multiboot (yet). Could that be the problem?