|
修改论坛一贴出现的bug(其实就一bootargs的设置,呵~~)
大体步骤
1:First step you need to do
2:build Kernel
3:build U-boot
4:build script.bin
5:build rootfs
6:burn and run
1: First step you need to do
sudo fdisk /dev/sdb #WARNING
p
d
#ENTER
d
#ENTER (try d+ENTER until it says “No partition is defined yet!”)
w //Add by zsm
n
p
1
2048
+100M
n
p
2
#ENTER
#ENTER
w // 保存分区
查看是否分好区 : fdisk /dev/sdb -l
ext4格式格式化分区2 : sudo mkfs.ext4 /dev/sdb2//等下格式化
指定分区类型 : fdisk /dev/sdb -l ,t, 1,c(vFat),w保存
2: build Kernel
下载kernel : sudo git clone https://github.com/cubieboard2/linux-sunxi
sudo apt-get install build-essential u-boot-tools uboot-mkimage gcc-arm-linux-gnueabihf ncurses-dev -y
//sudo apt-get install build-essential u-boot-tools uboot-mkimage gcc-arm-linux-gnueabihf libncurses5-dev -y
cd linux-sunxi
make sun7i_defconfig ARCH=arm // cb2配置项
sudo make menuconfig ARCH=arm
Select “General setup” → “Cross-compliter tool prefix” and write “arm-linux-gnueabihf-”
sudo make uImage CROSS_COMPILE=arm-linux-gnueabihf- -j2 ARCH=arm
3: #build U-boot
sudo git clone https://github.com/linux-sunxi/u-boot-sunxi -b wip/a20
cd u-boot-sunxi
sudo make cubieboard2 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
sudo dd if=spl/sunxi-spl.bin of=/dev/sdb bs=1024 seek=8
sudo dd if=u-boot.bin of=/dev/sdb bs=1024 seek=32
或者如果uboot根目录下有 u-boot-sunxi-with-spl.bin
sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/sdb bs=1024 seek=8
sudo mkfs.vfat /dev/sdb1
4: #Build script.bin
sudo apt-get install libusb-1.0-0-dev libusb-dev -y //下载所需的库
sudo git clone https://github.com/linux-sunxi/sunxi-boards// 下载sunxi-boards
sudo git clone https://github.com/linux-sunxi/sunxi-tools // 下载sunxi-tools
cd sunxi-tools
sudo make
sudo mount /dev/sdb1 /opt
sudo ./fex2bin ../sunxi-boards/sys_config/a20/cubieboard2.fex /opt/script.bin
cd ..
5: #Build rootfs:BusyOS
sudo wget http://busybox.net/downloads/busybox-1.21.1.tar.bz2
sudo tar jxvf busybox-1.21.1.tar.bz2
cd busybox-1.21.1
sudo make menuconfig ARCH=arm
set busybox settings → build option → Cross Compiler prefix to “arm-linux-gnueabihf-”
sudo make
sudo make install
sudo mount /dev/sdb2 /mnt
sudo cp -Rv _install/* /mnt
sudo cp -Rv examples/bootfloppy/etc /mnt
cd /mnt
sudo mkdir dev proc sys var home tmp mnt run boot boot2 dev/pts
sudo rm etc/fstab
sudo vi etc/fstab
加入:
proc /proc proc nosuid,noexec,nodev 0 0
sysfs /sys sysfs nosuid,noexec,nodev 0 0
devpts /dev/pts devpts gid=4,mode=620 0 0
tmpfs /tmp tmpfs defaults 0 0
devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
/dev/mmcblk0p1 /boot2 vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
保存退出
sudo chmod 777 etc/fstab
6: #Burn and run
sudo vi /opt/boot.cmd
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 init=/sbin/init rootwait panic=10 ${extra}
fatload mmc 0 0x43000000 script.bin
fatload mmc 0 0x48000000 uImage
bootm 0x48000000
cd /opt
sudo mkimage -C none -A arm -T script -d boot.cmd boot.scr
sudo cp /work/cb_prj/src/linux-sunxi/arch/arm/boot/uImage /opt
cd /mnt
sudo mkdir lib
sudo cp /usr/arm-linux-gnueabihf/lib/*so* -d /mnt/lib
cd ../..
sudo umount /mnt /opt
setenv bootargs console=ttyS0,115200 root=/dev/mmcblk0p2 rootwait panic=10 ${extra}
save
reset
|
|