Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Rock/make sd image

< Rock
Revision as of 10:23, 21 January 2015 by Hipboi (Talk | contribs)

Rock/pro/lite has on board NAND flash, but can also boot from exteranl uSD card. uSD card has a higher booting priority. This page introduce how to make a completely off NAND bootable image for sd card.

Introduction

To boot from uSD card and run the system on uSD card, we need the following

  • bootloader for booting from uSD card - u-boot-sd.img
  • parameter for uSD card layout and kernel cmdline - parameter.img
  • kernel+ramdisk - boot.img
  • a rootfs - rootfs.ext4

Prepare images

u-boot for sdcard

Follow the instruction at Make u-boot for sdcard to create the u-boot-sd.img for sd card.

get the parameter

Download the parameter from dl.radxa.com

wget http://dl.radxa.com/rock/images/parameter/parameter_linux_sd
rkcrc -p parameter_linux_sd parameter.img

build the kernel

Follow the Booting Linux page to make the boot.img.

make the roofts

Follow the instructions here to make the Ubuntu or Debian rootfs - rootfs.ext4.

Write to the sdcard

First, let's clean the uSD card.

sudo dd if=/dev/zero of=/dev/sdx bs=1M count=1

Then, create the partitions with fdisk

export START_SECTOR=65536              # important, need to reserve some sectors for boot.img/parameter/bootloader before the filesystem starts.
sudo fdisk /dev/sdx  << EOF
n
p
1
$START_SECTOR

w
EOF

Now we have a new partition for rootfs starting at START_SECTOR. It's time to write the images to the sdcard.

sudo dd if=u-boot-sd.img of=/dev/sdx conv=sync seek=64 
sudo dd if=parameter.img of=/dev/sdx conv=sync seek=$((0x2000))
sudo dd if=boot.img of=/dev/sdx conv=sync seek=$((0x2000+0x2000))
sudo dd if=rootfs.ext4 of=/dev/sdx1 conv=sync

Insert the uSD card to rock/pro/lite, you can boot from uSD card now.