Make Linux SD Card to Startup System

Update time:2018-01-23 Views:594

Foreword

This article describes how to make Linux SD card which can boot system.

Prepare

  • ROC-RK3328-CC Development board

  • Firmware

  • Linux Host Computer

Please refer to 《Build Kernel》 and 《Build Ubuntu Rfs》 instructions to compile partition images, or you can download here to obtain a unified firmware.

Process of Making Linux Boot Card

using scripts to make

you need to use Linux dd command to write the startup files into the SD card, the steps  are as follows:

  • Compile the kernel

./build/mk-kernel.sh rk3328-roc-cc
  • Compile the u-boot

./build/mk-uboot.sh rk3328-roc-cc
  • Make Ubuntu rootfs

see 《Build Ubuntu Rfs》

  • Synthesis system.img file for the production of the boot card  in the next step

build/mk-image.sh -c rk3328 -t system -r rk-rootfs-build/linaro-rootfs.img

Run the following command to write the unified firmware system.img generated above into the SD card:

build/flash_tool.sh -c rk3328 -d /dev/sdb -p system -i out/system.img

using dd command to make

Here you also need to insert  the SD card to the computer

Run the following command to write the unified firmware system.img into the SD card:

pv -tpreb out/system.img | sudo dd of=/dev/sdb seek=0 conv=notrunc && sync

You can also run  the following commands to write a partitioned image into an SD card

sudo dd if=./out/u-boot/rk3328_loader_ddr786_v1.06.243.bin of=/dev/sdb seek=0 conv=sync,fsync

sudo dd if=./out/u-boot/idbloader.img of=/dev/sdb seek=64      conv=sync,fsync 
sudo dd if=./out/u-boot/uboot.img     of=/dev/sdb seek=16384   conv=sync,fsync
sudo dd if=./out/u-boot/trust.img     of=/dev/sdb seek=24576   conv=sync,fsync
sudo dd if=./out/boot.img             of=/dev/sdb seek=32768   conv=sync,fsync
sudo dd if=./out/linaro-rootfs.img    of=/dev/sdb seek=262144  conv=sync,fsync

using graphical interface tools DDWin for windows

If you are windows users, you can choose DDWin tool  DDWin for download

DDWin is a tool that has  the same features as the command dd and provides the functionality of a graphical interface that makes it easy to write images. Insert the SD card into your computer, then open DDWin,Note win10 may need to use administrator privileges to run

Click the "Choose disk"button, As shown, it will automatically select the drive letter in which the SD card locates.


ddwin_1.png


Then click the "Choose file"button, then the window will pop up a dialog box to choose some files, select the image to be writtend, and click "OK" button.


ddwin_2.png


Finally, click  the "Restore" button, when warning window appears, just click "Yes",  and then burn the selected unified firmware into the SD card


ddwin_3.png

ddwin_4.png


After the progress bar finished, it means that the SD boot card has been made successfully.

Start the System

Insert the SD card into the ROC-RK3328-CC board and power on. The first thing you need to start in the serial console is to press Enter key to enter the configuration mode, run the following commands to make gpt partition table for SD card, the system will restart again and  automatically load the rootfs file system.

gpt write mmc 1 $partitions
boot