0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫(xiě)文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

fireflyROC-RK3399主板PC編譯 Ubuntu 固件簡(jiǎn)介

firefly ? 來(lái)源:firefly ? 作者:firefly ? 2019-12-20 10:57 ? 次閱讀

編譯 Ubuntu 固件( GPT )

為了方便用戶的使用與開(kāi)發(fā),官方提供了Linux開(kāi)發(fā)的整套sdk,本章詳細(xì)的說(shuō)明SDK的具體用法。

準(zhǔn)備工作

下載源碼

下載repo工具:

mkdir linux cd linux git clone https://github.com/FireflyTeam/repo.git

下載完整 SDK

方法一

初始化repo倉(cāng)庫(kù):

mkdir linux-sdk cd linux-sdk ../repo/repo init --repo-url https://github.com/FireflyTeam/repo.git -u https://github.com/FireflyTeam/manifests.git -b linux-sdk -m rk3399/rk3399_linux_release.xml

同步源碼:

../repo/repo sync -c

同步過(guò)程中,網(wǎng)絡(luò)波動(dòng)會(huì)導(dǎo)致下載速度過(guò)低中斷同步,可以使用下面腳本同步代碼:

../repo/repo sync -c while [ $? -ne 0 ] ; do ../repo/repo sync -c; done

方法二(國(guó)內(nèi)用戶推薦使用)

因?yàn)閲?guó)內(nèi)用戶可能git拉代碼會(huì)比較慢,所以官方提供了基礎(chǔ)得源碼包Linux_SDK.7z

下載Linux_SDK.7z

1.把壓縮包放在上一步下載repo工具的目錄下 7z x Linux_SDK.7z 2.更新代碼 repo sync -c

下載裁剪版 SDK

初始化repo倉(cāng)庫(kù):

mkdir linux-sdk cd linux-sdk ../repo/repo init --repo-url https://github.com/FireflyTeam/repo.git -u https://github.com/FireflyTeam/manifests.git -b linux-sdk -m rk3399/rk3399_linux_ubuntu_release.xml

同步源碼:

../repo/repo sync -c

注意: 裁剪版 SDK 主要?jiǎng)h掉了編譯 Buildroot 和 Debian 的源碼,方便不需要編譯根文件系統(tǒng)的用戶獲取。

Linux_SDK 目錄介紹

目錄:

├── linux_sdk │ ├── app │ ├── buildroot buildroot 根文件系統(tǒng)的編譯目錄 │ ├── build.sh -> device/rockchip/common/build.sh 全自動(dòng)編譯腳本 │ ├── device 編譯相關(guān)配置文件 │ ├── distro debian 根文件系統(tǒng)生成目錄 │ ├── docs 文檔 │ ├── envsetup.sh -> buildroot/build/envsetup.sh │ ├── external │ ├── kernel 內(nèi)核 │ ├── Makefile -> buildroot/build/Makefile │ ├── mkfirmware.sh -> device/rockchip/common/mkfirmware.sh rockdev鏈接更新腳本 │ ├── prebuilts │ ├── rkbin │ ├── rkflash.sh -> device/rockchip/common/rkflash.sh 燒寫(xiě)腳本 │ ├── rootfs debian根文件系統(tǒng)編譯目錄 │ ├── tools 燒寫(xiě)、打包工具 │ └── u-boot

搭建 SDK 編譯環(huán)境

編譯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 \ lib32stdc++6

編譯 Debian / Ubuntu 固件:

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 gcc-4.8-multilib-arm-linux-gnueabihf \ gcc-arm-linux-gnueabihf libssl-dev gcc-aarch64-linux-gnu g+conf \ 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 lib32stdc++6

Ubuntu 根文件系統(tǒng)請(qǐng)使用官方提供的根文件系統(tǒng)鏡像。

編譯SDK

編譯前配置

配置文件 roc-rk3399-pc.mk:

./build.sh roc-rk3399-pc.mk #文件路徑在`device/rockchip/rk3399/roc-rk3399-pc.mk`

如果配置文件生效會(huì)連接到device/rockchip/.BoardConfig.mk,檢查該文件可以驗(yàn)證是否配置成功

注意:roc-rk3399-pc.mk為編譯生成buildroot固件的配置文件.同時(shí)用戶也可以通過(guò)參考該配置生成新的配置文件來(lái)適配自己所需要的固件。

重要配置介紹:(如果需要diy固件,可能需要修改下列配置信息)

