Saturday, August 10, 2013

Install Debian on an emulated ARM machine in Mac OS and Windows

A quick post with some commands to create a running ARM machine in your hackintosh or Windows.

  1. Install QEMU.
    • On Mac:
      1. You need Homebrew. If you do not have it, stop everything and go install it.
      2. Then install QEMU.
        brew install qemu
    • On Windows: Download and install the prebuilt QEMU.
  2. Download a pre-built ARM kernel and init ramdisk from Debian.
    wget --continue
    wget --continue
  3. Create a raw disk image for your virtual machine.
    qemu-img create -f raw hda.img 2G
  4. Launch the virtual machine and finish installation. You will see a no-boot-loader warning near the end. Do not worry about it. When the machine reboots, you can safely terminate QEMU.
    qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.gz -m 256 -hda hda.img
  5. Extract the newly installed kernel and init image.
    • On Mac:
      1. Install ext4fuse. Remember to copy the kernel extension (kext) to the right place and chmod it properly.
        brew install ext4fuse
      2. Mount the disk image to extract the installed kernel and init ramdisk.
        hdiutil attach -noverify -nomount hda.img
        # take note of the device name
        mkdir tmp_mnt
        ext4fuse <device> tmp_mnt
        cp tmp_mnt/boot/initrd* tmp_mnt/boot/vmlinuz* .
        umount tmp_mnt
        rm -rf tmp_mnt
        hdiutil detach <device>
    • On Windows: Use Ext2Read to mount hda.img and extract the files from /boot.
  6. Launch the virtual machine again with the new kernel and init ramdisk. Notice that you need to replace the kernel and init ramdisk in the below command with what you copied in the above command.
    qemu-system-arm -M versatilepb -kernel vmlinuz... -initrd initrd... -m 256 -hda hda.img -append "root=/dev/sda1"

1 comment:

  1. later qemu-system-arm -M versatilepb -kernel vmlinuz-3.2.0-4-versatile -initrd initrd.gz -m 256 -hda hda.img nothing happens.. I´m using windows 8.1...