说明:文中全部翻译的英文文档
文中是编译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:

Logo

更多推荐