# Uboot defconfig export RK_UBOOT_DEFCONFIG=roc-rk3399-pc 編譯uboot配置文件 # Kernel defconfig export RK_KERNEL_DEFCONFIG=firefly_linux_defconfig 編譯kernel配置文件 # Kernel dts export RK_KERNEL_DTS=rk3399-roc-pc 編譯kernel用到的dts # parameter for GPT table export RK_PARAMETER=parameter-ubuntu.txt 分區(qū)信息(十分重要) # packagefile for make update image export RK_PACKAGE_FILE=rk3399-ubuntu-package-file 打包配置文件 # rootfs image path export RK_ROOTFS_IMG=xxxx/xxxx.img 根文件系統(tǒng)鏡像路徑

注意,十分重要??!

默認(rèn)配置編譯buildroot固件,如果想編譯其他固件(如ubuntu固件)請(qǐng)執(zhí)行一下操作:

下載ubuntu根文件系統(tǒng)鏡像https://pan.baidu.com/s/1DuCzTGARDi7APxyKs9Nl1A#list/path=%2F

把得到的鏡像放到sdk的指定目錄:

#解壓 tar -xvf rk3399_ubuntu18.04_LXDE.img.tgz #sdk根目錄下 mkdir ubunturootfs mv rk3399_ubuntu18.04_LXDE.img ubunturootfs/ #修改roc-rk3399-pc.mk文件 vim device/rockchip/rk3399/roc-rk3399-pc.mk #把RK_ROOTFS_IMG屬性改成ubuntu文件系統(tǒng)鏡像得路徑(也就是rk3399_ubuntu18.04_LXDE.img) RK_ROOTFS_IMG=ubunturootfs/rk3399_ubuntu18.04_LXDE.img

注意:ubuntu根文件系統(tǒng)鏡像存放路徑不能錯(cuò)

全自動(dòng)編譯

在配置和搭建環(huán)境的工作都做好的前提下:

./build.sh

全自動(dòng)編譯的固件默認(rèn)會(huì)編譯一遍buildroot根文件系統(tǒng)。生成固件目錄rockdev/,同時(shí)會(huì)在IMAGE中備份。

部分編譯

kernel

./build.sh kernel

u-boot

./build.sh uboot

recovery

recovery分區(qū)可省略,若有需要: 編譯recovery:

./build.sh recovery

rootfs

buildroot:

./build.sh rootfs

debian:

cd rootfs/ 1: #Building base debian system by ubuntu-build-service from linaro sudo apt-get install binfmt-support qemu-user-static live-build sudo dpkg -i ubuntu-build-service/packages/* sudo apt-get install -f 2: #編譯 32 位的 debian: RELEASE=stretch TARGET=desktop ARCH=armhf ./mk-base-debian.sh #或編譯 64 位的 debian: RELEASE=stretch TARGET=desktop ARCH=arm64 ./mk-base-debian.sh #上面編譯如果遇到如下問(wèn)題情況: noexec or nodev issue /usr/share/debootstrap/functions: line 1450: ..../rootfs/ubuntu-build- service/stretch-desktop-armhf/chroot/test-dev-null: Permission denied E: Cannot install into target '/home/foxluo/work3/rockchip/rk_linux/rk3399_linux/rootfs/ubuntu-build-service/stretch- desktop-armhf/chroot' mounted with noexec or nodev # 解決辦法: mount -o remount,exec,dev xxx (xxx is the mount place), then rebuild it. 3: # 編譯 32 位的 debian: VERSION=debug ARCH=armhf ./mk-rootfs-stretch.sh # 開(kāi)發(fā)階段推薦使用后面帶 debug # 編譯 64 位的 debian: VERSION=debug ARCH=arm64 ./mk-rootfs-stretch-arm64.sh 4: ./mk-image.sh mv linaro-rootfs.img ../distro/ 5: #修改roc-rk3399-pc.mk文件 vim device/rockchip/rk3399/roc-rk3399-pc.mk #把RK_ROOTFS_IMG屬性改成ubuntu文件系統(tǒng)鏡像得路徑(也就是linaro-rootfs.img) RK_ROOTFS_IMG=distro/linaro-rootfs.img

ubuntu18.04,可以通過(guò)云盤(pán)下載:

下載鏈接https://pan.baidu.com/s/1DuCzTGARDi7APxyKs9Nl1A#list/path=%2F

把得到的鏡像放到sdk的根目錄處:

#解壓 tar -xvf rk3399_ubuntu18.04_LXDE.img.tgz #sdk根目錄下 mkdir ubunturootfs mv rk3399_ubuntu18.04_LXDE.img ubunturootfs/ #修改roc-rk3399-pc.mk文件 vim device/rockchip/rk3399/roc-rk3399-pc.mk #把RK_ROOTFS_IMG屬性改成ubuntu文件系統(tǒng)鏡像得路徑(也就是rk3399_ubuntu18.04_LXDE.img) RK_ROOTFS_IMG=ubunturootfs/rk3399_ubuntu18.04_LXDE.img

注意:ubuntu根文件系統(tǒng)鏡像存放路徑不能錯(cuò)

運(yùn)行./mkfirmware.sh會(huì)自動(dòng)更新rockdev/rootfs.img的鏈接

固件打包

同步更新各部分鏡像

每次打包固件前先確保rockdev/目錄下文件鏈接是否正確:

ls -l ├── boot.img -> ~/project/linux_sdk/kernel/boot.img ├── idbloader.img -> ~/project/linux_sdk/u-boot/idbloader.img ├── linaro-rootfs.img ├── MiniLoaderAll.bin -> ~/project/linux_sdk/u-boot/rk3399_loader_v1.14.115.bin ├── misc.img -> ~/project/linux_sdk/device/rockchip/rockimg/wipe_all-misc.img ├── oem.img ├── parameter.txt -> ~/project/linux_sdk/device/rockchip/rk3399/parameter-ubuntu.txt ├── recovery.img -> ~/project/linux_sdk/buildroot/output/rockchip_rk3399_recovery/images/recovery.img ├── rootfs.img -> ~/project/linux_sdk/ubunturootfs/rk3399_ubuntu18.04_LXDE.img ├── trust.img -> ~/project/linux_sdk/u-boot/trust.img ├── uboot.img -> ~/project/linux_sdk/u-boot/uboot.img └── userdata.img

可以運(yùn)行./mkfirmware.sh更新鏈接

./mkfirmware.sh

提示:若不是編譯全部的分區(qū)鏡像,在運(yùn)行./mkfirmware時(shí),會(huì)遇到如下類似情況:

error: /home/ljh/proj/linux-sdk/buildroot/output/rockchip_rk3399_recovery/images/recovery.img not found! 表示recovery分區(qū)沒(méi)有編譯出鏡像,其他的情況類似,如oem.img、userdata.img 上文提到,這些屬于可省略分區(qū)鏡像,可以不用理會(huì)。

打包統(tǒng)一固件

注意:打包前請(qǐng)確認(rèn)tools/linux/Linux_Pack_Firmware/rockdev/package-file是否正確。打包會(huì)根據(jù)此文件進(jìn)行分區(qū)打包。此文件鏈接會(huì)在./build.sh roc-rk3399-pc.mk 命令時(shí)更新,如果配置不對(duì)請(qǐng)返回[配置]一節(jié)重新配置一次。

整合統(tǒng)一固件:

./build.sh updateimg

分區(qū)介紹

parameter

parameter.txt包含了固件的分區(qū)信息十分重要,你可以在device/rockchip/rk3399目錄下找到一些parameter.txt文件,下面以parameter-debian.txt為例子做介紹:

FIRMWARE_VER: 8.1 MACHINE_MODEL: RK3399 MACHINE_ID: 007 MANUFACTURER: RK3399 MAGIC: 0x5041524B ATAG: 0x00200800 MACHINE: 3399 CHECK_MASK: 0x80 PWR_HLD: 0,0,A,0,1 TYPE: GPT CMDLINE: mtdparts=rk29xxnand:0x00002000@0x00004000(uboot),0x00002000@0x00006000(trust),0x00002000@0x00008000(misc),0x00010000@0x0000a000(boot),0x00010000@0x0001a000(recovery),0x00010000@0x0002a000(backup),0x00020000@0x0003a000(oem),0x00700000@0x0005a000(rootfs),-@0x0075a000(userdata:grow) uuid:rootfs=614e0000-0000-4b53-8000-1d28000054a9

CMDLINE屬性是我們關(guān)注的地方。以u(píng)boot為例 0x00002000@0x00004000(uboot)中0x00004000為uboot分區(qū)的起始位置0x00002000為分區(qū)的大小。后面的分區(qū)規(guī)則相同。用戶可以根據(jù)自己需要增減或者修改分區(qū)信息,但是請(qǐng)最少保留uboot,trust,boot,rootfs分區(qū),這是機(jī)器能正常啟動(dòng)的前提條件。parameter-ubuntu.txt中使用的就是這樣的最簡(jiǎn)分區(qū)方案。

分區(qū)介紹:

uboot 分區(qū): 燒寫(xiě) uboot 編譯出來(lái)的 uboot.img. trust 分區(qū): 燒寫(xiě) uboot 編譯出來(lái)的 trust.img misc 分區(qū): 燒寫(xiě) misc.img。開(kāi)機(jī)檢測(cè)進(jìn)入recovery模式.(可省略) boot 分區(qū): 燒寫(xiě) kernel 編譯出來(lái)的 boot.img.包含kernel和設(shè)備樹(shù)信息 recovery 分區(qū): 燒寫(xiě) recovery.img.(可省略) backup 分區(qū): 預(yù)留,暫時(shí)沒(méi)有用。后續(xù)跟 android 一樣作為 recovery 的 backup 使用.(可省略) oem 分區(qū): 給廠家使用,存放廠家的 app 或數(shù)據(jù)。只讀。代替原來(lái)音箱的 data 分區(qū)。掛載在/oem 目錄.(可省略) rootfs 分區(qū): 存放 buildroot 或者 debian 編出來(lái)的 rootfs.img,只讀. userdata 分 區(qū) : 存 放 app 臨 時(shí) 生 成 的 文 件 或 者 是 給 最 終 用 戶 使 用 。 可 讀 寫(xiě) , 掛 載 在 /userdata 目錄下.(可省略)

package-file

此文件應(yīng)當(dāng)與parameter保持一致,用于固件打包。可以在tools/linux/Linux_Pack_Firmware/rockdev下找到相關(guān)文件。以rk3399-ubuntu-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

以上是SDK編譯后生成的鏡像文件。根據(jù)parameter.txt只打包自己用到的img文件。

聲明:本文內(nèi)容及配圖由入駐作者撰寫(xiě)或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 嵌入式主板
    +關(guān)注

    關(guān)注

    7

    文章

    6083

    瀏覽量

    35115
  • 安卓
    +關(guān)注

    關(guān)注

    5

    文章

    2113

    瀏覽量

    56905
  • 可制造性設(shè)計(jì)

    關(guān)注

    10

    文章

    2064

    瀏覽量

    15430
  • Firefly
    +關(guān)注

    關(guān)注

    2

    文章

    538

    瀏覽量

    6951
  • 華秋DFM
    +關(guān)注

    關(guān)注

    20

    文章

    3492

    瀏覽量

    4305
