如果你是根據 http://blog.blackwhite.tw/2014/01/cubie-truck-sd.html 這篇文章建立 lubuntu 的作業系統的話,你會發現他預設並沒有編譯 bonding 模組。因此如果我們想要使用 bonding 的話,必須自己編譯 kernel。
編譯 kernel 是一件很麻煩的事。不過有人幫我們簡化了很多步驟了。https://github.com/davidandreoletti/cubietruck 這裡已經有人提供腳本幫我們完成 cross compile。不過你需要注意的是你要使用 Ubuntu 12.04 或是 arm-linux-gnueabihf-gcc 4.6.3 版本。不然可能會編譯失敗。我在 mint 16 (with arm-linux-gnueabihf-gcc 4.8.1 版本會編譯失敗。
編譯完後,他會在 output 的資料夾產生很多檔案。你需要把 uImage 複製到你 sd 卡裡的 bootfs,覆蓋他。然後在複製 output/lib 裏面的內容到 sd 卡裡的 rootfs 的 lib 資料夾裡。etc 資料夾也一樣。複製完後,記得去改 sd 卡裡的 /etc/network/interface。他有寫好 bonding 的設定,記得去修改相關設定。
2014年1月20日 星期一
2014年1月13日 星期一
編譯核心給 s3c2440 出現 error: ‘__LINUX_ARM_ARCH__’ undeclared (first use in this function)
編譯核心給 s3c2440 出現error: ‘__LINUX_ARM_ARCH__’ undeclared (first use in this function) 解法
把 System Type -> S3C2440 Machines 裡面的東西全選
mini2440 buildroot
http://buildroot-busybox.2317881.n4.nabble.com/build-of-e2fsprogs-fails-2012-02-rc3-td1597.html
把 System Type -> S3C2440 Machines 裡面的東西全選
mini2440 buildroot
http://buildroot-busybox.2317881.n4.nabble.com/build-of-e2fsprogs-fails-2012-02-rc3-td1597.html
2014年1月5日 星期日
cross compile python for arm
這裡是編譯 Python 3.3.3 的方法
1. 建立 config.site,檔案內容如下
參考資料:
http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
http://bugs.python.org/msg136962
1. 建立 config.site,檔案內容如下
ac_cv_file__dev_ptmx=no
ac_cv_file__dev_ptc=no
2. 在 python 3.3.3 的目錄下依序輸入以下指令。cross compiler 的相關變數你改成你系統的。
CONFIG_SITE=config.site CC=arm-linux-gcc CXX=arm-linux-g++ AR=arm-linux-ar RANLIB=arm-linux-ranlib ./configure --host=arm-linux --build=x86_64-linux-gnu --prefix=/python LDFLAGS="-static -static-libgcc" CPPFLAGS="-static -march=armv4t" --disable-ipv6
make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen BLDSHARED="arm-linux-gcc -static" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes HOSTARCH=arm-linux BUILDARCH=x86_64-linux-gnu
make install HOSTPYTHON=./hostpython BLDSHARED="arm-linux-gcc -static" CROSS_COMPILE=arm-linux- CROSS_COMPILE_TARGET=yes prefix=~/mypython
參考資料:
http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html
http://bugs.python.org/msg136962
2014年1月4日 星期六
讓 cubie truck 從 sd 卡開機
這裡只是簡單的描述,細節請看 http://docs.cubieboard.org/zh/tutorials/ct1/installation/install_lubuntu_desktop_server_to_sd_card#make_bootable_sd_card
- 下載 u-boot,bootfs,rootfs
- 清除 sd 卡
- sudo dd if=/dev/zero of=${card} bs=1024 seek=544 count=128
- 把 u-boot 寫進 sd 卡。
- sudo dd if=u-boot-sunxi-with-spl-ct-20131102.bin of=$card bs=1024 seek=8
- 再做磁碟分割,bootfs(第一個磁區) 要 ext2,第二個磁區要 ext4,像這樣(sdd 會隨每個電腦環境不同而有所不同)
Device Boot Start End Blocks Id System /dev/sdd1 2048 133119 65536 83 Linux /dev/sdd2 133120 15278079 7572480 83 Linux
- 建立檔案系統並把 bootfs 和rootfs 寫進你剛剛新建的磁區
$mkdir /tmp/sdd1 /tmp/sdd2 $sudo mount -t ext2 ${card}1 /tmp/sdd1 $sudo mount -t ext4 ${card}2 /tmp/sdd2 $sudo tar -C /tmp/sdd1 -xvf bootfs-part1.tar.gz $sudo tar -C /tmp/sdd2 -xvf rootfs-part2.tar.gz $sync $sudo umount /tmp/sdd1 $sudo umount /tmp/sdd2
2014年1月1日 星期三
在 qemu 底下模擬 Raspberry Pi
1. 安裝 qemu-system-arm
2. 下載 http://xecdesign.com/downloads/linux-qemu/kernel-qemu
3. 執行下面程式碼
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" -hda 2013-09-25-wheezy-raspbian.img
重點就那個 kernel image 和 qemu 的參數,詳情請看參考連結。
參考連結:
http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
2013年12月31日 星期二
arm cross compile 常用指令備忘
製作 initramfs image
find . | cpio -H newc -o | gzip -9 > /boot/initrd.img
或是
find . | cpio -H newc -o > rootfs
解壓縮 initramfs image
gunzip -c /boot/initrd.img-2.6.24-19-generic | cpio -i
修改 initrd image
mount -t ext2 -o loop initrd.img temp/
編譯 arm 核心,arm-linux-gnueabi-請換成你用 cross_compiler
make ARCH=arm versatile_defconfigmake ARCH=arm menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- all
編譯完後,核心路徑在 arch/arm/boot
qemu-system-arm -M versatilepb -m 128M -kernel zImage -no-reboot
#include <stdio.h>
intmain() {printf("Hello World!\n");while(1);}
編譯第一支程式
arm-linux-gnueabi-gcc -static test.c -o test製作 rootfs
echo test | cpio -o --format=newc > rootfs執行第一支程式
qemu-system-arm -M versatilepb -m 128M -kernel zImage -initrd rootfs -append "root=/dev/ram rdinit=/test" -no-reboot啟動核心後,核心會執行你的程式。
其他:如果你要測試編譯出來的程式,也可以直接用下面指令。
qemu-arm -L /usr/arm-linux-gnueabi/ a.out
參考資料
http://backreference.org/2010/07/04/modifying-initrdinitramfs-files/
http://balau82.wordpress.com/2010/03/22/compiling-linux-kernel-for-qemu-arm-emulator/
訂閱:
文章 (Atom)