Raspberry Pi: Creating BerryBoot optimized image (the dirty way)

By | April 17, 2013

Goal: To add custom operating system to BerryBoot menu
Problems met: Invalid sector block size, invalid partition info, incompatible filesystem, error when perform kpartx and mounting

1. Write .img file (example: XBian1.0Alpha5.img) into USB drive using win32diskimager. Wait until it complete.
2. Connect and mount USB drive into your linux OS. I’m using Xubuntu installed in VirtualBox, so i need to click and select my USB device into guest OS.

3.Once the USB device recognized, it’ll be shown in your desktop. 2 partitions will be displayed. First partition has a FAT partition with the bootloader and kernel files while the second one is an ext4 partition with everything else. Mount the second partition into your desired location, or you can just perform right-click and mount. Mine is mounted at /media/user/

4. Then you can follow instruction given from berryboot website on how to convert the image files into squashfs file.

$ sudo sed -i 's/^\/dev\/mmcblk/#\0/g' /media/user/changethiswithyourdeviceID
$ sudo mksquashfs /media/user/changethiswithyourdeviceID converted_image_for_berryboot.img -comp lzo -e lib/modules

I’m getting syntax error in sed command, so i replaced the ‘ sign with ” sign:
sed -i "s/^\/dev\/mmcblk/#\0/g"

5. BerryBoot optimized file creation doneMS590SwYa-L2mr8T_yqQarSIIxxfLd-_oucW-LfBJk8