FROG-01-開發(fā)環(huán)境和編譯燒錄

FROG項目培訓文檔系列之01? ??

開發(fā)環(huán)境和編譯燒錄



本章內容包括:

1.Genbox安裝準備

2.安裝Genbox環(huán)境

3.運行Genbox

4.安裝配置平臺release

5.使用prebuilt安裝rootfs

6.如何編譯你修改的軟件包

6.燒錄到板

7.生成可寫rootfs文件系統(tǒng)


開始本章之前,請確保Ubuntu14.04系統(tǒng)已經安裝

Genbox即是Frog系統(tǒng)的交叉編譯環(huán)境也是集成環(huán)境。

https://devmanual.gentoo.org/ 官方開發(fā)手冊

It manages its own packages, controls the execution environment and guarantees the stability and reproducibility of the embedded-system building process.The Genbox cross-compilation environment is composed of two parts:

- the compilation environment which appears as a “squashfs” image (file structure on your disk),

- the management script to download, install and run this image.

1.Genbox安裝準備

To use the?Genbox, you need GitHub SSH credentials and a Frog authentication token. You also need to link your Frog and GitHub accounts.

Supported platforms : Ubuntu 14.04

Required packages

1).Install the?squashfstools?package:

sudo apt-get install squashfs-tools

2).Check that the?openssh?and?openssh-client?packages are installed.

sudo apt-get install ssh

sudo apt-get install openssh-server

sudo apt-get install openssh-client

3).Prepare your SSH and Github credentials.

? ? The?Genbox?requires you to use SSH to connect to?Github.

? ? ? ssh-keygen -t rsa -b 4096 -C "wang2@qq.com"

? ? ? ?Make sure the SSH agent is active:

? ? ? ? ?ps aux |grep ssh-agent

? ? ? Should return something like:

user? ? ? 1311? 0.0? 0.0? 2300? 288 ?? ? ? ? Ss? 11:28? 0:00 /usr/bin/ssh-agent /usr/bin/dbus-launch --exit-with-session /usr/bin/im-launch gnome-session --session=ubuntu

If not, launch a new SSH agent:

eval $(ssh-agent -s)

ssh-add ~/.ssh/id_rsa

ssh -T git@github.com

Make sure?SSH_AUTH_SOCK?is set to a path shared between the development computer and the Genbox (for instance,?/tmp):

? ?sudo gedit? /etc/sudoers

? ? add a line:

? ? ? ? Defaults env_keep+=SSH_AUTH_SOCK

? ? ? ? echo $SSH_AUTH_SOCK

? ? ? it Should return something like:

? ? ? ? /tmp/ssh-U1B7SaDJibVF/agent.3188

2.安裝Genbox環(huán)境

? ? ? ? You can enter genbox using:

? ? ? ?? ?sudo /genbox/bin/genbox-ng

? ? ? ? ? Create an alias to run the Genbox, and store it in your?~/.bashrc?file:

? ? ? ? ? ? ?echo 'alias run-genbox="sudo /genbox/bin/genbox-ng"' >> ~/.bashrc

? ? ? ? ? ? ? ?echo 'alias run-genbox="sudo /home/work/genbox/bin/genbox-ng"' >> ~/.bashrc

? ? ? ? ? 下次重啟后直接運行run-genbox即可啟動genbox

3.運行Genbox

? ? ?sudo /genbox/bin/genbox-ng

? ?(最近Frog網站申請的賬號,令牌包含非十六進制字符,此時會提示無效令牌,先忽略此問題,等安裝完成后用其他命令重新設置

? ? ? ? ? ?ssh -T git@github.com

? ? ? ? 申請的Frog令牌有包含非16進制的字符,在第一次配置genbox的時候回提示無效的令牌

? ? ? ? ? ?通過以下的方法fix:

? ? ? ? ? emerge --sync

? ? ? ? ?emerge frog-config

? ? ? ? ?emerge --config sys-config/frog-config

? ? ? ? ?此處重新輸入令牌配置成功

4.安裝配置平臺release

先注意一下幾點:

1)../clone_gitsrv.sh此步從網絡下載軟件包太慢,可以將文件夾里已經下載打包好的frogbywyplay.tgz放在release文件夾下,不用重復下載,直接執(zhí)行/tmp/release/init_genbox.sh即可

2).執(zhí)行/tmp/release/release_setup.sh /tmp/release完成后,刪除linux.git .用文件夾下linux.git替換,新的linux.git包含新增加我們用的平臺的flash driver

? ? rm -frv /git/his/linux.git

? ? cp -frv ./linux.git /git/his/