收藏 人收藏

    評(píng)論

    相關(guān)推薦

    教你怎樣去搭建基于ROC-RK3399-PC Pro的Android10系統(tǒng)固件

    PLUS 硬件上的迭代,所以軟件的編譯方法是一致。最終生成的固件如:ROC-RK3399-PC-Pro_xxx.img 對(duì) ROC-RK3399-PC PLUS 也是兼容的。Fire
    發(fā)表于 04-06 14:12

    RK3399編譯Ubuntu固件 ( GPT )資料推薦

    1、RK3399編譯Ubuntu固件 ( GPT )為了方便用戶的使用與開(kāi)發(fā),官方提供了 Linux 開(kāi)發(fā)的整套 SDK,本章詳細(xì)的說(shuō)明 SDK 的具體用法。準(zhǔn)備工作搭建 SDK
    發(fā)表于 07-18 17:48

    Firefly-RK3399_Android10.0固件編譯報(bào)錯(cuò)如何解決

    問(wèn)題描述及復(fù)現(xiàn)步驟:問(wèn)題描述:編譯提供的 Firefly-RK3399_Android10.0_git_20211222.7z,安卓10固件:根據(jù)文檔的4. 編譯 Android10.
    發(fā)表于 11-16 16:40

    firefly ROC-RK3399-PC主板介紹

    ROC-RK3399-PC是一款迷你PC主板,體積只有小型手機(jī)的大小。
    的頭像 發(fā)表于 11-13 11:51 ?2584次閱讀
    firefly ROC-<b class='flag-5'>RK3399-PC</b><b class='flag-5'>主板</b>介紹

    firefly3399PRO-JD4編譯Ubuntu 固件簡(jiǎn)介

    編譯 Ubuntu 固件(GPT) 為了方便用戶的使用與開(kāi)發(fā),官方提供了Linux開(kāi)發(fā)的整套sdk,本章詳細(xì)的說(shuō)明SDK的具體用法。 準(zhǔn)備工作 下載源碼 下載repo工具
    的頭像 發(fā)表于 12-17 16:42 ?3241次閱讀
    firefly<b class='flag-5'>3399</b>PRO-JD4<b class='flag-5'>編譯</b><b class='flag-5'>Ubuntu</b> <b class='flag-5'>固件</b><b class='flag-5'>簡(jiǎn)介</b>

    fireflyROC-RK3399主板PC編譯固件簡(jiǎn)介

    編譯 Android 7.1 (industry版本)固件
    的頭像 發(fā)表于 12-20 11:09 ?1912次閱讀
    <b class='flag-5'>fireflyROC-RK3399</b><b class='flag-5'>主板</b><b class='flag-5'>PC</b><b class='flag-5'>編譯</b><b class='flag-5'>固件</b><b class='flag-5'>簡(jiǎn)介</b>

    fireflyROC-RK3399主板PC-Ubuntu簡(jiǎn)介

    Mpp是Rockchip為RK3399提供的一套視頻編解碼的api, 并且基于mpp,Rockchip提供了一套gstreamer的編解碼插件。
    的頭像 發(fā)表于 12-20 10:51 ?3139次閱讀

    fireflyROC-RK3399主板PC介紹

    ROC-RK3399-PC 支持從以下存儲(chǔ)設(shè)備啟動(dòng)
    的頭像 發(fā)表于 12-21 09:18 ?2901次閱讀
    <b class='flag-5'>fireflyROC-RK3399</b><b class='flag-5'>主板</b><b class='flag-5'>PC</b>介紹

    ROC RK3399 PC Pro源代碼Linux SDK(僅支持RK3399

    電子發(fā)燒友網(wǎng)站提供《ROC RK3399 PC Pro源代碼Linux SDK(僅支持RK3399).txt》資料免費(fèi)下載
    發(fā)表于 09-20 16:03 ?25次下載
    ROC <b class='flag-5'>RK3399</b> <b class='flag-5'>PC</b> Pro源代碼Linux SDK(僅支持<b class='flag-5'>RK3399</b>)

    ROC RK3399 PC Pro固件Android 7.1(industry)固件

    電子發(fā)燒友網(wǎng)站提供《ROC RK3399 PC Pro固件Android 7.1(industry)固件.txt》資料免費(fèi)下載
    發(fā)表于 09-20 15:59 ?16次下載
    ROC <b class='flag-5'>RK3399</b> <b class='flag-5'>PC</b> Pro<b class='flag-5'>固件</b>Android 7.1(industry)<b class='flag-5'>固件</b>

    ROC RK3399 PC Pro固件Android10.0

    電子發(fā)燒友網(wǎng)站提供《ROC RK3399 PC Pro固件Android10.0.txt》資料免費(fèi)下載
    發(fā)表于 09-20 15:58 ?9次下載
    ROC <b class='flag-5'>RK3399</b> <b class='flag-5'>PC</b> Pro<b class='flag-5'>固件</b>Android10.0

    ROC RK3399 PC Pro固件Centos 8

    電子發(fā)燒友網(wǎng)站提供《ROC RK3399 PC Pro固件Centos 8.txt》資料免費(fèi)下載
    發(fā)表于 09-20 15:57 ?1次下載
    ROC <b class='flag-5'>RK3399</b> <b class='flag-5'>PC</b> Pro<b class='flag-5'>固件</b>Centos 8

    ROC RK3399 PC Pro固件LibreELEC

    電子發(fā)燒友網(wǎng)站提供《ROC RK3399 PC Pro固件LibreELEC.txt》資料免費(fèi)下載
    發(fā)表于 09-20 15:54 ?13次下載
    ROC <b class='flag-5'>RK3399</b> <b class='flag-5'>PC</b> Pro<b class='flag-5'>固件</b>LibreELEC

    ROC RK3399 PC Pro固件Ubuntu18.04/20.04(GPT)

    電子發(fā)燒友網(wǎng)站提供《ROC RK3399 PC Pro固件Ubuntu18.04/20.04(GPT).txt》資料免費(fèi)下載
    發(fā)表于 09-20 15:53 ?3次下載
    ROC <b class='flag-5'>RK3399</b> <b class='flag-5'>PC</b> Pro<b class='flag-5'>固件</b><b class='flag-5'>Ubuntu</b>18.04/20.04(GPT)

    六核64位高性能主板ROC RK3399 PC Pro規(guī)格書(shū)

    電子發(fā)燒友網(wǎng)站提供《六核64位高性能主板ROC RK3399 PC Pro規(guī)格書(shū).pdf》資料免費(fèi)下載
    發(fā)表于 09-20 15:46 ?2次下載
    六核64位高性能<b class='flag-5'>主板</b>ROC <b class='flag-5'>RK3399</b> <b class='flag-5'>PC</b> Pro規(guī)格書(shū)