Page 1 of 1

USB Boot with assembly

Posted: Sun Sep 07, 2008 4:23 pm
by golden-i
hi , i was trying to follow the steps in the : http://wiki.osdev.org/Babystep2

the idea is to create a bootloader that will display a message on the screen this is the code i used and i named the file "boot.asm"

Code: Select all

; boot.asm
   mov ax, 0x07c0
   mov ds, ax

   mov si, msg
ch_loop:lodsb
   or al, al ; zero=end or str
   jz hang   ; get out
   mov ah, 0x0E
   int 0x10
   jmp ch_loop

hang:
   jmp hang

msg   db 'Welcome to Macintosh', 13, 10, 0
   times 510-($-$$) db 0
   db 0x55
   db 0xAA
i did follow the steps from the WIKI babystep1 to get the "boot.bin" file and then i used this Command to make a bootable Floppy :

Code: Select all

dd if=boot.bin of=/dev/fd0
and it did work perfectly , but then i looked for 2 days to find a way to make a bootable USB with this "boot.bin" file but sadly i didn't find any good tutorial or sample so i just used the same command but this time i used my USB drive with this command :

Code: Select all

dd if=boot.bin of=/dev/sdb1
where sdb1 is my USB drive , then i tested my USB with my laptop and it made it reboot each time it reads from the USB !! ??

anyway all i need is a way to make my USB drive bootable with a message in the screen ... so if anyone can find what is best way to do this please help .

by the way i formated my 2GB USB flash disk with fdisk , Primary partition , 1 , default size , active , bootable , FAT16.



thanks in advance

Re: USB Boot with assembly

Posted: Mon Sep 08, 2008 12:24 am
by Stevo14
Try "/dev/sdb", without the 1. This gives you access to the whole dive, from the first byte to the last (and it will destroy any file system that might be on the drive). "/dev/sdb1" only gives you access to the first partition which does not start at the beginning of the drive.

Re: USB Boot with assembly

Posted: Mon Sep 08, 2008 2:28 am
by golden-i
WAW , this is so funny ... YES IT DID WORK :P :P

thanks you Stevo14 =D> =D>

Naw i will go back to the WIKI .... #-o

Re: USB Boot with assembly

Posted: Mon Sep 08, 2008 6:19 am
by Stevo14
golden-i wrote: thanks you Stevo14 =D> =D>
No problem. I'm glad I could help. :) Good luck osdev-ing.