3).執(zhí)行以下兩步,做一次完整編譯,用prebuild不能把新flash driver編譯進去

? ? xtarget -c -v -d prebuilt_dvbc -a hi3716m42dmb =product-targets/me-4.4.3.11

? ? xmerge world

4)./script/mk_ubi_img.sh 生成image升級系統(tǒng)(直接跳過以下第5步使用prebuilt安裝rootfs)

5.使用prebuilt安裝rootfs

Frog provide one or several prebuilt rootfs, or?prebuilt, that you install and manage in the?Genbox?through?xtarget?command.

1).Ensure that your?overlays?are up-to-date, so that the list of available prebuilts is accurate as well:

xtarget --sync

The?--sync?command updates the?/usr/local/portage/targets?repository

2).Listing the prebuilts available for installation

xtarget --list-profiles --verbose

xtarget?-pv

3).Installing a prebuilt rootfs

? ? ? USE=prebuilt xtarget -c -v -d prebuilt_dvbc -a hi3716m42dmb =product-targets/me-4.4.3.11

xtarget?installs a complete?rootfs?in?/usr/targets/prebuilt_dvbc /root.

--dir?option tells?xtarget?that the new target will be installed under?/usr/targets/frog.

If you do not add?dir?option,?xtarget?creates the new target under? ? ? ? ? ? ? ? ? ? ? ? ?? ? ? ? ? ? ? ? ? ? ? ? /usr/targets/-?directory.

xtarget?just processes an?ebuild?from the “targets”?overlay?(in /usr/local/portage/targets).

? ? ? ? ? ? This target?ebuild?simply installs configuration files necessary to build a complete?rootfs.

5).Listing the installed prebuilt

xtarget?-lv

6).Setting the prebuilt as the default target

xtarget --set prebuilt_dvbc

Setting a default target creates a symlink named?/usr/targets/current?pointing to?/usr/targets/

Managing packages in a target rootfs

Genbox?is derived from?Gentoo, hence?Portage?is used in order to build a?component. This chapter is a quick?Portage?overview, so I advise you to also have a look at?Gentoo Portage official documentation.

ActionCommand

Search for packages with foo pattern in its name [1]xmerge --search foo

Install foo package (and its dependencies if missing) [2]xmerge foo

Install foo dependencies but not foo package itselfxmerge --onlydeps foo

Update Portage tree and its overlays [3]xmerge --sync

Update all installed packages [4]xmerge --update --deep world

Remove foo packagexmerge --unmerge foo

Remove orphaned dependencies [5]xmerge --depclean

Special use cases:

Using a regular expression for package search

You can enable a regular expression search by prefixing the search string with %.

For example:

xmerge --search "%^foo"

searches for any package whose name starts with “foo”.

package version to install. To install a specific package version:

xmerge '=sys-apps/busybox-1.4.1-r13'

To preview what would be installed without really installing packages:

xmerge --pretend --verbose

To preview what will be installed before installing packages:

xmerge --ask --verbose

6.如何編譯你修改的軟件包 (方法一致,以frog-ui為例)

This page explains how to retrieve an existing package, modify its code and integrate it in a target rootfs.

1.首先找到你要編輯的軟件包的ebuild文件在哪里

The component is already installed in the target?rootfs:

? xexec equery which frog-ui

this command has the advantage to display the exact desired result

The component is not installed in the target?rootfs?yet:

? xmerge --search frog-ui

? xmerge - frog-ui

the line beginning with “Path” to get the ebuild’s path.

? /usr/targets/prebuilt_dvbc/portage/frog/media-gfx/frog-ui/frog-ui-1.1.31.5.ebuild

2.獲取軟件包的源代碼

? 因為之前全部編譯后源代碼會自動刪除,這里需要重新從git庫獲取

? 在git庫中的branch和版本號,在ebuild文件中設置

? ? EGIT_BRANCH:="1.1.31-stable"

? ? EGIT_REVISION:="asa11********"

xbuild /usr/targets/prebuilt_dvbc/portage/frog/media-gfx/frog-ui/frog-ui-1.1.31.5.ebuild clean

xbuild? /usr/targets/prebuilt_dvbc/portage/frog/media-gfx/frog-ui/frog-ui-1.1.31.5.ebuild unpack

clean會清除xbuild /usr/targets/prebuilt_dvbc/portage/frog/media-gfx/下面的frog-ui文件夾下所有內容。所以在你的改動push到git origin之前不要執(zhí)行,不然改動丟失。

unpack會從/git/frogbywyplay/app_frog-ui.git庫clone源代碼到work目錄

The?unpack?action indicates where to find the component sources, here in?:

