構建BBB內核

說明:文中全部翻譯的英文文檔
文中是編譯BeagleBone Black的內核

  1. 下載交叉編譯工具連,假如你是ubuntu直接執行:
apt-get install gcc-arm-linux-gnueabi

其他管理器需要執行:

yum install gcc-arm-linux-gnu
  1. 有可能你的系統沒有lzop需要安裝一下,不然make的時候可能提示錯誤:
apt-get install lzop
  1. 爲了後面可以正確的執行 mkimage 還需要下載uboot:
wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2

tar -xjf u-boot-latest.tar.bz2

cd u-boot-<version>

Building <= v1014.07: make tools-only   
Building >= v1014.10: make sandbox_defconfig tools-only 

#下面是安裝工具
sudo install tools/mkimage /usr/local/bin

4.接下來就是下載內核鏡像並且編譯它:

#下載源碼
git clone git://github.com/beagleboard/kernel.git
cd kernel
git checkout 3.8
#下面是下載源碼包,可能需要很長的時間(與網速有關)
./patch.sh

#選擇配置文件
cp configs/beaglebone kernel/arch/arm/configs/beaglebone_defconfig

#下載固件
wget http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O kernel/firmware/am335x-pm-firmware.bin

#進入源碼目錄
cd kernel

#可以編譯

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- beaglebone_defconfig

#編譯鏡像,需要幾分鐘的時間
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage uImage dtbs 

#
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage-dtb.am335x-boneblack

This step builds the kernel for the BBB

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules

到這裏就可以了,主要把生成的arch/arm/boot/zImage拷貝到BBB板子的原系統下的/boot/uboot/ 下替換掉原來的zImage,重啓後就進入了新的系統。

5.當然,除此之外也可以下載到內存中然後去執行,後先在
arch/arm/boot/uImage-dtb.am335x-boneblack拷貝到你的tftp的目錄,當然,爲了操作方便,可以給uImage-dtb.am335x-boneblack起個新的名字,這裏,將其拷貝成 uImage-BBB
接來下執行mkimage 檢測鏡像是否是正確的:

[user@sl61 tftpboot]$ mkimage -l uImage-BBB

Image Name: Linux-3.8.13-00650-g5506bfa

Created: Sun Jun 16 14:43:36 2013

Image Type: ARM Linux Kernel Image (uncompressed)

Data Size: 4278313 Bytes = 4178.04 kB = 4.08 MB

Load Address: 80008000

Entry Point: 80008000

[user@sl61 tftpboot]$

一切執行完畢,就可以通過uboot下載該鏡像,重啓BBB開發板,然後快速按下空格鍵進入uboot命令行模式,進入之後,執行:

setenv autoload no
#通過DHCP獲取ip地址
dhcp

#現在評估板應該就有一個正確的IP地址了,假如地址爲192.168.1.70,且假設tftp服務器地址爲 192.168.1.76執行:

setenv serverip 192.168.1.76

#通過tftp將鏡像下載到內存裏面
tftp 0x80200000 uImage-BBB
#設置啓動環境變量
setenv bootargs console=ttyO0,115200n8 quiet root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait
#啓動內核
bootm 0x80200000

下面是針對不同uboot的啓動界面:
U-Boot SPL 2013.04-dirty (May 20 2013 - 14:30:06)

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)

musb-hdrc: MHDRC RTL version 2.0

musb-hdrc: setup fifo_mode 4

musb-hdrc: 28/31 max ep, 16384/16384 memory

USB Peripheral mode controller at 47401000 using PIO, IRQ 0

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)

musb-hdrc: MHDRC RTL version 2.0

musb-hdrc: setup fifo_mode 4

musb-hdrc: 28/31 max ep, 16384/16384 memory

USB Host mode controller at 47401800 using PIO, IRQ 0

OMAP SD/MMC: 0

mmc_send_cmd : timeout: No status update

reading u-boot.img

reading u-boot.img

U-Boot 2013.04-dirty (May 20 2013 - 14:30:06)

I2C: ready

DRAM: 512 MiB

WARNING: Caches not enabled

NAND: No NAND device found!!!

0 MiB

MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1

* Warning - readenv() failed, using default environment

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)

musb-hdrc: MHDRC RTL version 2.0

