原文网址:http://eewiki.net/display/linuxonarm/i.MX6q+SABRE+Board+for+Smart+Devices
针对其,并给出安装过程中的一些问题。重写于此。
为了防止中间出错,请首先安装以下包:
sudo apt-get install git-core gnupg flex bison gperf build-essential
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs
x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev
libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown
libxml2-utils xsltproc
sudo apt-get install uboot-mkimage
sudo apt-get install uuid-dev liblzo2-dev
sudo apt-get install meld gparted
sudo apt-get install gettext libgtk2.0-dev rpm bison m4 libfreetype6-dev
sudo apt-get install libdbus-glib-1-dev liborbit2-dev intltool
sudo apt-get install ccache ncurses-dev zlib1g zlib1g-dev gcc g++ libtool
sudo apt-get install uuid-dev liblzo2-dev
sudo apt-get install tcl dpkg
sudo apt-get install ia32-libs libc6-dev-i386 lib32z1
sudo apt-get install texlive texinfo
sudo apt-get install uboot-mkimage
sudo apt-get install meld gparted
说明:$ 后的命令为需要在终端中输入的内容
Download/Extract:
~/
$ wget -c https://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz
$ tar xf gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux.tar.xz
$ export CC=`pwd`/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnueabihf-
Test:
If this test fails, verify that you have the 32bit libraries installed on your development system.
~/
$ ${CC}gcc --version
arm-linux-gnueabihf-gcc (crosstool-NG linaro-1.13.1-4.9-2014.09 - Linaro GCC 4.9-2014.09) 4.9.2 20140904 (prerelease)
Copyright (C) 2014 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
Das U-Boot -- the Universal Boot Loader http://www.denx.de/wiki/U-Boot
Download:
~/
$ git clone git://git.denx.de/u-boot.git
$ cd u-boot/
$ git checkout v2014.10 -b tmp
Patches:
~/u-boot
$ wget -c https://raw.githubusercontent.com/eewiki/u-boot-patches/master/v2014.10/0001-mx6qsabre_common-uEnv.txt-bootz-n-fixes.patch
$ patch -p1 < 0001-mx6qsabre_common-uEnv.txt-bootz-n-fixes.patch
Configure and Build:
~/u-boot
$ make ARCH=arm CROSS_COMPILE=${CC} distclean
$ make ARCH=arm CROSS_COMPILE=${CC} mx6qsabresd_defconfig
$ make ARCH=arm CROSS_COMPILE=${CC}
Linux Kernel
This script will build the kernel and modules and copy them to the deploy directory.
Download:
~/
$ git clone https://github.com/RobertCNelson/armv7-multiplatform.git
$ cd armv7-multiplatform
For v3.17.x:
~/armv7-multiplatform
$ git checkout origin/v3.17.x -b tmp
$ ./build_kernel.sh
Root File System
Debian 7
User
Password
debian
temppwd
root
root
This image contains, systemd: https://wiki.debian.org/systemd to enable, add to uEnv.txt:
optargs=quiet init=/lib/systemd/systemd
Download:
~/
wget -c https://rcn-ee.net/deb/minfs/wheezy/debian-7.5-minimal-armhf-2014-07-07.tar.xz
Verify:
~/
md5sum debian-7.5-minimal-armhf-2014-07-07.tar.xz
cae9e0cfac14fd6aa19d4c17357aecc8 debian-7.5-minimal-armhf-2014-07-07.tar.xz
Extract:
~/
tar xf debian-7.5-minimal-armhf-2014-07-07.tar.xz
Ubuntu 14.04
User
Password
ubuntu
temppwd
Download:
~/
$ wget -c https://rcn-ee.net/deb/minfs/trusty/ubuntu-14.04-minimal-armhf-2014-07-07.tar.xz
Verify:
~/
$ md5sum ubuntu-14.04-minimal-armhf-2014-07-07.tar.xz
c30fb91012701cdbfa00bb6c86868d0a ubuntu-14.04-minimal-armhf-2014-07-07.tar.xz
Extract:
~/
$ tar xf ubuntu-14.04-minimal-armhf-2014-07-07.tar.xz
Root File System (small flash)
A Root File System around 64Mb in size, for flash applications.
Debian 7 (small flash)
User
Password
debian
temppwd
root
root
Download:
~/
$ wget -c https://rcn-ee.net/deb/barefs/wheezy/debian-7.5-bare-armhf-2014-07-07.tar.xz
Verify:
~/
$ md5sum debian-7.5-bare-armhf-2014-07-07.tar.xz
a5f0e75e5ad16bb110d4291f54ed6cb9 debian-7.5-bare-armhf-2014-07-07.tar.xz
Extract:
~/
$ tar xf debian-7.5-bare-armhf-2014-07-07.tar.xz
Setup microSD/SD card
For these instruction, we are assuming: DISK=/dev/mmcblk0, "lsblk" is very useful for determining the device id.
$ export DISK=/dev/mmcblk0 (我的电脑为$ export DISK=/dev/sdb)
Erase microSD/SD card:
$ sudo dd if=/dev/zero of=${DISK} bs=1M count=10
Install Bootloader:
~/
$ sudo dd if=./u-boot/u-boot.imx of=${DISK} bs=512 seek=2
Create Partition Layout:
$ sudo sfdisk --in-order --Linux --unit M ${DISK} <<-__EOF__
$ 1,,0x83,-
$ __EOF__
【注:这一步可能出现错误】
Checking that no-one is using this disk right now ...
BLKRRPART: 设备或资源忙
This disk is currently in use - repartitioning is probably a bad idea.
Umount all file systems, and swapoff all swap partitions on this disk.
Use the --no-reread flag to suppress this check.
Use the --force flag to overrule all checks.
【解决】
[root@fish lwg]# cat /etc/mtab //查看
$ umount /dev/sdb1
Format Partitions:
for: DISK=/dev/mmcblk0
sudo mkfs.ext4 ${DISK}p1 -L rootfs
for: DISK=/dev/sdX
$ sudo mkfs.ext4 ${DISK}1 -L rootfs
Mount Partitions:
On some systems, these partitions may be auto-mounted...
$ sudo mkdir -p /media/rootfs/
for: DISK=/dev/mmcblk0
sudo mount ${DISK}p1 /media/rootfs/
for: DISK=/dev/sdX
$ sudo mount ${DISK}1 /media/rootfs/
Install Kernel and Root File System
To help new users, since the kernel version can change on a daily basis. The kernel building scripts listed on this page will now give you a hint of what kernel version was built.
-----------------------------
Script Complete
eewiki.net: [user@localhost:~$ export kernel_version=3.X.Y-Z]
-----------------------------
Copy and paste that "export kernel_version=3.X.Y-Z" exactly as shown in your own build/desktop environment and hit enter to create an environment variable to be used later.
$ export kernel_version=3.X.Y-Z (我的电脑为$ export kernel_version=3.17.1-armv7-x3)
Copy Root File System
~/
$ sudo tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /media/rootfs/
Create /boot/uEnv.txt
~/
$ sudo mkdir -p /media/rootfs/boot/
$ sudo sh -c "echo 'uname_r=${kernel_version}' > /media/rootfs/boot/uEnv.txt"
Debian /boot/uEnv.txt (enable systemd)
~/
$ sudo sh -c "echo 'cmdline=quiet init=/lib/systemd/systemd' >> /media/rootfs/boot/uEnv.txt"
Copy Kernel Files
Kernel Image:
~/
$ sudo cp -v ./armv7-multiplatform/deploy/${kernel_version}.zImage /media/rootfs/boot/vmlinuz-${kernel_version}
Kernel Device Tree Binaries:
~/
$ sudo mkdir -p /media/rootfs/boot/dtbs/${kernel_version}/
$ sudo tar xfv ./armv7-multiplatform/deploy/${kernel_version}-dtbs.tar.gz -C /media/rootfs/boot/dtbs/${kernel_version}/
Kernel Modules:
~/
$ sudo tar xfv ./armv7-multiplatform/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/
File Systems Table (/etc/fstab)
/etc/fstab
$ sudo sh -c "echo '/dev/mmcblk0p1 / auto errors=remount-ro 0 1' >> /media/rootfs/etc/fstab"
Networking
Edit: /etc/network/interfaces
$ sudo nano /media/rootfs/etc/network/interfaces
Add:
/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
Serial Login
Debian
/etc/inittab
sudo sh -c "echo 'T0:23:respawn:/sbin/getty -L ttymxc0 115200 vt102' >> /media/rootfs/etc/inittab"
Ubuntu
Create new file: /etc/init/serial.conf
sudo nano /media/rootfs/etc/init/serial.conf
With this content:
/etc/init/serial.conf
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
exec /sbin/getty 115200 ttymxc0
Remove microSD/SD card:
sync
sudo umount /media/rootfs
【注:这一步可能提示设备忙】
【解决】
root@pc:/media/rootfs# fuser -km /tmp
root@pc:/media/rootfs# df -lh