? ? /usr/targets/prebuilt_dvbc/work/media-gfx/frog-ui-1.1.31.5/work/frog-ui-1.1.31.5

3.修改代碼,執(zhí)行編譯安裝命令:

xbuild /usr/targets/current/portage/wms/dev-libs/wylog/wylog-1.2.4.ebuild compile

>>> Compiling source in ????/usr/targets/.../work/dev-libs/wylog-1.2.4/work//frog-ui-1.1.31.5 ...

* Running eautoreconf in ????'/usr/targets/.../work/dev-libs/wylog-1.2.4/work//frog-ui-1.1.31.5...

* QA Warning: running aclocal in compile phase

* Running aclocal …

[...]

>>> Source compiled.

xbuild /usr/targets/current/portage/wms/dev-libs/wylog/wylog-1.2.4.ebuild? install

4.將生產的binary文件合并到default target rootfs:

? xbuild /usr/targets/current/portage/wms/dev-libs/wylog/wylog-1.2.4.ebuild install qmerge

5 ./script/mk_ubi_img.sh 生成image升級系統(tǒng),測試

6.測試OK后,推送到remote git庫保存.

6.燒錄到板,硬件連接

平臺和電視用HDMI線連接.

平臺和電腦連接在同一個路由器,組成局域網內

用USB串口將板子串口和電腦連接,安裝好驅動

機頂盒平臺接上DVB信號線

連接機頂盒平臺電源

執(zhí)行./script/mk_ubi_img.sh 后會在當前的target root下生成:

/usr/target/current/root/boot/uImage

/usr/target/current/root/img/ubi.img

1.將上面兩個文件copy到tmp文件夾下,exit genbox環(huán)境,復制到U盤。

2.將uImage,ubi.img和partitions_nand.xml分區(qū)表xml文件放在同一個文件夾下。

3.打開燒錄工具hitools

燒錄需要配置好串口和網絡,串口選擇你正在用的端口,如果是多網卡,選擇局域網卡IP

板端配置默認即可

傳輸方式選默認網口

選擇文件夾下的分區(qū)表文件,即partitions_nand.xml,下面會自動流出升級對應分區(qū)文件

勾選需要升級的分區(qū)即可,比如frog-ui只需要升級rootfs即可

4,配置OK后點擊燒錄,板子斷電重啟,即可自動升級后重啟完成。

7.生成可寫rootfs文件系統(tǒng)

以下方法可以生產可寫的roorfs文件系統(tǒng),方法修改板子上的文件設置和替換更新模塊

1)修改/script/mk_ubi_img.sh中關于roofs_ubifs配置

vol_type修改為dynamic

vol_size設置為100M

[roofs_ubifs]

mode=ubi

image=ubifs.img

vol_id=0

vol_size=100MiB

vol_type=dynamic

vol_name=rootfs

2)執(zhí)行/script/mk_ubi_img.sh,生成image升級系統(tǒng)

3)開機啟動后按住ctrl+c,進入fastboot模式,將啟動參數(shù)設置為rw

fastboot# print

bootdelay=1

baudrate=115200

ethaddr=00:00:00:00:00:00

ipaddr=192.168.1.10

serverip=192.168.1.1

netmask=255.255.255.0

bootfile="uImage"

bootargs_512M=mem=512M mmz=ddr,0,0,256M

bootargs_1G=mem=1G mmz=ddr,0,0,380M

bootargs_2G=mem=2G mmz=ddr,0,0,600M

bootargs=console=ttyAMA0,115200 ubi.mtd=6 root=ubi0:rootfs rootfstype=ubifs mem=512M mmz=ddr,0,0,256M mtdparts=hinand:1M(boot),1M(bootargs),1M(baseparam),1M(pqparam),1M(logo),8M(kernel),-(rootfs) ro rootwait // 這里ro需要改為rw

bootcmd=nand read 1000000 500000 800000;bootm 1000000

stdin=serial

stdout=serial

stderr=serial

ethact=up

ver=Fastboot 3.3.0-dirty (dwx443370@fish) (Mar 16 2017 - 20:11:30)

Environment size: 627/65532 bytes

敲如下命令重洗設置可寫啟動參數(shù):

set bootargs 'console=ttyAMA0,115200 ubi.mtd=6 root=ubi0:rootfs rootfstype=ubifs mem=512M mmz=ddr,0,0,256M mtdparts=hinand:1M(boot),1M(bootargs),1M(baseparam),1M(pqparam),1M(logo),8M(kernel),-(rootfs) rw rootwait'

然后執(zhí)行save命令保存。

4)啟動系統(tǒng)后,文件系統(tǒng)即是可寫的。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容