作为一大硬件开源组织中的一员,Beagle X15以他的强悍的性能在工业界有着广泛的应用,最近在做一个项目中
要用到它,就做了一些这方便的研究,发现里面还有不少坑要踩的,梳理一下踩到的坑,为后续做个积累吧。
基本链接:
- Running a recent release of Debian, Fedora or Ubuntu; without OS Virtualization Software.
- ARM Cross Compiler – Linaro: http://www.linaro.org
- Linaro Toolchain Binaries: http://www.linaro.org/downloads/
- Bootloader
- 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
- Linus's Mainline tree: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
- ARM based rootfs
- Debian: https://www.debian.org
- Ubuntu: http://www.ubuntu.com
ARM交叉编译器的安装:
这里是个64bit的linux平台上安装的预编译版本,具体步骤如下所示:
wget -c https://releases.linaro.org/components/toolchain/binaries/6.4-2017.11/arm-linux-gnueabihf/gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz tar xf gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf.tar.xz export CC=`pwd`/gcc-linaro-6.4.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
测试交叉编译器:
${CC}gcc --version arm-linux-gnueabihf-gcc (Linaro GCC 6.4-2017.11) 6.4.1 20171012 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
BootLoader U-Boot下载和安装:
eewiki.net patch archive: https://github.com/eewiki/u-boot-patches
git clone https://github.com/u-boot/u-boot cd u-boot/ git checkout v2017.01 -b tmp
打patch:
git pull --no-edit git://git.ti.com/ti-u-boot/ti-u-boot.git ti-u-boot-2017.01 git checkout 590c7d7fe15d06a4d708403d3234bcd01cd039e1 wget -c https://rcn-ee.com/repos/git/u-boot-patches/ti-2017.01/0001-beagle_x15-uEnv.txt-bootz-n-fixes.patch patch -p1 < 0001-beagle_x15-uEnv.txt-bootz-n-fixes.patch
配置和编译:
make ARCH=arm CROSS_COMPILE=${CC} distclean make ARCH=arm CROSS_COMPILE=${CC} am57xx_evm_defconfig make ARCH=arm CROSS_COMPILE=${CC}
编辑和下载kernel:
作这个脚本来编译内核,模块和设备数并把他们拷贝到delay目录:
~/ git clone https://github.com/RobertCNelson/ti-linux-kernel-dev.git cd ti-linux-kernel-dev/ For TI v4.9.x: ~/ti-linux-kernel-dev/ git checkout origin/ti-linux-4.9.y -b tmp ~/ti-linux-kernel-dev/ ./build_kernel.sh
根文件系统
debian 9 用户名:debian 密码:temppwd
根用户:root 密码:root
下载:
wget -c https://rcn-ee.com/rootfs/eewiki/minfs/debian-9.3-minimal-armhf-2017-12-09.tar.xz
校验:
sha256sum debian-9.3-minimal-armhf-2017-12-09.tar.xz 5120fcfb8ff8af013737fae52dc0a7ecc2f52563a9aa8f5aa288aff0f3943d61 debian-9.3-minimal-armhf-2017-12-09.tar.xz
解压缩:
tar xf debian-9.3-minimal-armhf-2017-12-09.tar.xz
设置SD并安装驱动:
这里假设sd卡的盘符是/dev/sdb 可以使用export = /dev/sdb 这个每个设备都不一样,可以通过lsblk来查找。
export DISK=/dev/sdb
擦除SD卡的符号表:
sudo dd if=/dev/zero of=${DISK} bs=1M count=10
安装bootloader
sudo dd if=./u-boot/MLO of=${DISK} count=2 seek=1 bs=128k sudo dd if=./u-boot/u-boot.img of=${DISK} count=4 seek=1 bs=384k
创建分区布局:
sudo sfdisk ${DISK} <<-__EOF__ 4M,,L,* __EOF__
格式化盘符:
sudo mkfs.ext4 -L rootfs ${DISK}1
mount系统:
sudo mkdir -p /media/rootfs/ for: DISK=/dev/sdX sudo mount ${DISK}1 /media/rootfs/
安装kernel和root file system:
这里首先要导出内核版本号,可以通过在前面编译好的ti-linux-kernel-dev/deploy目录下查看内核版本号,我的
是:4.9.83-ti-r104 导出内核符号表:
export kernel_version=4.9.83-ti-r104
拷贝根目录:
sudo tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /media/rootfs/ sync sudo chown root:root /media/rootfs/ sudo chmod 755 /media/rootfs/
设置名字和启动项在 /boot/uEnv.txt中:
sudo sh -c "echo 'uname_r=${kernel_version}' >> /media/rootfs/boot/uEnv.txt"
sudo sh -c "echo 'fdtfile=am57xx-beagle-x15.dtb' > /media/rootfs/boot/uEnv.txt"
启用systemd:
sudo sh -c "echo 'cmdline=quiet init=/lib/systemd/systemd' >> /media/rootfs/boot/uEnv.txt"
复制内核文件:
sudo cp -v ./ti-linux-kernel-dev/deploy/${kernel_version}.zImage /media/rootfs/boot/vmlinuz-${kernel_version}
拷贝内核设备数:
sudo mkdir -p /media/rootfs/boot/dtbs/${kernel_version}/
sudo tar xfv ./ti-linux-kernel-dev/deploy/${kernel_version}-dtbs.tar.gz -C /media/rootfs/boot/dtbs/${kernel_version}/
拷贝内核模块:
sudo tar xfv ./ti-linux-kernel-dev/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/
拷贝文件系统列表:
sudo sh -c "echo '/dev/mmcblk0p1 / auto errors=remount-ro 0 1' >> /media/rootfs/etc/fstab"
移除SD卡:
sync
sudo umount /media/rootfs
把sd卡放入系统启动即可。
参考目录:
https://eewiki.net/display/linuxonarm/BeagleBone+Black
https://eewiki.net/display/linuxonarm/BeagleBoard-X15
http://blog.csdn.net/liangzhenliang/article/details/41947481