全志a13開發板——建立一個可以啟動linux的SD卡

來源:互聯網
上載者:User

標籤:sd卡   a13   

 1  建立工具連 toolchain    

# apt-get install gcc-arm-linux-gnueabihf ncurses-dev uboot-mkimage build-essential git

# Older (prior to 2013): apt-get install gcc-4.6-arm-linux-gnueabi ncurses-dev uboot-mkimage build-essential git


building bootable sd card with debian linux image for a13 olinuxino
Building Uboot# mkdir olinuxino # cd olinuxino
# git clone -b sunxi https://github.com/linux-sunxi/u-boot-sunxi.git
# cd uboot-allwinner/
# make CROSS_COMPILE=arm-linux-gnueabihf- A13-OLinuXino_config
# make CROSS_COMPILE=arm-linux-gnueabihf-
# (Older (prior 2013): make a13_olinuxino CROSS_COMPILE=arm-linux-gnueabi
# ls u-boot.bin spl/sunxi-spl.bin

Building the Kernal    # cd ..
下載核心  這個大概700M左右  時間會有點長的# git clone https://github.com/linux-sunxi/linux-sunxi.git
下載之後進入核心的目錄# cd linux-sunxi/
之後進行相關的配置# make ARCH=arm a13_defconfig
# make ARCH=arm menuconfig

if you want to use GPIOs for instance they are not enabled by default and you can do this by adding:

SUN4I_GPIO_UGLY = y   inside   .config

then you can contiue with:

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage      在這裡需要注意的是標記的地方不能少  否則編譯錯誤

when this finish‘s you will have uImage ready and you can build the kernel modules:

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=out modules

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=out modules_install

Format and setup the SD-card(格式化和設定 SD-card)    首先,我們必須做出正確的卡片分區,這是用fdisk來完成。把SD卡插入讀卡機,並且進入終端,然後根據    命令:ls  /dev/sd    按匹配按鍵,你將會看到sd裝置的列表,比如:sda sdb sdc 你首先要確定哪個裝置是你的sd裝置,可以拔下再插上去來進行區分。一旦你知道了哪個裝置是你的sdCard 假如是sdX    命令: fdisk  -u=sectors /dev/sdX    然後做以下幾個步驟    1 p        列出分區表  如果在你的SD卡中已經存在分區表partitions 你就繼續第二步驟    2 d 1        去刪除它們    3 n p 1        建立第一個分區表,開始2048  結束34815    4  建立第二個分區表        n p 2 enter enter     5 然後列出建立的分區表       p         如果你正確的做了每一件事情,那麼你應該看到下面的資訊:

        Disk /dev/sdX: 2001 MB, 2001731584 bytes
        42 heads, 41 sectors/track, 2270 cylinders, total 3909632 sectors
        Units = sectors of 1 * 512 = 512 bytes
        Sector size (logical/physical): 512 bytes / 512 bytes
        I/O size (minimum/optimal): 512 bytes / 512 bytes
        Disk identifier: 0×00000000

        Device Boot Start End Blocks Id System
        /dev/sdX1 2048 34815 16384 83 Linux
        /dev/sdX2 34816 3909631 1937408 83 Linux

    6 把建立的分區表寫入SD卡中         w        第一個分區應該是vfat  這是被全志的bootloader所能理解的        命令: mkfs .ext3 /dev/sdX1        第二個分區應該是正常的linux EXT3 FS        命令: mkfs .ext3 /dev/sdX2    
根檔案系統 Debian rootfs        linux核心和Uboot已經準備好,現在我們有linux根檔案系統,如何構造一個是一個很長的話題,最好的就是我們有已經預建的我們可以下載的並且可以使用的。    首先退出kernel目錄    命令: cd ..    接著下載debian rootfs    命令: wget http://hands.com/~lkcl/mele_debian_armhf_minimal.cpio.gz    掛載你的sd卡分區表    # mount /dev/sdX2 /mnt     # cd /mnt/    並解壓rootfs (根據具體的目錄而定)

    # gunzip -c /home/user/olinuxino/mele_debian_armhf_minimal.cpio.gz | cpio -i where "user"     is the user name of your root user

    # cd ..

    # sync

    # umount /mnt

    此時 在你sd卡的第二分區上已經有Debian了
Write Uboot and Kernel you build    # mount /dev/sdX1 /mnt/    copy the Kernel uImage to root directory in partition 1    # cp linux-allwinner/arch/arm/boot/uImage /mnt/.    download the script.bin from:     https://github.com/OLIMEX/OLINUXINO/blob/master/SOFTWARE/A13/script.bin
    and copy it to the same directory as uImage
script.bin是一個很重要的文字檔,可以配置一些參數,比如GPIO引腳的分配,記憶體參數,視頻解析度等。通過改變該檔案中的一些參數你可以配置你的linux,並不需要一遍又一遍的重新編譯。       write the Uboot

# cd uboot-allwinner/

# dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8

# dd if=u-boot.bin of=/dev/sdX bs=1024 seek=32

# sync

# umount /mnt

and copy the Kernel modules for partition 2 # mount /dev/sdX2 /mnt

# cd ..

# cp -a linux-allwinner/out/lib/modules/3.0.42+/ /mnt/lib/modules/.

# umount /mnt

那麼現在你有一個已經準備引導debian的sd卡了(Now you have an SD card ready to boot debian on A13-OLinuXino.)

串連USB轉串口或者VGA螢幕,將SD卡插入A13-OLinuXino(-WIFI),並且上電,你應該在終端看到Uboot和之後的核心資訊。預設的使用者名稱字/密碼是:   root/password
Software Links     

Linux Sunxi to build latest Kernel yourself

U-boot to build community U-boot

Building bootable Debian SD card for A13-OLinuXino Original step by step instructions how to make SD card image with above Kernel and U-boot

Forum post with yet another more up to date explanation how to build SD card

全志a13開發板——建立一個可以啟動linux的SD卡

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.