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

Difference between revisions of "Rock/make sd image"

(get the parameter)
(build the kernel)
Line 19: Line 19:
  
 
=== build the kernel ===
 
=== build the kernel ===
Follow the [[Rock/Booting_Linux| Booting Linux]] page to make the '''boot.img'''.
+
Follow the [[Rock/Booting_Linux| Booting Linux(3.0.36)]] or [[Rock/Linux_Mainline| build mainline kernl]] page to make the '''boot.img'''.
  
 
=== make the roofts ===
 
=== make the roofts ===

Revision as of 08:41, 5 March 2015

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                                      #where to get rkcrc, refer to http://radxa.com/Rock/flash_the_image "Flash with rkflashtool"

build the kernel

Follow the Booting Linux(3.0.36) or build mainline kernl 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.