📢 ROC-RK3568-PC入門篇連載行程:
? [ROC-RK3568-PC] 手把手教你把出廠的Android系統燒寫為Ubuntu系統
? [ROC-RK3568-PC] 手把手教你制作Ubuntu系統TF卡啟動盤
? [ROC-RK3568-PC] 手把手教你編譯Linux_SDK并打包Ubuntu系統韌體
? [ROC-RK3568-PC] 手把手教你解包Ubuntu系統韌體
? [ROC-RK3568-PC] 手把手教你在Linux下解包與打包Ubuntu系統韌體
在前面我帶領大家如何通過編譯Linux_SDK從而打包出自己的Ubuntu系統韌體:
[ROC-RK3568-PC] 手把手教你編譯Linux_SDK并打包Ubuntu系統韌體
但是這種生成的韌體并不是Raw韌體,它是由Rockchip官方自定義的一種打包方式(不開源)韌體,在燒寫的時候只能使用Rockchip相關工具進行燒寫!
那我想打包成Raw韌體該怎么辦?別急,這篇給大家揭曉!
文章目錄
- 1、準備工具
- 2、Raw韌體打包
- 3、燒寫Raw韌體
- 3.1 balenaEtcher工具燒寫
- 3.2 Linux dd命令燒寫
1、準備工具
工欲善其事,必先利其器,為了盡可能避免發生奇怪的錯誤,我在這里列舉一下大家需要用到的工具:
- balenaEtcher (Linux/Windows/Mac)、或dd命令 (Linux)、或其他第三方工具
- 良好的TF卡與讀卡器
2、Raw韌體打包
(1)選擇板卡組態檔:
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh device/rockchip/rk356x/roc-rk3568-pc-ubuntu.mk
processing option: device/rockchip/rk356x/roc-rk3568-pc-ubuntu.mk
(2)查看build.sh腳本幫助資訊:
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh -h
Usage: build.sh [OPTIONS]
Available options:
*.mk -switch to specified board config
launch -list current SDK boards and switch to specified board config
uboot -build uboot
spl -build spl
loader -build loader
kernel -build kernel
modules -build kernel modules
toolchain -build toolchain
extboot -build extlinux boot.img, boot from EFI partition
rootfs -build default rootfs, currently build buildroot as default
buildroot -build buildroot rootfs
ramboot -build ramboot image
multi-npu_boot -build boot image for multi-npu board
yocto -build yocto rootfs
debian -build debian9 stretch rootfs
distro -build debian10 buster rootfs
openwrt -build openwrt rootfs
pcba -build pcba
recovery -build recovery
all -build uboot, kernel, rootfs, recovery image
cleanall -clean uboot, kernel, rootfs, recovery
firmware -pack all the image we need to boot up system
updateimg -pack update image
rawimg -pack raw image
otapackage -pack ab update otapackage image (update_ota.img)
sdpackage -pack update sdcard package image (update_sdcard.img)
save -save images, patches, commands used to debug
allsave -build all & firmware & updateimg & save
check -check the environment of building
info -see the current board building information
app/<pkg> -build packages in the dir of app/*
external/<pkg> -build packages in the dir of external/*
Default option is 'allff'.
(3)相關資訊:
rawimg -pack raw image
(4)打包Raw韌體:
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh rawimg
processing option: rawimg
File name is ROC-RK3568-PC-UBUNTU20.04-GPT-RAW
Rename the file? [N|y]n
==========Start building recovery==========
TARGET_RECOVERY_CONFIG=
========================================
config is
use prebuilt rk356x-recovery-arm64-raw.cpio.gz for CPIO image
found kernel image
pack recovery.img...fdt {
kernel {
ramdisk {
resource {
FIT description: U-Boot FIT source file for arm
Created: Sat Dec 25 09:48:41 2021
Image 0 (fdt)
Description: unavailable
Created: Sat Dec 25 09:48:41 2021
Type: Flat Device Tree
Compression: uncompressed
Data Size: 132152 Bytes = 129.05 KiB = 0.13 MiB
Architecture: AArch64
Load Address: 0xffffff00
Hash algo: sha256
Hash value: 6f764a41c90575ca782da50a9c589b38da80dc9305e98d6c64baf1fb18fb7644
Image 1 (kernel)
Description: unavailable
Created: Sat Dec 25 09:48:41 2021
Type: Kernel Image
Compression: uncompressed
Data Size: 24119304 Bytes = 23554.01 KiB = 23.00 MiB
Architecture: AArch64
OS: Linux
Load Address: 0xffffff01
Entry Point: 0xffffff01
Hash algo: sha256
Hash value: ddb92470653ae4c95753d9c4eb281c353c1b69db170b2ea811afb2c68d1de22d
Image 2 (ramdisk)
Description: unavailable
Created: Sat Dec 25 09:48:41 2021
Type: RAMDisk Image
Compression: uncompressed
Data Size: 7249770 Bytes = 7079.85 KiB = 6.91 MiB
Architecture: AArch64
OS: Linux
Load Address: 0xffffff02
Entry Point: unavailable
Hash algo: sha256
Hash value: dde187df2b1fda6c230aee1e8a8763dddfd9a994cb81f899cb77c8d6894d4439
Image 3 (resource)
Description: unavailable
Created: Sat Dec 25 09:48:41 2021
Type: Multi-File Image
Compression: uncompressed
Data Size: 390656 Bytes = 381.50 KiB = 0.37 MiB
Hash algo: sha256
Hash value: 98addd4af52aef2cb7b65d440a0cd16b453d68dd631e48336b4bf882712b3cc7
Default Configuration: 'conf'
Configuration 0 (conf)
Description: unavailable
Kernel: kernel
Init Ramdisk: ramdisk
FDT: fdt
done.
you take 0:01.20 to build recovery
====Build recovery ok!====
Running build_recovery succeeded.
Make raw.img
Generate raw image : raw.img !
Resize rootfs partition size
dumpe2fs 1.44.1 (24-Mar-2018)
0+0 records in
0+0 records out
0 bytes copied, 1.6412e-05 s, 0.0 kB/s
./mkrawimg.sh: line 76: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
EXPAND
./mkrawimg.sh: line 90: parted: command not found
./mkrawimg.sh: line 107: gdisk: command not found
568+0 records in
568+0 records out
290816 bytes (291 kB, 284 KiB) copied, 0.015737 s, 18.5 MB/s
uboot Image/uboot.img 0x00004000
8192+0 records in
8192+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.150549 s, 27.9 MB/s
misc Image/misc.img 0x00006000
96+0 records in
96+0 records out
49152 bytes (49 kB, 48 KiB) copied, 0.0717786 s, 685 kB/s
boot Image/boot.img 0x00008000
65444+0 records in
65444+0 records out
33507328 bytes (34 MB, 32 MiB) copied, 0.547018 s, 61.3 MB/s
recovery Image/recovery.img 0x00028000
62297+0 records in
62297+0 records out
31896064 bytes (32 MB, 30 MiB) copied, 0.71566 s, 44.6 MB/s
rootfs Image/rootfs.img 0x00058000
^C4932577+0 records in
4932576+0 records out
2525478912 bytes (2.5 GB, 2.4 GiB) copied, 72.2584 s, 35.0 MB/s
(5)缺少某些命令:
./mkrawimg.sh: line 76: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
./mkrawimg.sh: line 93: parted: command not found
EXPAND
./mkrawimg.sh: line 90: parted: command not found
./mkrawimg.sh: line 107: gdisk: command not found
(5)安裝缺少命令:
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ sudo apt-get install parted
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ sudo apt-get install gdisk
(6)重新打包:
neutionwei@32b7b9ddcaab:~/project/rk356x_linux_release_20211019$ ./build.sh rawimg
processing option: rawimg
File name is ROC-RK3568-PC-UBUNTU20.04-GPT-RAW
Rename the file? [N|y]n
==========Start building recovery==========
TARGET_RECOVERY_CONFIG=
========================================
config is
use prebuilt rk356x-recovery-arm64-raw.cpio.gz for CPIO image
found kernel image
pack recovery.img...fdt {
kernel {
ramdisk {
resource {
FIT description: U-Boot FIT source file for arm
Created: Sat Dec 25 10:45:53 2021
Image 0 (fdt)
Description: unavailable
Created: Sat Dec 25 10:45:53 2021
Type: Flat Device Tree
Compression: uncompressed
Data Size: 132152 Bytes = 129.05 KiB = 0.13 MiB
Architecture: AArch64
Load Address: 0xffffff00
Hash algo: sha256
Hash value: 6f764a41c90575ca782da50a9c589b38da80dc9305e98d6c64baf1fb18fb7644
Image 1 (kernel)
Description: unavailable
Created: Sat Dec 25 10:45:53 2021
Type: Kernel Image
Compression: uncompressed
Data Size: 24119304 Bytes = 23554.01 KiB = 23.00 MiB
Architecture: AArch64
OS: Linux
Load Address: 0xffffff01
Entry Point: 0xffffff01
Hash algo: sha256
Hash value: ddb92470653ae4c95753d9c4eb281c353c1b69db170b2ea811afb2c68d1de22d
Image 2 (ramdisk)
Description: unavailable
Created: Sat Dec 25 10:45:53 2021
Type: RAMDisk Image
Compression: uncompressed
Data Size: 7249770 Bytes = 7079.85 KiB = 6.91 MiB
Architecture: AArch64
OS: Linux
Load Address: 0xffffff02
Entry Point: unavailable
Hash algo: sha256
Hash value: dde187df2b1fda6c230aee1e8a8763dddfd9a994cb81f899cb77c8d6894d4439
Image 3 (resource)
Description: unavailable
Created: Sat Dec 25 10:45:53 2021
Type: Multi-File Image
Compression: uncompressed
Data Size: 390656 Bytes = 381.50 KiB = 0.37 MiB
Hash algo: sha256
Hash value: 98addd4af52aef2cb7b65d440a0cd16b453d68dd631e48336b4bf882712b3cc7
Default Configuration: 'conf'
Configuration 0 (conf)
Description: unavailable
Kernel: kernel
Init Ramdisk: ramdisk
FDT: fdt
done.
you take 0:01.22 to build recovery
====Build recovery ok!====
Running build_recovery succeeded.
Make raw.img
Generate raw image : raw.img !
Resize rootfs partition size
dumpe2fs 1.44.1 (24-Mar-2018)
0+0 records in
0+0 records out
0 bytes copied, 3.2098e-05 s, 0.0 kB/s
EXPAND
Warning: The resulting partition is not properly aligned for best performance.
GPT fdisk (gdisk) version 1.0.3
Partition table scan:
MBR: protective
BSD: not present
APM: not present
GPT: present
Found valid GPT with protective MBR; using GPT.
Command (? for help):
Expert command (? for help): Partition number (1-7): Enter the partition's new unique GUID ('R' to randomize): New GUID is 614E0000-0000-4B53-8000-1D28000054A9
Expert command (? for help):
Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!
Do you want to proceed? (Y/N): OK; writing new GUID partition table (GPT) to raw.img.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
568+0 records in
568+0 records out
290816 bytes (291 kB, 284 KiB) copied, 0.014064 s, 20.7 MB/s
uboot Image/uboot.img 0x00004000
8192+0 records in
8192+0 records out
4194304 bytes (4.2 MB, 4.0 MiB) copied, 0.121891 s, 34.4 MB/s
misc Image/misc.img 0x00006000
96+0 records in
96+0 records out
49152 bytes (49 kB, 48 KiB) copied, 0.0802251 s, 613 kB/s
boot Image/boot.img 0x00008000
65444+0 records in
65444+0 records out
33507328 bytes (34 MB, 32 MiB) copied, 0.572347 s, 58.5 MB/s
recovery Image/recovery.img 0x00028000
62297+0 records in
62297+0 records out
31896064 bytes (32 MB, 30 MiB) copied, 0.380661 s, 83.8 MB/s
rootfs Image/rootfs.img 0x00058000
5481086+0 records in
5481086+0 records out
2806316032 bytes (2.8 GB, 2.6 GiB) copied, 68.9483 s, 40.7 MB/s
Make raw image ok!
/home/neutionwei/project/rk356x_linux_release_20211019/rockdev/pack/ROC-RK3568-PC-UBUNTU20.04-GPT-RAW-20211226-1045.img
(7)最終生成韌體位于目錄:
/home/neutionwei/project/rk356x_linux_release_20211019/rockdev/pack/ROC-RK3568-PC-UBUNTU20.04-GPT-RAW-20211226-1045.img
3、燒寫Raw韌體
3.1 balenaEtcher工具燒寫
(1)把TF卡插進讀卡器,并把讀卡器插入電腦的USB介面中;
(2)打開balenaEtcher,點擊Flash from file選擇Ubuntu韌體:

(3)點擊Select target,選擇剛剛插入電腦的移動存盤設備:


(4)點擊Flash,等待燒寫完畢:

3.2 Linux dd命令燒寫
使用dd命令燒寫務必要確認你的移動存盤設備在Linux下所識別成的設備,例如我的被識別成sdc,則燒寫命令如下:
$ sudo dd if=ROC-RK3568-PC-UBUNTU20.04-GPT-RAW-20211225-1045.img of=/dev/sdc conv=notrunc
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/394116.html
標籤:其他
