USB Boot with assembly

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
golden-i
Posts: 2
Joined: Fri Jun 30, 2006 3:04 pm

USB Boot with assembly

Post 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
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Re: USB Boot with assembly

Post 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.
golden-i
Posts: 2
Joined: Fri Jun 30, 2006 3:04 pm

Re: USB Boot with assembly

Post 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
User avatar
Stevo14
Member
Member
Posts: 179
Joined: Fri Mar 07, 2008 3:40 am
Location: Arad, Romania

Re: USB Boot with assembly

Post by Stevo14 »

golden-i wrote: thanks you Stevo14 =D> =D>
No problem. I'm glad I could help. :) Good luck osdev-ing.
Post Reply