#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    86
    Rep Power
    6

    Writing bootloader


    Hi, i hope i am posting in the correct forum.

    I am working on a personal project and, have written a small hello world bootloader in ASM. however I have two small questions,

    1.
    When i use dd (ubuntu) to write my bootloader to the first sector of my usbdrive, the drive becomes unreadable (i need to format it before i can use it again). what am i doing wrong that it destroys the partition table,

    the command I use for this is: sudo dd if='/home/account/boot.bin' of='/dev/sdb1' (location of my usb-mounting point).

    2.
    Is there a way to create an ISO image where I put the boot.bin in the bootsection??

    Hope to hear from anyone soon,
    Fruitbisqit
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,379
    Rep Power
    1871
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2009
    Posts
    86
    Rep Power
    6
    that would indeed be usefull if I wanted to create a Windows or DOS bootdisk, i want to run my self-written bootloader.
  6. #4
  7. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,986
    Rep Power
    9397
    IIRC,

    1. You only have one block (whose size varies) to fit your bootloader. If you go beyond that you'll overwrite important stuff. Figure out the block size and restrict dd to that amount (like with bs=1234 count=1).

    2. Yeah. Create an ISO/IMG of whatever you want and write your bootloader into it instead of the USB itself.

IMN logo majestic logo threadwatch logo seochat tools logo