[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian images and USB sticks



Hi,

i wrote
> >   dd if=/dev/sdX bs=512 count=1 | od od -t x1

Renato Bispo wrote:
> the command you sent didn't work:

A copy+paste error indeed. A single "od" would have been right.


> 0000000 b8fa 1000 d08e 00bc b8b0 0000 d88e c08e

A bit pattern widely known to the web.

  http://superuser.com/questions/317372/editing-mbr-for-flash-device
advises to use "parted" and predicts that this code will be on the
medium.

Other than gparted, parted is in my scope. So i try

  dd if=/dev/zero bs=4M count=1 >test.img

  /sbin/parted test.img mklabel msdos

  dd if=test.img bs=512 count=1 | hexdump 

and get

  0000000 b8fa 1000 d08e 00bc b8b0 0000 d88e c08e
  0000010 befb 7c00 00bf b906 0200 a4f3 21ea 0006
  0000020 be00 07be 0438 0b75 c683 8110 fefe 7507
  0000030 ebf3 b416 b002 bb01 7c00 80b2 748a 8b01
  0000040 024c 13cd 00ea 007c eb00 00fe 0000 0000
  ...
  [empty partition table]
  ...
  00001f0 0000 0000 0000 0000 0000 0000 0000 aa55


So the prescription would be to let parted (or frontends) install
its MBR, to create a partition with boot flag, to re-isohybridize
a Debian i386 or amd64 ISO image, and to put it into the partition.

This is to be executed only once before any other partitions get
created on the USB stick. end_megabyte minus start_megabyte must
offer enough room to take the ISO image.

  dev=/dev/sdc
  start_megabyte=1
  end_megabyte=316
  image_path="$HOME/Downloads/debian-8.2.0-i386-netinst.iso"

  sudo /sbin/parted "$dev" mklabel msdos

  sudo /sbin/parted "$dev" mkpart primary $start_megabyte $end_megabyte

  sudo /sbin/parted "$dev" set 1 boot on

  isohybrid --partok "$image_path"

  dd if="$image_path" of="$dev" bs=1M

This is expected to boot via BIOS but not via EFI (unless BIOS emulation).

One may now create more partitions and populate them with filesystems,
e.g. another isohybrid --partok ISO.
One of those which contain bootable MBRs can be selected by

  part_number=3

  sudo /sbin/parted "$dev" set $part_number boot on


Now i wonder whether this procedure works for you, or whether i made
a copy+paste mistake again. (I did not use /dev/sdc but rather test.img.)


Have a nice day :)

Thomas


Reply to: