title: Emulating Raspberry Pi on OSX
body: <p>After looking for the solution I realized that this could only be done by using QEMU.</p>
  
  <ul>
  <li>I downloaded the kernel:</li>
  </ul>
  
  <p><a href="https://codeload.github.com/dhruvvyas90/qemu-rpi-kernel/zip/master" rel="nofollow">https://codeload.github.com/dhruvvyas90/qemu-rpi-kernel/zip/master</a></p>
  
  <ul>
  <li>And the Raspbian image:</li>
  </ul>
  
  <p><a href="https://www.raspberrypi.org/downloads/raspbian/" rel="nofollow">https://www.raspberrypi.org/downloads/raspbian/</a></p>
  
  <ul>
  <li>Installed QEMU after installing it dependencies</li>
  </ul>
  
  <p>Then run qemu with following parameters</p>
  
  <pre><code> qemu-system-arm \
    -cpu arm1176 \
    -m 256 \
    -M versatilepb \
    -no-reboot \
    -serial stdio \
    -append "root=/dev/sda2 panic=1 rootfstype=ext2 rw init=/bin/bash earlyprintk loglevel=8 console=ttyAMA0,115200" \
    -kernel /kernel/kernel-qemu-4.1.13-jessie \
    -drive file=/img/raspbian.img,index=0,media=disk,format=raw
  </code></pre>
  
  <p>I get the following errors</p>
  
  <pre><code>EXT4-fs (sda2): bad geometry: block count 944128 exceeds size of device (944127 blocks)
  EXT4-fs (sda2): bad geometry: block count 944128 exceeds size of device (944127 blocks)
  List of all partitions:
  0100            4096 ram0  (driver?)
  0101            4096 ram1  (driver?)
  0102            4096 ram2  (driver?)
  0103            4096 ram3  (driver?)
  0104            4096 ram4  (driver?)
  0105            4096 ram5  (driver?)
  0106            4096 ram6  (driver?)
  0107            4096 ram7  (driver?)
  0108            4096 ram8  (driver?)
  0109            4096 ram9  (driver?)
  010a            4096 ram10  (driver?)
  010b            4096 ram11  (driver?)
  010c            4096 ram12  (driver?)
  010d            4096 ram13  (driver?)
  010e            4096 ram14  (driver?)
  010f            4096 ram15  (driver?)
  0800         3842047 sda  driver: sd
    0801           61440 sda1 ea0e7380-01
    0802         3776511 sda2 ea0e7380-02
  0b00         1048575 sr0  driver: sr
  1f00           65536 mtdblock0  (driver?)
  No filesystem could mount root, tried:  ext4
  Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,2)
  </code></pre>
  
  <p>I googled a bit about this issue and nobody seems to care, or even give a workaround on this solution as it seems like OSX cant work with ext4 partitions.</p>