musb-hdrc: setup fifo_mode 4

musb-hdrc: 28/31 max ep, 16384/16384 memory

USB Peripheral mode controller at 47401000 using PIO, IRQ 0

musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, HB-ISO Rx, HB-ISO Tx, SoftConn)

musb-hdrc: MHDRC RTL version 2.0

musb-hdrc: setup fifo_mode 4

musb-hdrc: 28/31 max ep, 16384/16384 memory

USB Host mode controller at 47401800 using PIO, IRQ 0

Net: not set. Validating first E-fuse MAC

cpsw, usb_ether

Hit any key to stop autoboot: 0

U-Boot#

U-Boot#

U-Boot# setenv autoload no

U-Boot# dhcp

link up on port 0, speed 100, full duplex

BOOTP broadcast 1

DHCP client bound to address 192.168.1.70

U-Boot# setenv serverip 192.168.1.76

U-Boot# tftp 0x80200000 uImage-BBB

link up on port 0, speed 100, full duplex

Using cpsw device

TFTP from server 192.168.1.76; our IP address is 192.168.1.70

Filename ‘uImage-BBB’.

Load address: 0x80200000

Loading: #################################################################

     #################################################################         
    #################################################################         
    #################################################################         
    ################################                                          
    392.6 KiB/s                                                               

done

Bytes transferred = 4280457 (415089 hex)

U-Boot# setenv bootargs console=ttyO0,115200n8 quiet root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait

U-Boot# bootm 0x80200000

Booting kernel from Legacy Image at 80200000 …

Image Name: Linux-3.8.13-00650-gb0f8aff
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 4280393 Bytes = 4.1 MiB
Load Address: 80008000
Entry Point: 80008000
Verifying Checksum … OK
Loading Kernel Image … OK
OK

Starting kernel …

Uncompressing Linux… done, booting the kernel.

[ 0.192647] omap2_mbox_probe: platform not supported

[ 0.203312] tps65217-bl tps65217-bl: no platform data provided

[ 0.280007] bone-capemgr bone_capemgr.8: slot #0: No cape found

[ 0.317116] bone-capemgr bone_capemgr.8: slot #1: No cape found

[ 0.354223] bone-capemgr bone_capemgr.8: slot #2: No cape found

[ 0.391333] bone-capemgr bone_capemgr.8: slot #3: No cape found

[ 0.411269] bone-capemgr bone_capemgr.8: slot #6: BB-BONELT-HDMIN conflict P8.4)

[ 0.420889] bone-capemgr bone_capemgr.8: slot #6: Failed verification

[ 0.427668] bone-capemgr bone_capemgr.8: loader: failed to load slot-6 BB-BONEL)

[ 0.450198] omap_hsmmc mmc.4: of_parse_phandle_with_args of ‘reset’ failed

[ 0.514871] pinctrl-single 44e10800.pinmux: pin 44e10854 already requested by 47

[ 0.526614] pinctrl-single 44e10800.pinmux: pin-21 (gpio-leds.7) status -22

[ 0.533928] pinctrl-single 44e10800.pinmux: could not request pin 21 on device e

[ 1.245582] systemd[1]: Failed to insert module ‘autofs4’

[ 1.504995] systemd[1]: Failed to open /dev/autofs: No such file or directory

[ 1.512556] systemd[1]: Failed to initialize automounter: No such file or direcy

[ 1.520702] systemd[1]: Failed to set up automount Arbitrary Executable File Fo.

[ 6.637581] libphy: PHY 4a101000.mdio:01 not found

[ 6.642639] net eth0: phy 4a101000.mdio:01 not found on slave 1

systemd-fsck[84]: Angstrom: clean, 50555/112672 files, 291538/449820 blocks

.—O—.

| | .-. o o

| | |—–.—–.—–.| | .—-..—–.—–.

| | | __ | —’| ‘–.| .-‘| | |

| | | | | |— || –’| | | ’ | | | |

‘—’—’–’–’–. |—–”—-”–’ ‘—–’-‘-‘-‘

           -'  |                                                              
           '---'                                                              

The Angstrom Distribution beaglebone ttyO0

Angstrom v2012.12 - Kernel 3.8.13-00650-gb0f8aff

beaglebone login:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章