[经验] 【学习Sitara™ AM335x】- Beaglebone环境的搭建方法

chenzhufly   2012-11-14 18:56 楼主
Basic Requirements

ARM Cross Compiler
  1. Ubuntu (11.04 (Natty Narwhal) minimum): sudo apt-get install gcc-arm-linux-gnueabi
    Linaro: https://launchpad.net/linaro-toolchain-binaries
Bootloader
  1. Das U-Boot – the Universal Boot Loader http://www.denx.de/wiki/U-Boot
    Source – http://git.denx.de/?p=u-boot.git;a=summary
Linux Kernel
  1. Linus's Mainline tree: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=summary
    Linux omap tree: http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap.git
    Arago Project TI Staging tree: http://arago-project.org/git/projects/?p=linux-am33x.git;a=shortlog;h=refs/heads/v3.2-staging
ARM based rootfs
  1. Debian Squeeze: http://www.debian.org/
Bootloader

Das U-Boot – the Universal Boot Loader http://www.denx.de/wiki/U-Boot

U-Boot Download:
Download U-Boot via git:
  1. git clone git://git.denx.de/u-boot.git
    cd u-boot/
    git checkout v2012.10 -b tmp
U-Boot Patches:
  1. wget https://raw.github.com/RobertCNelson/Bootloader-Builder/master/patches/v2012.10/0001-enable-bootz-support.patch
    wget https://raw.github.com/RobertCNelson/Bootloader-Builder/master/patches/v2012.10/0002-am33xx-Enable-DDR3-for-DDR3-version-of-beaglebone.patch
    patch -p1 < 0001-enable-bootz-support.patch
    patch -p1 < 0002-am33xx-Enable-DDR3-for-DDR3-version-of-beaglebone.patch
U-Boot Configure and Build:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- distclean
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- am335x_evm_config
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-
Linux Kernel

Linux Build Script:
  1. git clone git://github.com/RobertCNelson/linux-dev.git
    cd linux-dev/
    git checkout origin/am33x-v3.2 -b am33x-v3.2
For Mainline v3.6.x (in development, limited cape support)
  1. git checkout origin/am33x-v3.6 -b am33x-v3.6
Run Build Script:
  1. ./build_kernel.sh
The kernel zImage and modules will be under the deploy directory.

Debian Squeeze 6.0.6 (armel based) Root File System

Default User: debian
Password: temppwd

Root User: root
Root Password: root
  1. wget -c http://rcn-ee.net/deb/minfs/squeeze/debian-6.0.6-minimal-armel-2012-10-22.tar.xz
verify the image with:
  1. md5sum debian-6.0.6-minimal-armel-2012-10-22.tar.xz
    97a4717d95c72d3c9d931a39a3aa58c6  debian-6.0.6-minimal-armel-2012-10-22.tar.xz
Extract Image:
  1. tar xJf debian-6.0.6-minimal-armel-2012-10-22.tar.xz
Debian Wheezy (snapshot) (armhf based) Root File System

Default User: debian
Password: temppwd

Root User: root
Root Password: root
  1. wget -c http://rcn-ee.net/deb/minfs/wheezy/debian-wheezy-minimal-armhf-2012-10-22.tar.xz
verify the image with:
  1. md5sum debian-wheezy-minimal-armhf-2012-10-22.tar.xz
    ff409aa856b4b2ab86a6c8126a349926  debian-wheezy-minimal-armhf-2012-10-22.tar.xz
Extract Image:
  1. tar xJf debian-wheezy-minimal-armhf-2012-10-22.tar.xz
Ubuntu 12.10 (Quantal) (armhf based) Root File System

Default User: ubuntu
Password: temppwd
  1. wget -c http://rcn-ee.net/deb/minfs/quantal/ubuntu-12.10-minimal-armhf-2012-10-22.tar.xz
verify the image with:
  1. md5sum ubuntu-12.10-minimal-armhf-2012-10-22.tar.xz
    442c3a26af8e80ecf44ea470f5dcacd5  ubuntu-12.10-minimal-armhf-2012-10-22.tar.xz
Extract Image:
  1. tar xJf ubuntu-12.10-minimal-armhf-2012-10-22.tar.xz
Setup microSD card

For these instruction, we are assuming: DISK=/dev/mmcblk0, "sudo fdisk -l" is useful for determining the device id..
  1. export DISK=/dev/mmcblk0
Erase microSD card:
  1. sudo parted --script ${DISK} mklabel msdos
Setup Boot Partition:
  1. sudo fdisk ${DISK} << __EOF__
    n
    p
    1
    +64M
    t
    e
    p
    w
    __EOF__
Set Boot Flag
  1. sudo parted --script ${DISK} set 1 boot on
Format Boot Partition as vfat:
  1. DISK=/dev/mmcblk0
    sudo mkfs.vfat -F 16 ${DISK}p1 -n boot
    (or)
    DISK=/dev/sdX
    sudo mkfs.vfat -F 16 ${DISK}1 -n boot
Setup Root File System Partition:
  1. sudo fdisk ${DISK} << __EOF__
    n
    p
    2
    w
    __EOF__
Format rootfs as ext4:
  1. DISK=/dev/mmcblk0
    sudo mkfs.ext4 ${DISK}p2 -L rootfs
    (or)
    DISK=/dev/sdX
    sudo mkfs.ext4 ${DISK}2 -L rootfs
Mount the Boot & Root File System Partitions:

Install Bootloaders:

Copy MLO to the boot partition
  1. sudo cp -v ./u-boot/MLO /media/boot/
