Ubuntu 12.04.5 LTS arm-linux-gnueabihf-gcc-4.6 arm-linux-gnueabihf-g++-4.6 arm-linux-gnueabihf-cpp-4.6安裝編譯所需之函式庫與程式:
$ sudo apt-get update $ sudo apt-get upgrade $ sudo apt-get install ia32-libs $ sudo apt-get install ncurses-dev $ sudo apt-get install build-essential git u-boot-tools $ sudo apt-get install texinfo texlive ccache zlib1g-dev gawk bison flex gettext uuid-dev $ sudo apt-get install build-essential u-boot-tools uboot-mkimage $ sudo apt-get install binutils-arm-linux-gnueabihf gcc-arm-linux-gnueabi $ sudo apt-get install gcc-arm-linux-gnueabihf cpp-arm-linux-gnueabihf $ sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev $ sudo apt-get install git wget fakeroot kernel-package zlib1g-dev libncurses5-dev
加入 fex2bin bin2fex 工具:
$ git clone https://github.com/cubieboard/sunxi-tools $ cd sunxi-tools $ make $ sudo cp fex2bin bin2fex /usr/bin建立編譯工作環境:
$ cd ~ $ mkdir linux-sdk-card $ cd linux-sdk-card< Kernel Source >:
$ git clone https://github.com/cubieboard/linux-sdk-kernel-source.git $ mv linux-sdk-kernel-source linux-sunxi< Tools >:
$ git clone https://github.com/cubieboard/linux-sdk-card-tools.git $ mv linux-sdk-card-tools tools< Products >:
$ git clone https://github.com/cubieboard/linux-sdk-card-products.git $ mv linux-sdk-card-products products< Rootfs & U-boot >:
$ git clone https://github.com/cubieboard/linux-sdk-binaries.git $ mv linux-sdk-binaries binaries從下方網站下載 Rootfs & U-boot 檔案至剛剛建立的 binaries 資料夾中:
http://dl.cubieboard.org/model/commom/linux-sdk-binaries< List >:
u-boot-a20.tar.gz #Cubieboard a20 u-boot 需解壓縮 u-boot-v10.tar.gz #Cubieboard a10 u-boot 需解壓縮 cubieez-lxde-20140916.tar.gz #Cubieboard 1/2 Cubieez-rootfs 不需解壓縮 cubieez-ct-20140916.tar.gz #Cubietruck Cubieez-rootfs 不需解壓縮開始編譯:
$ cd ~/linux-sdk-card $ source tools/scripts/envsetup.sh進行環境設定如下所示:
Products 0 - cb 1 - cb2 2 - ct please select a board:0 #由於作者的版子是Cubieboard 1 所以在這邊選擇 0 - cb 0 - cb-cubieez 1 - cb-cubieez-cs 2 - cb-debian-server please select a system:0 #我們想編譯的 OS 為 Cubieez 所以選擇 0 - cb-cubieez Creating working dirs選擇完設定後會出現下面訊息:
Build sdcard image: 1. tf card boot (1)cb_build_card_image (compile code to prepare cb_install_tfcard) (2)cb_install_tfcard storage_medium dev_label [pack] storage_medium:nand tsd tfx2 dev_label: sdb sdc sdd ... pack: the parameter mean we will make a img for dd or win32writer cmd for example:cb_install_tfcard tsd sdb 2. tsd or nand card boot (1)cb_build_flash_card_image(compile code to prepare cb_install_flash_card) (2)cb_install_flash_card storage_medium dev_label [pack] (install TF card to flash img to tsd/emmc sdx is your sdcard label pc) storage_medium:nand tsd (tfx2 do not need this mode) dev_label: sdb sdc sdd ... pack: the parameter mean we will make a img for dd or win32writer cmd for example:cb_install_flash_card tsd sdb接下來也可以按照個人需求,自行編譯核心模組:
$ cd linux-sunxi/ $ cp ../products/cb/cb-cubieez/kernel_defconfig .config $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig選擇完之後儲存離開 menuconfig ,並且把 .config 丟回去剛剛 cp 過來的地方覆蓋kernel_defconfig,指令如下:
$ cp .config ../products/cb/cb-cubieez/kernel_defconfig $ make mrproper $ cd ../mrproper 是將編譯核心環境重置,不然等等在跑編譯程式會出現 error
開始編譯 image 前先編輯一下編譯的 script 檔:
$ vim tools/scripts/boardenvsetup.sh將 cb_build_linux() 還有 cb_build_card_image() 中的 -jX 改成自己的核心數以加快編譯速度
開始編譯,指令如下:
$ pwd /home/icewnful/linux-sdk-card $ cb_build_card_image編譯完後會再次出現下面訊息:
Build sdcard image: 1. tf card boot (1)cb_build_card_image (compile code to prepare cb_install_tfcard) (2)cb_install_tfcard storage_medium dev_label [pack] storage_medium:nand tsd tfx2 dev_label: sdb sdc sdd ... pack: the parameter mean we will make a img for dd or win32writer cmd for example:cb_install_tfcard tsd sdb 2. tsd or nand card boot (1)cb_build_flash_card_image(compile code to prepare cb_install_flash_card) (2)cb_install_flash_card storage_medium dev_label [pack] (install TF card to flash img to tsd/emmc sdx is your sdcard label pc) storage_medium:nand tsd (tfx2 do not need this mode) dev_label: sdb sdc sdd ... pack: the parameter mean we will make a img for dd or win32writer cmd for example:cb_install_flash_card tsd sdb在安裝 image 之前,要先把要當作Cubieboard 系統碟的 SD 卡插入電腦,然後 dmesg 確定為 sdx 開始安裝 image 至 SD 卡中,指令如下:
$ cb_install_flash_card nand sdx packpack 參數是為了讓它除了安裝進 SD 卡以外,也將 image 的內容 pack 成 .img 檔案,
以便我們要將系統轉移至別張 SD 卡中
最後就是就是把做好的SD卡放入Cubieboard中測試了!!
沒有留言:
張貼留言