Difference between revisions of "Boot option"

From Rockchip open source Document
Jump to: navigation, search
Line 125: Line 125:
 
<pre>mv linaro-rootfs.img rootfs.img
 
<pre>mv linaro-rootfs.img rootfs.img
 
</pre>
 
</pre>
 +
  
 
=== Making a SD Card for updating ===
 
=== Making a SD Card for updating ===
  
 
Download&nbsp;[https://github.com/wzyy2/rk-initrd-build ramdisk source]&nbsp;and build.
 
Download&nbsp;[https://github.com/wzyy2/rk-initrd-build ramdisk source]&nbsp;and build.
<pre><code>sh ./mk-initrd.sh</code>
+
<pre>sh ./mk-initrd.sh
 
</pre>
 
</pre>
  
 
Format SD card
 
Format SD card
<pre><code>chen@chen-HP-ProDesk-680-G1-TWR:~/work/linaro-alip/ramdisk/update$ sudo gdisk /dev/sdb
+
<pre>chen@chen-HP-ProDesk-680-G1-TWR:~/work/linaro-alip/ramdisk/update$ sudo gdisk /dev/sdb
 
GPT fdisk (gdisk) version 0.8.8
 
GPT fdisk (gdisk) version 0.8.8
  
Line 165: Line 166:
 
Warning: The kernel is still using the old partition table.
 
Warning: The kernel is still using the old partition table.
 
The new table will be used at the next reboot.
 
The new table will be used at the next reboot.
The operation has completed successfully.</code>
+
The operation has completed successfully.
 
</pre>
 
</pre>
<pre><code>sudo umount /dev/sdb1
+
<pre>sudo umount /dev/sdb1
sudo mkfs.fat /dev/sdb1</code>
+
sudo mkfs.fat /dev/sdb1
 
</pre>
 
</pre>
<pre><code>tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin out&&
+
<pre>tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin out&&
sudo dd if=out of=/dev/sdb seek=64&&sudo dd if=u-boot-dtb.img of=/dev/sdb seek=256</code>
+
sudo dd if=out of=/dev/sdb seek=64&&sudo dd if=u-boot-dtb.img of=/dev/sdb seek=256
 
</pre>
 
</pre>
  
 
Copy zimage, dts and ramdisk to /dev/sdb1
 
Copy zimage, dts and ramdisk to /dev/sdb1
<pre><code>cp arch/arm/boot/zImage /media/chen/9F35-9565/
+
<pre>cp arch/arm/boot/zImage /media/chen/9F35-9565/
 
cp arch/arm/boot/dts/rk3288-fennec.dtb /media/chen/9F35-9565/rk3288-fennec.dtb
 
cp arch/arm/boot/dts/rk3288-fennec.dtb /media/chen/9F35-9565/rk3288-fennec.dtb
cp ../rk-initrd-build/initrd.img /media/chen/9F35-9565/</code>
+
cp ../rk-initrd-build/initrd.img /media/chen/9F35-9565/
 
</pre>
 
</pre>
  
 
Add extlinux/extlinux.conf to /dev/sdb1
 
Add extlinux/extlinux.conf to /dev/sdb1
<pre><code>label kernel-4.4
+
<pre>label kernel-4.4
 
     kernel /zImage
 
     kernel /zImage
 
     fdt /rk3288-fennec.dtb
 
     fdt /rk3288-fennec.dtb
 
     initrd /initrd.img
 
     initrd /initrd.img
     append  earlyprintk console=ttyS2,115200n8 rw root=/dev/ram0 rootfstype=ext4 init=/sbin/init ramdisk_size=49152</code>
+
     append  earlyprintk console=ttyS2,115200n8 rw root=/dev/ram0 rootfstype=ext4 init=/sbin/init ramdisk_size=49152
 
</pre>
 
</pre>
  
 
Copy u-boot-dtb.img uboot-spl.img boot.img rootfs.img and&nbsp;[https://github.com/wzyy2/rk-initrd-build/blob/master/update/update.sh update.sh]&nbsp;to /dev/sdb1
 
Copy u-boot-dtb.img uboot-spl.img boot.img rootfs.img and&nbsp;[https://github.com/wzyy2/rk-initrd-build/blob/master/update/update.sh update.sh]&nbsp;to /dev/sdb1
<pre><code>mkdir /media/chen/9F35-9565/update
+
<pre>mkdir /media/chen/9F35-9565/update
 
cp u-boot-dtb.img /media/chen/9F35-9565/update
 
cp u-boot-dtb.img /media/chen/9F35-9565/update
 
cp uboot-spl.img /media/chen/9F35-9565/update
 
cp uboot-spl.img /media/chen/9F35-9565/update
 
cp boot.img /media/chen/9F35-9565/update
 
cp boot.img /media/chen/9F35-9565/update
 
cp rootfs.img /media/chen/9F35-9565/update
 
cp rootfs.img /media/chen/9F35-9565/update
cp update.sh /media/chen/9F35-9565/update</code>
+
cp update.sh /media/chen/9F35-9565/update
 
</pre>
 
</pre>
  

Revision as of 09:46, 17 March 2017

 

overview

+--------+----------------+----------+-----------+
| Boot   | Terminology #1 | Actual   | Rockchip  |
| stage  |                | program  |  Loader   |
| number |                | name     |   Name    |
+--------+----------------+----------+-----------+
| 1      |  Primary       | ROM code | BootRom   |
|        |  Program       |          |           |
|        |  Loader        |          |           |
|        |                |          |           |
| 2      |  Secondary     | u-boot   | MiniLoader|
|        |  Program       | SPL      |           |
|        |  Loader (SPL)  |          |           |
|        |                |          |           |
| 3      |  -             | U-Boot   |  U-Boot   |
|        |                |          |           |
|        |                |          |           |
| 4      |  -             | kernel   |  kernel   |
|        |                |          |           |
| 5      |  -             | rootfs   |  rootfs   |
+--------+----------------+----------+-----------+

Boot from eMMC

 To get tool and firmware

tools

Flash to the board by USB

In order to flash by USB,you must get your board into ROM boot mode, either by erasing
your MMC or holding the maskrom button when you boot the board.

 

RK3288(upgrade_tool)

To create a suitable image and flash it to the board:
default : with CONFIG_ROCKCHIP_SPL_BACK_TO_BROM

tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin out<br/> cat u-boot-dtb.bin >> out<br/> sudo upgrade_tool db  ../rkbin/rk32/RK3288UbootLoader_V2.30.06.bin<br/> sudo upgrade_tool wl 64 out<br/> sudo upgrade_tool rd


others : firefly(Recommend using sd card)

 


RK3036

To create a suitable image and flash it to the board:

tools/mkimage -n rk3036 -T rksd -d spl/u-boot-spl-dtb.bin out
cat u-boot-dtb.bin >> out
sudo upgrade_tool db  ../rkbin/rk30/RK3036MiniLoaderAll_V2.19.bin
sudo upgrade_tool wl 64 out
sudo upgrade_tool rd


RK3399

cd ..
./rkbin/tools/trust_merger ./rkbin/tools/RK3399TRUST.ini
cd uboot

../rkbin/tools/loaderimage --pack --uboot u-boot-dtb.bin uboot.img

sudo upgrade_tool UL   ../rkbin/rk33/RK3399MiniLoaderAll_V1.05.bin
sudo upgrade_tool DI uboot uboot.img  ../rkbin/tools/rk3399_parameter.txt 
sudo upgrade_tool DI trust ../trust.img  ../rkbin/tools/rk3399_parameter.txt
sudo upgrade_tool rd

 


 To flash kernel and rootfs

Enter into the uboot and issue the following command on uboot: (otg should be connected)

gpt write mmc 0 $partitions
ums 0 mmc 0


Now the board will act as an USB-drive.
In host: (assuming sdb is ur device)

sudo mkfs.fat /dev/sdb6


Copy zimage and dts file to dev/sdb6

cp arch/arm/boot/zImage /media/chen/9F35-9565/
cp arch/arm/boot/dts/rk3288-fennec.dtb /media/chen/9F35-9565/rk3288-fennec.dtb

Add extlinux/extlinux.conf to dev/sdb6
(Please notice "mmcblk2p7" and "115200n8" is decide on your chip, Please refer to config table)

label kernel-4.4
    kernel /zImage
    fdt /rk3288-fennec.dtb
    append  earlyprintk console=tty1 console=ttyS2,115200n8 rw root=/dev/mmcblk2p7 rootfstype=ext4 init=/sbin/init


To flash rootfs

sudo dd if=linaro-rootfs.img of=/dev/sdb7 conv=notrunc

Boot from SD/TF Card

Creating Image

Follow linux-user-guide to build kernel and U-Boot.
get uboot-spl.img and u-boot-dtb.img

tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin uboot-spl.img



build boot.img

sudo dd if=/dev/zero of=boot.img bs=1M count=128
sudo mkfs.fat boot.img
mkdir boot
sudo mount  boot.img boot
sudo cp zImage boot
sudo cp rk3288-fennec.dtb boot
sudo mkdir boot/extlinux
sudo cp extlinux.conf boot/extlinux
sudo umount boot

Download rootfs image and rename it

mv linaro-rootfs.img rootfs.img


Making a SD Card for updating

Download ramdisk source and build.

sh ./mk-initrd.sh

Format SD card

chen@chen-HP-ProDesk-680-G1-TWR:~/work/linaro-alip/ramdisk/update$ sudo gdisk /dev/sdb
GPT fdisk (gdisk) version 0.8.8

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-126613470, default = 2048) or {+-}size{KMGTP}: 8192
Last sector (8192-126613470, default = 126613470) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sdc.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
sudo umount /dev/sdb1
sudo mkfs.fat /dev/sdb1
tools/mkimage -n rk3288 -T rksd -d spl/u-boot-spl-dtb.bin out&&
sudo dd if=out of=/dev/sdb seek=64&&sudo dd if=u-boot-dtb.img of=/dev/sdb seek=256

Copy zimage, dts and ramdisk to /dev/sdb1

cp arch/arm/boot/zImage /media/chen/9F35-9565/
cp arch/arm/boot/dts/rk3288-fennec.dtb /media/chen/9F35-9565/rk3288-fennec.dtb
cp ../rk-initrd-build/initrd.img /media/chen/9F35-9565/

Add extlinux/extlinux.conf to /dev/sdb1

label kernel-4.4
    kernel /zImage
    fdt /rk3288-fennec.dtb
    initrd /initrd.img
    append  earlyprintk console=ttyS2,115200n8 rw root=/dev/ram0 rootfstype=ext4 init=/sbin/init ramdisk_size=49152

Copy u-boot-dtb.img uboot-spl.img boot.img rootfs.img and update.sh to /dev/sdb1

mkdir /media/chen/9F35-9565/update
cp u-boot-dtb.img /media/chen/9F35-9565/update
cp uboot-spl.img /media/chen/9F35-9565/update
cp boot.img /media/chen/9F35-9565/update
cp rootfs.img /media/chen/9F35-9565/update
cp update.sh /media/chen/9F35-9565/update

Updating the board

Boot the board and it will flash image to eMMC

 

Boot from USB-Disk

Same as boot-from-sdcard, but please note that U-Boot aren't allowed to boot from usb-disk because of restrict of maskrom, only kernel and rootfs can load from USB-Disk.

Difference:

<code>label kernel-4.4
    kernel /zImage
    fdt /rk3288-fennec.dtb
    append  earlyprintk console=ttyS2,115200n8 rw root=/dev/sda1 rootfstype=ext4 init=/sbin/init</code>
<code>gpt write usb 0 $partitions
ums 0 usb 0</code>

Boot from Network