因為以下原因,您沒有權限編輯本頁:
您所請求的操作僅限于該使用者組的使用者使用:使用者
該頁面已被保護以防止編輯和其他操作。
您可以檢視與複制此頁面的源代碼。=編譯firefly linux-SDK系統=
注意:此章節操作均在我們提供的資料CD光牒以及vmware ubuntu18.04進行過測試,確定其可用。
==擷取源碼==
*下載下傳源碼
*firefly-rk3288 firefly-sdk開發SDK以及參考資料位址
:*連結:https://eyun.baidu.com/s/3o92a6vC 密碼:SVdn
*解壓源碼
使用FileZilla或其它軟體上傳下載下傳後的
linux-sdk
源碼包,讓後通過7z工具進行解壓。
7z x linux3288-sdk.7z.001
*同步源碼
repo sync -c
如果提示
repo
指令不存在,請使用手動下載下傳安裝,或者使用我們提供的。
==編譯前配置:==
在device/rockchip/rk3288/目錄下,選擇對應的闆型的配置檔案,本文例子:确定選用rk3288/firefly-rk3288.mk
*firefly-rk3288.mk 相關配置介紹:
**Target arch 指定編譯目标架構,這裡指定 32位ARM架構
export RK_ARCH=arm
**Uboot defconfig 指定 u-boot配置檔案
export RK_UBOOT_DEFCONFIG=firefly-rk3288
**Kernel defconfig 指定kernel配置檔案
export RK_KERNEL_DEFCONFIG=firefly_linux_defconfig
**Kernel dts 指定使用那個dts檔案
export RK_KERNEL_DTS=rk3288-firefly
** parameter for GPT table 指定系統鏡像的分區表
export RK_PARAMETER=parameter-ubuntu.txt
**rootfs image path 根檔案系統生成的路徑
export RK_ROOTFS_IMG=buildroot/output/$RK_CFG_BUILDROOT/images/rootfs.$RK_ROOTFS_TYPE
==配置Rootfs==
源碼中預設的Linux rootfs是buildroot,如果rootfs使用buildroot,跳過此步,如果使用者需要使用Ubuntu,需要通過以下步驟來配置:
#下載下傳根檔案系統:ubuntu16.04 根檔案系統(32位),放到SDK路徑下;
#該檔案為7z壓縮包,解壓該檔案;
7z x ubuntu1604armhf-rootfs.7z
#完成上述後,得到ubuntu1604armhf-rootfs.img(2.6G),拷貝根檔案系統到rootfs目錄下;
cp ubuntu1604armhf-rootfs.img rootfs/
#在device/rockchip/rk3288/firefly-rk3288.mk中, 将“# rootfs image path”修改為:
export RK_ROOTFS_IMG=rootfs/ubuntu1604armhf-rootfs.img
===配置闆型===
根據各個闆型和配件的差别,核心中使用的DTS也有差别,如果是标配闆型,跳過此步,如果闆型有VGA或者LCD等支援,需要在.BoardConfig.mk中做對應的修改。
Firefly-rk3288
* 标配:
export RK_KERNEL_DTS=rk3288-firefly
* 帶VGA:
export RK_KERNEL_DTS=rk3288-firefly-vga
==編譯配置檔案:==
./build.sh firefly-rk3288.mk
運作完上述腳本後,在device/rockchip/目錄下,生成.BoardConfig.mk 軟連結 device/rockchip/rk3288/firefly-rk3288.mk
*完全編譯
完全編譯運作如下指令,包含 kernel 、uboot、buildroot、recovery。 如果使用者使用buildroot,可以使用完全編譯。如果使用者使用Ubuntu系統,則不需要使用完全編譯。
./build.sh
注意:該腳本預設編譯
buildroot
根檔案系統,若使用者需要用的根檔案系統是Debian或者Ubuntu16.04時,
請!先!将!對應的根檔案系統準備好,不然在執行該build.sh腳本時,會在整理分區鏡像、打包固件時出錯,這部分操作在以下的'''部分編譯'''中'''編譯rootfs'''有詳細說明,按照操作執行即可!
build.sh
腳本運作完成後,會将分區鏡像和統一固件update.img放在
rockdev/
目錄下,同時建立IMAGE/目錄備份。
==子產品化編譯:==
===編譯u-boot:===
./build.sh uboot
===編譯kernel:===
./build.sh kernel
==編譯rootfs:==
本SDK支援三種根檔案系統,分别是buildroot、Debian、Ubuntu;
===編譯Buildroot系統鏡像===
編譯 Buildroot 環境搭建所依賴的軟體包安裝指令如下:
sudo apt-get install repo git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler \
gcc-aarch64-linux-gnu mtools parted libudev-dev libusb-1.0-0-dev python-linaro-image-tools linaro-image-tools \
autoconf autotools-dev libsigsegv2 m4 intltool libdrm-dev curl sed make binutils build-essential gcc g++ bash \
patch gzip bzip2 perl tar cpio python unzip rsync file bc wget libncurses5 libqt4-dev libglib2.0-dev libgtk2.0-dev \
libglade2-dev cvs git mercurial rsync openssh-client subversion asciidoc w3m dblatex graphviz python-matplotlib \
libc6:i386 libssl-dev texinfo liblz4-tool genext2fs
搭建環境完成後,編譯buildroot,執行如下指令:
./build.sh rootfs
===編譯Ubuntu16.04===
*1.下載下傳根檔案系統:ubuntu16.04 根檔案系統(32位),放到SDK路徑下;
*2.該檔案為7z壓縮包,解壓該檔案;
7z x ubuntu1604armhf-rootfs.7z
*3.完成上述後,得到ubuntu1604armhf-rootfs.img(2.6G),拷貝根檔案系統到rootfs目錄下;
cp ubuntu1604armhf-rootfs.img rootfs/
補充說明:
./build.sh --help
====USAGE: build.sh modules====
uboot -build uboot
kernel -build kernel
rootfs -build default rootfs, currently build buildroot as default
buildroot -build buildroot rootfs
yocto -build yocto rootfs, currently build ros as default
ros -build ros rootfs
debian -build debian 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
sdbootimg -pack sdboot image
save -save images, patches, commands used to debug
default -build all modules
BoardConfig -select the corresponding BoardConfig.mk file
recovery分區在Ubuntu系統中不會用到,若有需要,可運作如下指令:
./build.sh recovery
==打包固件==
===parameter分區表===
parameter.txt檔案中包含了固件的重要資訊,如以rk3288為例: 路徑:device/rockchip/rk3288/parameter-ubuntu.txt
FIRMWARE_VER: 8.1 固件版本
MACHINE_MODEL:rk3288 固件闆型
MACHINE_ID:007
MANUFACTURER:RK3288
MAGIC: 0x5041524B
ATAG: 0x00200800
MACHINE: 3288
CHECK_MASK: 0x80
PWR_HLD: 0,0,A,0,1
TYPE: GPT 分區類型
CMDLINE: mtdparts=rk29xxnand:[email protected](uboot),[email protected](trust),[email protected](boot),[email protected](backup),[email protected](rootfs:grow)
uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9
CMDLINE屬性是我們關注的地方,以uboot為例 [email protected](uboot)中0x00004000為uboot分區的起始位置0x00002000為分區的大小,後面相同,使用者可以根據自己需要增減或者修改分區資訊,但是請最少保留uboot,trust,boot,rootfs分區,這是機器能正常啟動的前提條件。
*分區介紹:
uboot 分區: uboot編譯出來的 uboot.img.
trust 分區: uboot編譯出來的 trust.img
misc 分區: misc.img開機檢測進入recovery模式.(可省略)
boot 分區: 編譯出來的 boot.img包含kernel和裝置樹資訊.
recovery 分區: 燒寫 recovery.img.(可省略)
backup 分區: 預留,暫時沒有用。後續跟 android 一樣作為 recovery 的 backup 使用.
oem 分區: 給廠家使用,存放廠家的 app 或資料,隻讀,代替原來音箱的 data 分區,挂載在/oem 目錄.(可省略)
rootfs 分區: 存放 buildroot 或者 debian 編出來的rootfs.img隻讀.
userdata 分區: 存放app臨時生成的檔案或者是給最終使用者使用。可讀寫,挂載在/userdata目錄下.(可省略)
在parameter.txt檔案中,僅僅保留了5個不可缺少的分區。
注意:若發現根檔案分區大小異常時,執行如下指令:
resize2fs /dev/mmcblk2p5
===package-file===
package-file檔案用于打包統一固件時确定需要的分區鏡像和鏡像路徑,同時它需要與parameter.txt檔案保持一緻。 路徑tools/linux/Linux_Pack_Firmware/rockdev/目錄下,以package-file為例:
# NAME Relative path
#
#HWDEF HWDEF
package-file package-file
bootloader Image/MiniLoaderAll.bin
parameter Image/parameter.txt
trust Image/trust.img
uboot Image/uboot.img
boot Image/boot.img
rootfs:grow Image/rootfs.img
backup RESERVED
===打包===
整理分區鏡像到rockdev/目錄下
./mkfirmware.sh
提示:在運作./mkfirmware時,可能會遇到如下報錯:
error: /home/ljh/proj/linux-sdk/buildroot/output/rockchip_rk3288_recovery/images/recovery.img not found!
表示recovery分區沒有找到,類似的如oem.img、userdata.img,上文提到,這些屬于可省略分區鏡像,可以不用理會。
*整合統一固件
./build.sh updateimg
注意:每次打包固件前,需要運作mkfirmware.sh腳本更新rockdev/下的分區鏡像
[[Category:ROCKCHIP]][[Category:Rk3288]] [[Category:LinuxKernel4.x]]