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

FROG項(xiàng)目培訓(xùn)文檔系列之01? ??

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



本章內(nèi)容包括:

1.Genbox安裝準(zhǔn)備

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

3.運(yùn)行Genbox

4.安裝配置平臺release

5.使用prebuilt安裝rootfs

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

6.燒錄到板

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


開始本章之前,請確保Ubuntu14.04系統(tǒng)已經(jī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安裝準(zhǔn)備

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

? ? ? ? ? 下次重啟后直接運(yùn)行run-genbox即可啟動genbox

3.運(yùn)行Genbox

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

? ?(最近Frog網(wǎng)站申請的賬號驱证,令牌包含非十六進(jìn)制字符,此時(shí)會提示無效令牌读恃,先忽略此問題,等安裝完成后用其他命令重新設(shè)置

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

? ? ? ? 申請的Frog令牌有包含非16進(jìn)制的字符代态,在第一次配置genbox的時(shí)候回提示無效的令牌

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

? ? ? ? ? emerge --sync

? ? ? ? ?emerge frog-config

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

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

4.安裝配置平臺release

先注意一下幾點(diǎn):

1)../clone_gitsrv.sh此步從網(wǎng)絡(luò)下載軟件包太慢寺惫,可以將文件夾里已經(jīng)下載打包好的frogbywyplay.tgz放在release文件夾下,不用重復(fù)下載蹦疑,直接執(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編譯進(jìn)去

? ? 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.獲取軟件包的源代碼

? 因?yàn)橹叭烤幾g后源代碼會自動刪除腔呜,這里需要重新從git庫獲取

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

? ? 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文件夾下所有內(nèi)容再悼。所以在你的改動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.將生產(chǎn)的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線連接.

平臺和電腦連接在同一個(gè)路由器莺奸,組成局域網(wǎng)內(nèi)

用USB串口將板子串口和電腦連接丑孩,安裝好驅(qū)動

機(jī)頂盒平臺接上DVB信號線

連接機(jī)頂盒平臺電源

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

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

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

1.將上面兩個(gè)文件copy到tmp文件夾下,exit genbox環(huán)境灭贷,復(fù)制到U盤温学。

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

3.打開燒錄工具h(yuǎn)itools

燒錄需要配置好串口和網(wǎng)絡(luò)仗岖,串口選擇你正在用的端口,如果是多網(wǎng)卡览妖,選擇局域網(wǎng)卡IP

板端配置默認(rèn)即可

傳輸方式選默認(rèn)網(wǎng)口

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

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

4紧帕,配置OK后點(diǎn)擊燒錄,板子斷電重啟桅打,即可自動升級后重啟完成是嗜。

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

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

1)修改/script/mk_ubi_img.sh中關(guān)于roofs_ubifs配置

vol_type修改為dynamic

vol_size設(shè)置為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)開機(jī)啟動后按住ctrl+c,進(jìn)入fastboot模式鹅搪,將啟動參數(shù)設(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è)置可寫啟動參數(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)即是可寫的丽柿。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市魂挂,隨后出現(xiàn)的幾起案子甫题,更是在濱河造成了極大的恐慌,老刑警劉巖涂召,帶你破解...
    沈念sama閱讀 218,525評論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件坠非,死亡現(xiàn)場離奇詭異,居然都是意外死亡果正,警方通過查閱死者的電腦和手機(jī)炎码,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,203評論 3 395
  • 文/潘曉璐 我一進(jìn)店門盟迟,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人潦闲,你說我怎么就攤上這事攒菠。” “怎么了歉闰?”我有些...
    開封第一講書人閱讀 164,862評論 0 354
  • 文/不壞的土叔 我叫張陵辖众,是天一觀的道長。 經(jīng)常有香客問我新娜,道長赵辕,這世上最難降的妖魔是什么既绩? 我笑而不...
    開封第一講書人閱讀 58,728評論 1 294
  • 正文 為了忘掉前任概龄,我火速辦了婚禮,結(jié)果婚禮上饲握,老公的妹妹穿的比我還像新娘私杜。我一直安慰自己,他們只是感情好救欧,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,743評論 6 392
  • 文/花漫 我一把揭開白布衰粹。 她就那樣靜靜地躺著,像睡著了一般笆怠。 火紅的嫁衣襯著肌膚如雪铝耻。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,590評論 1 305
  • 那天蹬刷,我揣著相機(jī)與錄音瓢捉,去河邊找鬼。 笑死办成,一個(gè)胖子當(dāng)著我的面吹牛泡态,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播迂卢,決...
    沈念sama閱讀 40,330評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼某弦,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了而克?” 一聲冷哼從身側(cè)響起靶壮,我...
    開封第一講書人閱讀 39,244評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎员萍,沒想到半個(gè)月后腾降,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,693評論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡充活,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,885評論 3 336
  • 正文 我和宋清朗相戀三年蜂莉,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了蜡娶。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,001評論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡映穗,死狀恐怖窖张,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情蚁滋,我是刑警寧澤宿接,帶...
    沈念sama閱讀 35,723評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站辕录,受9級特大地震影響睦霎,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜走诞,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,343評論 3 330
  • 文/蒙蒙 一副女、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧蚣旱,春花似錦碑幅、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,919評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至异吻,卻和暖如春裹赴,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背诀浪。 一陣腳步聲響...
    開封第一講書人閱讀 33,042評論 1 270
  • 我被黑心中介騙來泰國打工棋返, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人笋妥。 一個(gè)月前我還...
    沈念sama閱讀 48,191評論 3 370
  • 正文 我出身青樓懊昨,卻偏偏與公主長得像,于是被迫代替她去往敵國和親春宣。 傳聞我的和親對象是個(gè)殘疾皇子酵颁,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,955評論 2 355

推薦閱讀更多精彩內(nèi)容