Yocto計劃 (英語:Yocto Project™) , 一個自由軟體專案計劃, 由Linux基金會於2010年宣布, 這個計劃的目標在於創造出可以提供嵌入式linux發行版的軟體工具,以改善軟體發展流程. 2011年3月, 這個計劃與OpenEmbedded計劃結合, 以OpenEmbedded-Core計劃作為計劃的另一個名稱. 它提供跨平台工具, 元資料以及流程以利於快速和可複製的開發Linux嵌入式系統.
Yocto計畫主要由三個元件組成:
BitBake: 讀取組態檔與處方檔 (recipes) 並執行, 組態與建置所指定的應用程式或者系統檔案映像檔.
OpenEmbedded-Core: 由基礎layers所組成, 並為處方檔 (recipes) , layers與classes的集合; 這些要素都是在OpenEmbedded系統中共用使用的.
Poky: 是一個參考系統. 是許多案子與工具的集合, 用來讓使用者延伸出新的發行版 (Distibution) .
筆者其實對 Building Linux with Yocto 不熟, 接觸大約半年左右的時間. Firefly 並未記載 Roc-Rk3288-Cc Yocto Build, 而 Rockchip-Linux 則是記載了 evb-rk3328 Yocto Build; 昨天晚上剛剛完成 Firefly Roc-Rk3328-Cc bin/mk-yocto.sh 編譯腳本, 花了大約兩個禮拜的時間, 因此花些篇幅寫出來.
參考文件
http://opensource.rock-chips.com/wiki_Yocto
http://wiki.t-firefly.com/ROC-RK3328-CC/intro.html#
https://github.com/FireflyTeam/rk-rootfs-build/tree/master
https://blog.csdn.net/UbuntuTouch/article/details/53482262
https://github.com/maximeh/buildroot
http://albert-oma.blogspot.com/2017/12/embedded-yocto-qemuarm.html
http://sunyongfeng.com/201610/programmer/yocto/Bitbake_practical_guide.html
https://discuss.96boards.org/t/yocto-confguration/5887
Roc-Rk3328-Cc Debian Build
首先請讀者參考 http://wiki.t-firefly.com/ROC-RK3328-CC/intro.html# 網站上的說明試著 Build System Image. 我已經把它整理成 bin/mk-system.sh 腳本如下:
- bin/mk-system.sh
-
#!/bin/bash -e ############################## [ ! -f bin/mk-system.sh ] && exit 0 TOPDIR=`pwd` mkdir -p out mnt tmp ############################## # clone [ ! -d u-boot ] && git clone -b roc-rk3328-cc https://github.com/FireflyTeam/u-boot [ ! -d kernel ] && git clone -b roc-rk3328-cc https://github.com/FireflyTeam/kernel --depth=1 [ ! -d build ] && git clone -b debian https://github.com/FireflyTeam/build [ ! -d rkbin ] && git clone -b master https://github.com/FireflyTeam/rkbin ############################## # config build/board_configs.sh roc-rk3328-cc ############################## # uboot build/mk-uboot.sh roc-rk3328-cc ############################## # kernel build/mk-kernel.sh roc-rk3328-cc ############################## # debian [ ! -d rk-rootfs-build ] && git clone https://github.com/FireflyTeam/rk-rootfs-build.git cd rk-rootfs-build RELEASE=stretch TARGET=desktop ARCH=arm64 ./mk-base-debian.sh VERSION=debug RELEASE=stretch ARCH=arm64 ./mk-rootfs-stretch-arm64.sh ############################## ./mk-image.sh cd $TOPDIR ############################## # system build/mk-image.sh -c rk3328 -t boot build/mk-image.sh -c rk3328 -t system -r out/linaro-rootfs.img ls -l out/system.img
Rockchip 已經幫我們做好了 u-boot 之 BUILD 腳本, 位於 build/mk-uboot.sh ; 我們使用這腳本來編譯 u-boot (參數 roc-rk3328-cc) . 編譯 u-boot 過程中很可能會出現 ERROR `note: use option -std=c99 or -std=gnu99 to compile your code` , 如下所示:
$ build/mk-uboot.sh roc-rk3328-cc ... CC arch/arm/mach-rockchip/boot_mode.o arch/arm/mach-rockchip/boot_mode.c: In function ‘rockchip_blink_power’: arch/arm/mach-rockchip/boot_mode.c:59:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < times; ++i) { ^ arch/arm/mach-rockchip/boot_mode.c:59:3: note: use option -std=c99 or -std=gnu99 to compile your code arch/arm/mach-rockchip/boot_mode.c: In function ‘rockchip_dnl_mode’: arch/arm/mach-rockchip/boot_mode.c:84:3: error: ‘for’ loop initial declarations are only allowed in C99 mode for (int i = 0; i < 120; ++i) { ^ make[2]: *** [arch/arm/mach-rockchip/boot_mode.o] Error 1 make[1]: *** [arch/arm/mach-rockchip] Error 2 make: *** [__build_one_by_one] Error 2 MAKE UBOOT IMAGE FAILED. $
因此我們需要修改 u-boot/arch/arm/mach-rockchip/boot_mode.c 如下:
$ cd u-boot ; git diff arch/arm/mach-rockchip/boot_mode.c ; cd .. diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c index 7caf87f..acd6ed1 100644 --- a/arch/arm/mach-rockchip/boot_mode.c +++ b/arch/arm/mach-rockchip/boot_mode.c @@ -56,7 +56,8 @@ __weak int rockchip_dnl_key_pressed(void) void rockchip_blink_power(int times) { - for (int i = 0; i < times; ++i) { + int i; + for (i = 0; i < times; ++i) { cli_simple_run_command("led power off", 0); mdelay(200); cli_simple_run_command("led power on", 0); @@ -66,7 +67,7 @@ void rockchip_blink_power(int times) int rockchip_dnl_mode(int num_modes) { - int mode = 0; + int mode = 0, i; const char *modeStr[5] = {" ", "UMS", "Fastboot", "Download", "Maskrom"}; while(mode < num_modes) { @@ -81,7 +82,7 @@ int rockchip_dnl_mode(int num_modes) } // wait 2 seconds - for (int i = 0; i < 120; ++i) { + for (i = 0; i < 120; ++i) { if (!rockchip_dnl_key_pressed()) { goto end; }
$ ./bin/mk-system.sh ... Resizing the filesystem on linaro-rootfs.img to 482046 (4k) blocks. The filesystem on linaro-rootfs.img is now 482046 blocks long. Generate Boot image start mkfs.fat 3.0.26 (2014-03-07) mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows Generate Boot image : /home/jasonc/rk3328-cc/out/boot.img success! Generate System image : /home/jasonc/rk3328-cc/out/system.img ! 0+0 records in 0+0 records out 0 bytes (0 B) copied, 0.0517311 s, 0.0 kB/s Warning: The resulting partition is not properly aligned for best performance. 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): Expert command (? for help): Partition number (1-5): Enter the partition's new unique GUID ('R' to randomize): New GUID is B921B045-1DF0-41C3-AF44-4C6F280D3FAE 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 /home/jasonc/rk3328-cc/out/system.img. 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. 168+1 records in 168+1 records out 86020 bytes (86 kB) copied, 0.0448552 s, 1.9 MB/s 8192+0 records in 8192+0 records out 4194304 bytes (4.2 MB) copied, 0.151245 s, 27.7 MB/s 8192+0 records in 8192+0 records out 4194304 bytes (4.2 MB) copied, 0.151466 s, 27.7 MB/s 204800+0 records in 204800+0 records out 104857600 bytes (105 MB) copied, 0.247491 s, 424 MB/s 3856368+0 records in 3856368+0 records out 1974460416 bytes (2.0 GB) copied, 142.598 s, 13.8 MB/s -rw-rw-r-- 1 jasonc jasonc 2109734912 12月 5 18:21 out/system.img $
這個 out/system.img 即是我所說的 System Image .
Roc-Rk3328-Cc Yocto Build
Yocto Build 比較麻煩; 第一次 build 需要花費很多很多的時間, 並且 Rockchip-Linux REPO 需要做一些修正. 在下述 `Getting the Sources` 之前, 需要安裝一些 Build environment 請參閱: http://opensource.rock-chips.com/wiki_Yocto ; 筆者在此不再贅述.
Getting the Sources
$ repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b yocto -m rocko.xml $ repo sync --force-sync
筆者這邊使用的是 rocko branch. 可以使用的 branch 有:
https://wiki.yoctoproject.org/wiki/Stable_branch_maintenance
master 或其他 branches 也可以 (我試驗過 master, 也成功了) , 只是需要花更多時間 Debug `Building Process` , 考驗您 bitbake 編譯的功力; 建議讀者還是使用 rocko branch 吧.
Clone the Meta-Rust
原始碼在 sources 資料夾內 REPO 裡面沒有 meta-rust , 因此我們需要:
$ cd sources && git clone https://github.com/meta-rust/meta-rust && cd .. $ mkdir -p bb
準備我們自己的 Patches
需要準備的 patches 檔案大概如下:
bblayers.conf linux-rockchip_4.4.bb rk3328-box-plus-dram-timing.dtsi rk-binary-loader_git.bb rockchip-mali_rk.bb systemd_%.bbappend xf86Xinput.c fireflyrk3328_linux_defconfig lnx_init.c rk3328.inc rk-binary-native_git.bb u-boot-mkimage_%.bbappend firmware-rk_git.bb local.conf rk3328-roc-cc.dts rk-image-base.bb roc-rk3328-cc_defconfig u-boot-rockchip_20171218.bb
我把它們放在 bb 資料夾裡. 後面提到的 bin/mk-yocto.sh 會用到這些我們自己的 Patches .
1. Kernel DTS, DTSI, DEFCONFIG: 拷貝自 Firefly kernel git
$mkdir -p bb $ find ./kernel/ -name rk3328-roc-cc.dts | xargs -i cp -f {} bb/ $ find ./kernel/ -name rk3328-box-plus-dram-timing.dtsi | xargs -i cp -f {} bb/ $ find ./kernel/ -name fireflyrk3328_linux_defconfig | xargs -i cp -f {} bb/
2. U-boot DEFCONFIG: 拷貝自 Firefly u-boot git
$mkdir -p bb $ find ./u-boot/ -name roc-rk3328-cc_defconfig | xargs -i cp {} bb/
3. bblayers.conf 增加了一行: ${BSPDIR}/sources/meta-rust \
- bb/bblayers.conf
-
LCONF_VERSION = "7" BBPATH = "${TOPDIR}" BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}" BBFILES ?= "" BBLAYERS = " \ ${BSPDIR}/sources/poky/meta \ ${BSPDIR}/sources/poky/meta-poky \ \ ${BSPDIR}/sources/meta-openembedded/meta-oe \ ${BSPDIR}/sources/meta-openembedded/meta-multimedia \ ${BSPDIR}/sources/meta-openembedded/meta-networking \ ${BSPDIR}/sources/meta-openembedded/meta-filesystems \ ${BSPDIR}/sources/meta-openembedded/meta-python \ ${BSPDIR}/sources/meta-browser \ ${BSPDIR}/sources/meta-qt5 \ \ ${BSPDIR}/sources/meta-rockchip \ ${BSPDIR}/sources/meta-rockchip-extra \ ${BSPDIR}/sources/meta-rust \ "
4. local.conf :
- bb/local.conf
-
MACHINE ??= 'evb-rk3328' DISTRO ?= 'rk-x11' PACKAGE_CLASSES ?= 'package_deb' EXTRA_IMAGE_FEATURES ?= "debug-tweaks" USER_CLASSES ?= "buildstats image-mklibs image-prelink" PATCHRESOLVE = "noop" BB_DISKMON_DIRS ??= "\ STOPTASKS,${TMPDIR},1G,100K \ STOPTASKS,${DL_DIR},1G,100K \ STOPTASKS,${SSTATE_DIR},1G,100K \ STOPTASKS,/tmp,100M,100K \ ABORT,${TMPDIR},100M,1K \ ABORT,${DL_DIR},100M,1K \ ABORT,${SSTATE_DIR},100M,1K \ ABORT,/tmp,10M,1K" PACKAGECONFIG_append_pn-qemu-native = " sdl" PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" CONF_VERSION = "1" DL_DIR ?= "${BSPDIR}/downloads/"
5. systemd_%.bbappend :
-
$ diff bb/systemd_%.bbappend sources/meta-rockchip-extra/recipes-core/systemd/systemd_%.bbappend 17c17 < ln -sf ${D}${exec_prefix}/lib/systemd ${D}${base_sbindir}/init --- > ln -s ${D}${exec_prefix}/lib/systemd ${D}${base_sbindir}/init
6. rk3328.inc :
-
$ diff sources/meta-rockchip/conf/machine/include/rk3328.inc bb/rk3328.inc 16c16 < KBUILD_DEFCONFIG = "rockchip_linux_defconfig" --- > KBUILD_DEFCONFIG ?= "rockchip_linux_defconfig"
-
7. firmware-rk_git.bb :
-
$ diff sources/meta-rockchip/recipes-bsp/firmware-rk/firmware-rk_git.bb bb/firmware-rk_git.bb 11c11 < SRC_URI = "git://github.com/rockchip-linux/rkbin.git" --- > SRC_URI = "git://github.com/rockchip-linux/rkbin.git;branch=yocto-old"
- 8. linux-rockchip_4.4.bb :
-
jasonc@bebop:~/rk3328-cc$ diff sources/meta-rockchip/recipes-kernel/linux/linux-rockchip_4.4.bb bb/linux-rockchip_4.4.bb 8,10c8 < SRC_URI = " \ < git://github.com/rockchip-linux/kernel.git;branch=release-4.4; \ < " --- > SRC_URI = "git://github.com/rockchip-linux/kernel.git;branch=release-4.4;" 13a12,13 > #KERNEL_VERSION_SANITY_SKIP="1" > #SRCREV = "${AUTOREV}"
- 9. rk-binary-loader_git.bb :
-
$ diff sources/meta-rockchip/recipes-bsp/rk-binary/rk-binary-loader_git.bb bb/rk-binary-loader_git.bb 9c9 < SRC_URI = "git://github.com/rockchip-linux/rkbin.git" --- > SRC_URI = "git://github.com/rockchip-linux/rkbin.git;branch=yocto-old"
- 10. rk-binary-native_git.bb :
-
$ diff sources/meta-rockchip/recipes-bsp/rk-binary/rk-binary-native_git.bb bb/rk-binary-native_git.bb 9c9 < SRC_URI = "git://github.com/rockchip-linux/rkbin.git" --- > SRC_URI = "git://github.com/rockchip-linux/rkbin.git;branch=yocto-old"
- 11. rk-image-base.bb :
-
$ diff sources/meta-rockchip-extra/recipes-rk/images/rk-image-base.bb bb/rk-image-base.bb 20a21 > # firmware-rk-bt 24d24 < firmware-rk-bt \
- 12. rockchip-mali_rk.bb :
-
$ diff sources/meta-rockchip/recipes-graphics/libgles/rockchip-mali_rk.bb bb/rockchip-mali_rk.bb 31c31 < MALI_X11_rk3328 = "libmali-utgard-450-r7p0.so" --- > MALI_X11_rk3328 = "libmali-utgard-450-r7p0-r0p0-x11.so"
- 13. u-boot-rockchip_20171218.bb :
-
$ diff sources/meta-rockchip/recipes-bsp/u-boot/u-boot-rockchip_20171218.bb bb/u-boot-rockchip_20171218.bb 7,10c7,8 < SRC_URI = " \ < git://github.com/rockchip-linux/u-boot.git;tag=${TAG};nobranch=1; \ < file://binutils-2.28-ld-fix.patch \ < " --- > SRC_URI = "git://github.com/FireflyTeam/u-boot.git;branch=roc-rk3328-cc; file://binutils-2.28-ld-fix.patch; " > SRCREV = "${AUTOREV}"
-
Bitbake 測試 (以 rockchip-mali 為例)
- 拷貝 rockchip-mali_rk.bb 至 sources:
-
$ cp bb/rockchip-mali_rk.bb sources/meta-rockchip/recipes-graphics/libgles/rockchip-mali_rk.bb
設定 bitbake 編譯環境.
$ MACHINE=evb-rk3328 DISTRO=rk-x11 . ./setup-environment -b build_dir
- 1. clean:
-
$ bitbake rockchip-mali -v -c clean
- 2. fetch:
-
$ bitbake rockchip-mali -v -c fetch
- 3. patch:
-
$ bitbake rockchip-mali -v -c patch
- 4. compile:
-
$ bitbake rockchip-mali -v -c compile ...Build Configuration: BB_VERSION = "1.36.0" BUILD_SYS = "x86_64-linux" NATIVELSBSTRING = "universal-4.8" TARGET_SYS = "aarch64-rk-linux" MACHINE = "evb-rk3328" DISTRO = "rk-x11" DISTRO_VERSION = "2.4.4" TUNE_FEATURES = "aarch64" TARGET_FPU = "" meta meta-poky = "HEAD:68a612b7d31d270348ef5439d7f779c309bdb6ec" meta-oe meta-multimedia meta-networking meta-filesystems meta-python = "HEAD:eae996301d9c097bcbeb8046f08041dc82bb62f8" meta-browser = "HEAD:d59e2ff84e293e062b5812b63e617a0c5c543127" meta-qt5 = "HEAD:d8b531530fa42b59aa0a5b123d87a30d749cbcc4" meta-rockchip = "HEAD:eae0225c335b4e5822dd7c144d5ed6219045e7b7" meta-rockchip-extra = "HEAD:0d6d36ea49b8c941e6d470fafef0f83db24a6354" meta-rust = "master:4c9068bd0913633eafe7188147988e21f52fe31a" NOTE: Marking Active Tasks################################################################## | ETA: 0:00:02 NOTE: Pruned 4372 inactive tasks, 1081 left################################################# | ETA: 0:00:02 NOTE: Assign Weightings NOTE: Compute totals (have 1 endpoint(s))#################################################### | ETA: 0:00:02 Initialising tasks: 100% |############################################################################################################################################################| Time: 0:00:04 NOTE: Executing SetScene Tasks NOTE: Executing RunQueue Tasks NOTE: systemd-1_234-r0 do_install: Direct dependencies are ['/home/jasonc/rk3328-cc/sources/poky/meta/recipes-extended/shadow/shadow-sysroot_4.2.1.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/gnu-config/gnu-config_git.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/base-files/base-files_3.0.14.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-extended/shadow/shadow_4.2.1.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-extended/xz/xz_5.2.3.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/opkg-utils/opkg-utils_0.3.5.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-extended/shadow/shadow_4.2.1.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/systemd/systemd-systemctl-native.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-kernel/kmod/kmod_git.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/perl/perl-native_5.24.1.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/automake/automake_1.15.1.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/base-passwd/base-passwd_3.5.29.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-support/attr/acl_2.2.52.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/gcc/gcc-cross_7.3.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/readline/readline_7.0.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/update-rc.d/update-rc.d_0.7.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/gcc/gcc-runtime_7.3.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/quilt/quilt-native_0.65.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/intltool/intltool_0.51.0.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/libcgroup/libcgroup_0.41.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/pseudo/pseudo_1.8.2.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/util-linux/util-linux_2.30.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/initscripts/initscripts_1.0.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/libtool/libtool-native_2.4.6.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-support/bash-completion/bash-completion_2.7.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-support/libcap/libcap_2.25.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/gettext/gettext_0.19.8.1.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/autoconf/autoconf_2.69.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-graphics/xorg-lib/libxkbcommon_0.7.1.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-extended/gperf/gperf_3.1.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/glibc/glibc_2.26.bb:do_populate_sysroot'] NOTE: systemd-1_234-r0 do_install: Installed into sysroot: [] NOTE: systemd-1_234-r0 do_install: Skipping as already exists in sysroot: ['shadow-sysroot', 'gnu-config-native', 'base-files', 'shadow-native', 'xz', 'opkg-utils', 'shadow', 'systemd-systemctl-native', 'kmod', 'perl-native', 'automake-native', 'base-passwd', 'acl', 'gcc-cross-aarch64', 'readline', 'update-rc.d', 'gcc-runtime', 'libtool-cross', 'quilt-native', 'intltool-native', 'libcgroup', 'pseudo-native', 'util-linux', 'initscripts', 'libtool-native', 'bash-completion', 'libcap', 'gettext-native', 'autoconf-native', 'libxkbcommon', 'gperf-native', 'pkgconfig-native', 'glibc', 'attr', 'zlib', 'db-native', 'xz-native', 'gdbm-native', 'zlib-native', 'texinfo-dummy-native', 'libmpc-native', 'binutils-cross-aarch64', 'mpfr-native', 'gmp-native', 'linux-libc-headers', 'ncurses', 'libgcc', 'libxml-parser-perl-native', 'gettext-minimal-native', 'm4-native', 'util-macros', 'xkeyboard-config', 'libxcb', 'flex-native', 'bison-native', 'expat-native', 'xproto', 'libpthread-stubs', 'xcb-proto', 'libxau', 'libxdmcp', 'pigz-native'] + cd /home/jasonc/rk3328-cc/build_dir/tmp/work/aarch64-rk-linux/systemd/1_234-r0/build + do_install + autotools_do_install + oe_runmake DESTDIR=/home/jasonc/rk3328-cc/build_dir/tmp/work/aarch64-rk-linux/systemd/1_234-r0/image install + oe_runmake_call DESTDIR=/home/jasonc/rk3328-cc/build_dir/tmp/work/aarch64-rk-linux/systemd/1_234-r0/image install + bbnote make -j 4 DESTDIR=/home/jasonc/rk3328-cc/build_dir/tmp/work/aarch64-rk-linux/systemd/1_234-r0/image install + [ -p /home/jasonc/rk3328-cc/build_dir/tmp/work/aarch64-rk-linux/systemd/1_234-r0/temp/fifo.31055 ] .... + set -e + chmod 0664 /home/jasonc/rk3328-cc/build_dir/sstate-cache/59/sstate:mesa:aarch64-rk-linux:17.1.7:r0:aarch64:3:59bd1721912d396624bd3018ba9dac2d_populate_sysroot.tgz.NT2piByN + mv -f /home/jasonc/rk3328-cc/build_dir/sstate-cache/59/sstate:mesa:aarch64-rk-linux:17.1.7:r0:aarch64:3:59bd1721912d396624bd3018ba9dac2d_populate_sysroot.tgz.NT2piByN /home/jasonc/rk3328-cc/build_dir/sstate-cache/59/sstate:mesa:aarch64-rk-linux:17.1.7:r0:aarch64:3:59bd1721912d396624bd3018ba9dac2d_populate_sysroot.tgz + ret=0 + trap 0 + exit 0 NOTE: rockchip-mali-rk-r0 do_prepare_recipe_sysroot: Direct dependencies are ['/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/gcc/gcc-runtime_7.3.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-core/glibc/glibc_2.26.bb:do_populate_sysroot', 'virtual:native:/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/patchelf/patchelf_0.9.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-graphics/mesa/mesa_17.1.7.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/poky/meta/recipes-devtools/gcc/gcc-cross_7.3.bb:do_populate_sysroot', '/home/jasonc/rk3328-cc/sources/meta-rockchip/recipes-graphics/libdrm/libdrm_rk.bb:do_populate_sysroot'] NOTE: rockchip-mali-rk-r0 do_prepare_recipe_sysroot: Installed into sysroot: ['gcc-runtime', 'glibc', 'patchelf-native', 'mesa', 'gcc-cross-aarch64', 'libdrm', 'libx11', 'zlib', 'dri3proto', 'libxxf86vm', 'libxext', 'glproto', 'libxdamage', 'libxshmfence', 'dri2proto', 'expat', 'presentproto', 'libxfixes', 'xf86driproto', 'libpthread-stubs', 'systemd', 'libpciaccess', 'linux-libc-headers', 'libgcc', 'automake-native', 'gnu-config-native', 'libtool-native', 'autoconf-native', 'zlib-native', 'libmpc-native', 'xz-native', 'mpfr-native', 'gmp-native', 'binutils-cross-aarch64', 'texinfo-dummy-native', 'libxcb', 'kbproto', 'inputproto', 'util-macros', 'xtrans', 'xproto', 'xextproto', 'xf86vidmodeproto', 'damageproto', 'fixesproto', 'libcgroup', 'shadow-sysroot', 'libcap', 'base-files', 'acl', 'bash-completion', 'shadow-native', 'update-rc.d', 'base-passwd', 'initscripts', 'libxkbcommon', 'xz', 'kmod', 'readline', 'opkg-utils', 'shadow', 'util-linux', 'm4-native', 'gettext-minimal-native', 'flex-native', 'bison-native', 'libxdmcp', 'xcb-proto', 'libxau', 'attr', 'xkeyboard-config', 'ncurses'] NOTE: rockchip-mali-rk-r0 do_prepare_recipe_sysroot: Skipping as already exists in sysroot: ['quilt-native'] NOTE: Tasks Summary: Attempted 1081 tasks of which 1066 didn't need to be rerun and all succeeded. Summary: There was 1 WARNING message shown. $
- 3. install:
-
$ bitbake rockchip-mali -v -c install
常用的 bitbake 命令可以參考下述網址: https://community.nxp.com/docs/DOC-94953
-
編譯 xserver-xorg 過程中
-
$ bitbake xserver-xorg -v -c fetch ... $ bitbake xserver-xorg -v -c patch ... $ bitbake xserver-xorg -v -c compile ...
-
編譯 xserver-xorg 過程中, 如果出現: error: implicit declaration of function ‘major’
請加上: #include <sys/sysmacros.h>
試試:
-
$ diff build_dir/tmp/work/aarch64-rk-linux/xserver-xorg/2_rk-r0/package/usr/src/debug/xserver-xorg/2_rk-r0/git/hw/xfree86/os-support/linux/lnx_init.c bb/lnx_init.c 40a41 > #include <sys/sysmacros.h>
-
$ diff build_dir/tmp/work/aarch64-rk-linux/xserver-xorg/2_rk-r0/package/usr/src/debug/xserver-xorg/2_rk-r0/git/hw/xfree86/common/xf86Xinput.c bb/xf86Xinput.c 84a85 > #include <sys/sysmacros.h>
-
Try Building Rockchip Images
-
$ MACHINE=evb-rk3328 DISTRO=rk-x11 . ./setup-environment -b build_dir ... $ bitbake rk-image-multimedia ...
-
DISTRO: 參閱 https://github.com/rockchip-linux/meta-rockchip-extra/tree/master/conf/distro
- rk-none
- rk-tiny
- rk-wayland
- rk-x11
- rk-xwayland
TARGET: 參閱 http://opensource.rock-chips.com/wiki_Yocto#Distro
- rk-image-base
- rk-image-multimedia
- qt5-image
- rk-image-machine-test
- core-image-base
- core-image-x11
-
Put Things All Together
現在我們可以把所有的事情放在一起了.
- bin/mk-yocto.sh
-
#!/bin/bash -e ############################## [ ! -f bin/mk-yocto.sh ] && exit 0 TOPDIR=`pwd` ############################## MACHINE=evb-rk3328 DISTRO=rk-x11 TARGET=rk-image-multimedia [ ! -d .repo ] && repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b yocto -m rocko.xml repo sync --force-sync [ ! -d sources/meta-rust ] && cd sources && git clone https://github.com/meta-rust/meta-rust && cd $TOPDIR [ ! -d rkbin ] && git clone -b master https://github.com/FireflyTeam/rkbin ############################## rm -rf /home/jasonc/$MACHINE/sources/meta-rockchip/recipes-bsp/u-boot/u-boot-mkimage_%.bbappend /bin/cp -Rpf bb/systemd_%.bbappend sources/meta-rockchip-extra/recipes-core/systemd/ /bin/cp -Rpf bb/rk-binary-loader_git.bb sources/meta-rockchip/recipes-bsp/rk-binary/ /bin/cp -Rpf bb/rk-image-base.bb sources/meta-rockchip-extra/recipes-rk/images/ /bin/cp -Rpf bb/rk-binary-native_git.bb sources/meta-rockchip/recipes-bsp/rk-binary/ /bin/cp -Rpf bb/firmware-rk_git.bb sources/meta-rockchip/recipes-bsp/firmware-rk/ /bin/cp -Rpf bb/rockchip-mali_rk.bb sources/meta-rockchip/recipes-graphics/libgles/ /bin/cp -Rpf bb/linux-rockchip_4.4.bb sources/meta-rockchip/recipes-kernel/linux/ /bin/cp -Rpf bb/u-boot-rockchip_20171218.bb sources/meta-rockchip/recipes-bsp/u-boot/ mkdir -p build_dir/conf/ /bin/cp -Rpf bb/local.conf build_dir/conf/ /bin/cp -Rpf bb/bblayers.conf build_dir/conf/ ############################## #MACHINE=evb-rk3328 DISTRO=rk-x11 . ./setup-environment -b build_dir MACHINE=$MACHINE DISTRO=$DISTRO . ./setup-environment -b build_dir ############################## cd $TOPDIR bitbake -s ############################## bitbake linux-rockchip -v -c fetch bitbake linux-rockchip -v -c patch || true /bin/cp -Rpf bb/rk3328-roc-cc.dts build_dir/tmp/work-shared/$MACHINE/kernel-source/arch/arm64/boot/dts/rockchip/rk3328-evb.dts /bin/cp -Rpf bb/rk3328-box-plus-dram-timing.dtsi build_dir/tmp/work-shared/$MACHINE/kernel-source/arch/arm64/boot/dts/rockchip/ /bin/cp -Rpf bb/fireflyrk3328_linux_defconfig build_dir/tmp/work-shared/$MACHINE/kernel-source/arch/arm64/configs/rockchip_linux_defconfig bitbake linux-rockchip -v -c patch && bitbake linux-rockchip -v -c compile ############################## bitbake u-boot-rockchip -v -c fetch bitbake u-boot-rockchip -v -c patch || true /bin/cp -Rpf bb/roc-rk3328-cc_defconfig build_dir/tmp/work/evb_rk3328-rk-linux/u-boot-rockchip/20171218-r0/git/configs/evb-rk3328_defconfig bitbake u-boot-rockchip -v -c patch && bitbake u-boot-rockchip -v -c compile ############################## bitbake rockchip-mali -v -c fetch patch && bitbake rockchip-mali -v -c compile ############################## bitbake xserver-xorg -v -c fetch patch && bitbake xserver-xorg -v -c compile bitbake rk-image-multimedia cd $TOPDIR ############################## ls -l build_dir/tmp/deploy/images/$MACHINE/
執行結果如下:
-
$ ./bin/mk-yocto.sh ... meta-rust = "master:4c9068bd0913633eafe7188147988e21f52fe31a" Initialising tasks: 100% |############################################################################################################################################################| Time: 0:00:19 NOTE: Executing SetScene Tasks NOTE: Executing RunQueue Tasks WARNING: rk-image-multimedia-1.0-r0 do_rootfs: The license listed proprietary-binary was not in the licenses collected for recipe firmware-rk NOTE: Tasks Summary: Attempted 5411 tasks of which 5397 didn't need to be rerun and all succeeded. Summary: There were 2 WARNING messages shown. total 561956 -rw-r--r-- 1 jasonc jasonc 86020 12月 5 15:37 idbloader.img lrwxrwxrwx 2 jasonc jasonc 47 12月 5 00:36 Image -> Image--4.4.103-r1-evb-rk3328-20181204144503.bin -rw-r--r-- 2 jasonc jasonc 18657288 12月 5 00:36 Image--4.4.103-r1-evb-rk3328-20181204144503.bin -rw-r--r-- 2 jasonc jasonc 58501 12月 5 00:36 Image--4.4.103-r1-rk3328-evb-20181204144503.dtb lrwxrwxrwx 2 jasonc jasonc 47 12月 5 00:36 Image-evb-rk3328.bin -> Image--4.4.103-r1-evb-rk3328-20181204144503.bin lrwxrwxrwx 2 jasonc jasonc 47 12月 5 00:36 Image-rk3328-evb.dtb -> Image--4.4.103-r1-rk3328-evb-20181204144503.dtb -rw-rw-r-- 2 jasonc jasonc 4226 12月 5 00:36 modules--4.4.103-r1-evb-rk3328-20181204144503.tgz lrwxrwxrwx 2 jasonc jasonc 49 12月 5 00:36 modules-evb-rk3328.tgz -> modules--4.4.103-r1-evb-rk3328-20181204144503.tgz lrwxrwxrwx 2 jasonc jasonc 47 12月 5 00:36 rk3328-evb.dtb -> Image--4.4.103-r1-rk3328-evb-20181204144503.dtb drwxr-xr-x 2 jasonc jasonc 4096 12月 5 01:42 rk-binary -rw-r--r-- 1 jasonc jasonc 134313 12月 5 01:51 rk-image-multimedia-evb-rk3328-20181204144503.testdata.json -rw-r--r-- 2 jasonc jasonc 241113088 12月 5 15:37 rk-image-multimedia-evb-rk3328-20181205073158.rootfs.ext4 -rw-r--r-- 2 jasonc jasonc 19834 12月 5 15:36 rk-image-multimedia-evb-rk3328-20181205073158.rootfs.manifest -rw-r--r-- 1 jasonc jasonc 134315 12月 5 15:36 rk-image-multimedia-evb-rk3328-20181205073158.testdata.json -rw-r--r-- 1 jasonc jasonc 117411840 12月 5 15:37 rk-image-multimedia-evb-rk3328-boot.img lrwxrwxrwx 2 jasonc jasonc 57 12月 5 15:37 rk-image-multimedia-evb-rk3328.ext4 -> rk-image-multimedia-evb-rk3328-20181205073158.rootfs.ext4 -rw-r--r-- 1 jasonc jasonc 376438784 12月 5 15:37 rk-image-multimedia-evb-rk3328-gpt.img lrwxrwxrwx 2 jasonc jasonc 61 12月 5 15:36 rk-image-multimedia-evb-rk3328.manifest -> rk-image-multimedia-evb-rk3328-20181205073158.rootfs.manifest lrwxrwxrwx 1 jasonc jasonc 59 12月 5 15:36 rk-image-multimedia-evb-rk3328.testdata.json -> rk-image-multimedia-evb-rk3328-20181205073158.testdata.json lrwxrwxrwx 2 jasonc jasonc 33 12月 5 01:42 u-boot.bin -> u-boot-evb-rk3328-20171218-r0.bin -rw-r--r-- 2 jasonc jasonc 674211 12月 5 01:42 u-boot-evb-rk3328-20171218-r0.bin lrwxrwxrwx 2 jasonc jasonc 33 12月 5 01:42 u-boot-evb-rk3328.bin -> u-boot-evb-rk3328-20171218-r0.bin -rw-r--r-- 1 jasonc jasonc 4194304 12月 5 15:37 u-boot.img $
What is the similarities between the Monica Lewinsky and the vending machine?
...
Answer: Insert the Bill.
http://blog.sina.com.tw/william_liao/article.php?entryid=658195
http://rickey-nctu.blogspot.com/2013/08/live-build-ubuntu.html
留言列表