Jump to content











Photo
- - - - -

Boot Haiku via grub4dos

haiku grub4dos

  • Please log in to reply
4 replies to this topic

#1 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 08 February 2015 - 10:13 PM

I found a way to boot Haiku anyboot images using grub4dos.

You can read my blog post for details (now supported by E2B)

 

Here is a summary of the grub4dos code - note that Partition 4 of the USB drive is created using the partnew command, so the 4th partition entry on the USB drive must be unused, but after booting it will contain a BeoS type EB partition.

The crucial bit is patching the PBR to point to itself!

 

Note: Instead of configfile (md)0xa000+0x50 (which is used for E2B)  you can reload your menu using configfile /menu.lst.

title Haiku anyboot \n Boot to Haiku
set ISOC=/_ISO/haiku-nightly-anyboot.image
partnew (hd0,3) 0xEB %ISOC% || echo && echo -e ERROR: %ISOC% is not contiguous or is BAD!\nPlease fix using RMPrepUSB-CTRL+F2. && pause Press a key... && configfile (md)0xa000+0x50
dd if=(hd0)0+1 of=(md)0x300+1 > nul
# get length
read 0x601fa > nul
set /A LEN=%@retval%&0xffffffff > nul
#echo ***** LEN=%LEN%
map --read-only %ISOC% (hd15) > nul
map --hook
dd if=(hd15)0+1 of=(md)0x300+1 > nul
# check for valid MBR
read 0x601fe > nul
set /A MAGIC=%@retval%&0xffff > nul
if /i not "%MAGIC%"=="0xaa55" echo -e SORRY: %ISOC% is not a decompressed image file - please try WinRar or 7Zip to decompress it first! && pause && partnew (hd0,3) 0 0 0 && configfile (md)0xa000+0x50
set MAGIC=
# find EB partition
set STOFF=
set /A TYP=*0x601c2 & 0xff > nul
if /i "0xeb"=="%TYP%" && set STOFF=0x601c6 && echo Found EB partition in PTN 1 of %ISOC%
set /A TYP=*0x601d2 & 0xff > nul
if /i "0xeb"=="%TYP%" && set STOFF=0x601d6 && echo Found EB partition in PTN 2 of %ISOC%
set /A TYP=*0x601e2 & 0xff > nul
if /i "0xeb"=="%TYP%" && set STOFF=0x601e6 && echo Found EB partition in PTN 3 of %ISOC%
set /A TYP=*0x601f2 & 0xff > nul
if /i "0xeb"=="%TYP%" && set STOFF=0x601f6 && echo Found EB partition in PTN 4 of %ISOC%
if "%STOFF%"=="" pause SORRY: Cannot find a type EB partition in the image! && partnew (hd0,3) 0 0 0 && configfile (md)0xA000+0x50
set TYP=
# get start PBR inside image
read %STOFF% > nul
set /A OFFSTART=%@retval%&0xffffffff > nul
#echo ***** OFFSTART=%OFFSTART%
set /A L=%LEN%-%OFFSTART% > nul
#echo **** L=%L% OFFSTART=%OFFSTART%
echo
echo -e Creating new partition 4 on hd0 using command: partnew (hd0,3) 0xEB (hd0,3)%OFFSTART%+%L%\nYou will need to remove partition 4 when you next boot E2B (see Sample_MyE2B.cfg for details).
partnew (hd0,3) 0xEB  (hd0,3)%OFFSTART%+%L%
echo
# patch 4 bytes at 1fa (706 dec) with ptn start
dd if=(hd0,3)+1 of=(md)0x300+1
dd if=(hd0)+1 of=(md)0x200+1
debug 1
#echo -e -n Partition offset was\x20 && read 0x601fa
#echo -e -n Partition start =\x20
read 0x401f6 > nul
set patch=%@retval%
write 0x601fa %patch% > nul
echo
echo Patching offset 706 in sector (hd0,3) with value %patch%...
dd of=(hd0,3)+1 if=(md)0x300+1
# unmap file
map --unhook
map --unmap=0x8f
# boot from new partition
chainloader (hd0,3)+1
rootnoverify (hd0,3)
set STOFF=
set L=
set OFFSTART=
set LEN=
set patch=
# ptn type must be kept as EB or won't boot
boot

  • Brito likes this

#2 roytam1

roytam1

    Member

  • Developer
  • 99 posts
  •  
    Hong Kong

Posted 29 May 2015 - 02:05 AM

does this still work in latest nightly images?



#3 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 29 May 2015 - 09:09 AM

It works on hrev49207 anyboot image (just tested).

On E2B just give it a .haiku file extension.



#4 roytam1

roytam1

    Member

  • Developer
  • 99 posts
  •  
    Hong Kong

Posted 29 May 2015 - 03:35 PM

It works on hrev49207 anyboot image (just tested).

On E2B just give it a .haiku file extension.

I tried here and it gives me blank//black screen and waits forever.

(The Test Machine has no harddisk attached. only USB thumbdrive(with G4D 0.4.6a) and CD-ROM is attached.



#5 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 29 May 2015 - 05:32 PM

I used VBox (64-bit VM) +VMUB utility and EeePC 904 32-bit system . E2B v1.68 with grub4dos 0.4.6a 2015-05-18.

Both OK.







Also tagged with one or more of these keywords: haiku, grub4dos

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users