Copy u-boot.img to the boot partition
  1. sudo cp -v ./u-boot/u-boot.img /media/boot/
uEnv.txt v3.2.x based bootscript
Create U-Boot v3.2.x "uEnv.txt" boot script: (nano uEnv.txt)
  1. uEnv.txt
    console=ttyO0,115200n8
    mmcroot=/dev/mmcblk0p2 ro
    mmcrootfstype=ext4 rootwait fixrtc
    mmc_load_image=fatload mmc 0:1 0x80300000 zImage
    mmc_load_initrd=fatload mmc 0:1 0x81600000 initrd.img; setenv initrd_size ${filesize}
    mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype}
    #Just: zImage
    xyz_mmcboot=run mmc_load_image; echo Booting from mmc ...
    loaduimage=run xyz_mmcboot; run mmcargs; bootz 0x80300000
    #zImage and initrd
    #xyz_mmcboot=run mmc_load_image; run mmc_load_initrd; echo Booting from mmc ...
    #loaduimage=run xyz_mmcboot; run mmcargs; bootz 0x80300000 0x81600000:${initrd_size}
uEnv.txt v3.6.x device tree based bootscript
Create Device Tree v3.6.x "uEnv.txt" boot script: (nano uEnv.txt)
  1. uEnv.txt
    initrd_high=0xffffffff
    fdt_high=0xffffffff
    dtb_file=am335x-bone.dtb
    console=ttyO0,115200n8
    mmcroot=/dev/mmcblk0p2 ro
    mmcrootfstype=ext4 rootwait fixrtc
    mmc_load_image=fatload mmc 0:1 0x80300000 zImage
    mmc_load_initrd=fatload mmc 0:1 0x81600000 initrd.img; setenv initrd_size ${filesize}
    mmc_load_dtb=fatload mmc 0:1 0x815f0000 /dtbs/${dtb_file}
    mmcargs=setenv bootargs console=${console} root=${mmcroot} rootfstype=${mmcrootfstype}
    #Just: zImage
    xyz_mmcboot=run mmc_load_image; run mmc_load_dtb; echo Booting from mmc ...
    loaduimage=run xyz_mmcboot; run mmcargs; bootz 0x80300000 - 0x815f0000
    #zImage and initrd
    #xyz_mmcboot=run mmc_load_image; run mmc_load_initrd; run mmc_load_dtb; echo Booting from mmc ...
    #loaduimage=run xyz_mmcboot; run mmcargs; bootz 0x80300000 0x81600000:${initrd_size} 0x815f0000
Copy uEnv.txt to the boot partition:
  1. sudo cp -v ./uEnv.txt /media/boot/
Note: This repo tree is under active development, so the Kernel version can change on a daily basis...
Copy Kernel zImage:
  1. sudo cp -v ./linux-dev/deploy/3.2.33-psp26.zImage /media/boot/zImage
Copy Kernel dtbs (Device Tree v3.6.x):
  1. sudo mkdir -p /media/boot/dtbs/
    sudo tar xfv ./linux-dev/deploy/3.6.0-bone0-dtbs.tar.gz -C /media/boot/dtbs/
Copy Root File System:
  1. sudo tar xfvp ./*-*-minimal-arm*-*/armel-rootfs-*.tar -C /media/rootfs/
Copy Kernel modules:
  1. sudo tar xfv ./linux-dev/deploy/3.2.33-psp26-modules.tar.gz -C /media/rootfs/
Tweak "/etc/fstab", the defaults should work for most boards:
  1. sudo nano /media/rootfs/etc/fstab
Edit:
  1. /etc/fstab
    /dev/mmcblk0p2   /           auto   errors=remount-ro   0   1
    /dev/mmcblk0p1   /boot/uboot auto   defaults            0   0
Enable Networking on Bootup:
Note: Boards without ethernet interfaces will have delays on bootup.
  1. sudo nano /media/rootfs/etc/network/interfaces
From: (uncomment)
  1. /etc/network/interfaces
    #auto eth0
    #iface eth0 inet dhcp
To:
  1. /etc/network/interfaces
    auto eth0
    iface eth0 inet dhcp
    Enable Serial Login:
Debian:
  1. sudo nano /media/rootfs/etc/inittab
edit last line:
  1. /etc/inittab
    from: T2:23:respawn:/sbin/getty -L  115200 vt102
    to: T2:23:respawn:/sbin/getty -L ttyO0 115200 vt102
Ubuntu:
  1. sudo nano /media/rootfs/etc/init/serial.conf
Add:
  1. /etc/init/serial.conf
    start on stopped rc RUNLEVEL=[2345]
    stop on runlevel [!2345]
    respawn
    exec /sbin/getty 115200 ttyO0
Remove microSD card:
  1. sync
    sudo umount /media/boot
    sudo umount /media/rootfs
FAQ

CircuitCo LCD3 Backlight:
Turn on Backlight:
  1. i2cset -f -y 1 0x24 0x07 0x09
    i2cset -f -y 1 0x24 0x08 0x60
CircuitCo LCD3/LCD7 TouchScreen:
Add to /etc/modules:
  1. /etc/modules
    fbcon
    ti_tscadc

[ 本帖最后由 chenzhufly 于 2012-11-14 19:07 编辑 ]
生活就是油盐酱醋再加一点糖,快活就是一天到晚乐呵呵的忙 =================================== 做一个简单的人,踏实而务实,不沉溺幻想,不庸人自扰

回复评论 (2)

感谢楼主,很好的东西。
点赞  2014-1-8 09:11
正在学习中。。。。。。。。
点赞  2014-7-7 12:11
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复