|

楼主 |
发表于 2024-11-28 10:43:20
|
显示全部楼层
从官方网盘下载 CB2 卡启动固件
- 1. 登录 cubie.cc
- 2. 点击上方的“国内下载”
- 3. CubieBoard_Download/Board/CubieBoard2/Cubieboard2-20151211-EMMC-TSD/Image/Ubuntu/Linaro-server-v1.1/
- 4. 下载:linaro-server-cb2-20171113-card-hdmi-V1.1.img.7z
复制代码
将卡启动固件用 dd 命令(Linux)或 win32diskimager (windows)工具写进 SD卡
- 1. Linux工具“dd”命令,要先对 SD卡进行格式化,再使用 dd 命令
- 2. Windows工具“win32”,打开软件识别到 SD卡后,选择下载的固件,直接运行即可
复制代码 Linux
Windows
将SD卡插入PC,把eMMC所需文件放进 SD卡 内
- andy@andy:/work3/test/a20/test$ ll
- total 216784
- drwxrwxr-x 2 andy andy 4096 11月 12 16:12 ./
- drwxrwxr-x 6 andy andy 4096 11月 12 16:10 ../
- -rw-rw-r-- 1 andy andy 355 11月 12 16:10 boot.scr
- -rw-r--r-- 1 andy andy 216382472 11月 12 16:12 chroot-armhf_bullseye_cb2_20241026_142405-install-configure.tar.gz
- -rw-rw-r-- 1 andy andy 25905 11月 12 16:11 sun7i-a20-cubieboard2.dtb
- -rw-rw-r-- 1 andy andy 481431 11月 12 16:11 u-boot-sunxi-with-spl.bin
- -rwxrwxr-x 1 andy andy 5077552 11月 12 16:10 zImage*
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$ mount /dev/sde2 /mnt
- mount: only root can do that
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$ ll
- total 216784
- drwxrwxr-x 2 andy andy 4096 11月 12 16:12 ./
- drwxrwxr-x 6 andy andy 4096 11月 12 16:10 ../
- -rw-rw-r-- 1 andy andy 355 11月 12 16:10 boot.scr
- -rw-r--r-- 1 andy andy 216382472 11月 12 16:12 chroot-armhf_bullseye_cb2_20241026_142405-install-configure.tar.gz
- -rw-rw-r-- 1 andy andy 25905 11月 12 16:11 sun7i-a20-cubieboard2.dtb
- -rw-rw-r-- 1 andy andy 481431 11月 12 16:11 u-boot-sunxi-with-spl.bin
- -rwxrwxr-x 1 andy andy 5077552 11月 12 16:10 zImage*
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$ sudo mount /dev/sde2 /mnt
- andy@andy:/work3/test/a20/test$ sudo mkdir -p /mnt/root/debs/emmc_boot
- andy@andy:/work3/test/a20/test$ sudo cp ./* /mnt/root/debs/emmc_boot/
- andy@andy:/work3/test/a20/test$ ll /mnt/root/debs/emmc_boot
- total 216784
- drwxr-xr-x 2 root root 4096 11月 12 16:15 ./
- drwxrwxr-x 3 root root 4096 11月 12 16:14 ../
- -rw-r--r-- 1 root root 355 11月 12 16:15 boot.scr
- -rw-r--r-- 1 root root 216382472 11月 12 16:15 chroot-armhf_bullseye_cb2_20241026_142405-install-configure.tar.gz
- -rw-r--r-- 1 root root 25905 11月 12 16:15 sun7i-a20-cubieboard2.dtb
- -rw-r--r-- 1 root root 481431 11月 12 16:15 u-boot-sunxi-with-spl.bin
- -rwxr-xr-x 1 root root 5077552 11月 12 16:15 zImage*
- andy@andy:/work3/test/a20/test$
- andy@andy:/work3/test/a20/test$ umount /mnt
- umount: /mnt: umount failed: Operation not permitted
- andy@andy:/work3/test/a20/test$ sudo umount /mnt
- andy@andy:/work3/test/a20/test$
复制代码
将SD卡插入CB2上电启动,对 eMMC 进行分区
- 分清eMMC用的是哪个分区
- 对分区进行验证
- 对 eMMC 进行格式化分区
- root@cubieboard2:~# fdisk -l
- Disk /dev/mmcblk0: 3909 MB, 3909091328 bytes
- 4 heads, 16 sectors/track, 119296 cylinders, total 7634944 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: 0xa888fdf8
- Device Boot Start End Blocks Id System
- /dev/mmcblk0p1 1984 34815 16416 83 Linux
- /dev/mmcblk0p2 34816 7634943 3800064 83 Linux
- Disk /dev/mmcblk0boot1: 2 MB, 2097152 bytes
- 4 heads, 16 sectors/track, 64 cylinders, total 4096 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: 0x00000000
- Disk /dev/mmcblk0boot1 doesn't contain a valid partition table
- Disk /dev/mmcblk0boot0: 2 MB, 2097152 bytes
- 4 heads, 16 sectors/track, 64 cylinders, total 4096 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: 0x00000000
- Disk /dev/mmcblk0boot0 doesn't contain a valid partition table
- Disk /dev/mmcblk1: 8061 MB, 8061452288 bytes
- 4 heads, 16 sectors/track, 246016 cylinders, total 15745024 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: 0x00000000
- Device Boot Start End Blocks Id System
- /dev/mmcblk1p1 2048 26623 12288 83 Linux
- /dev/mmcblk1p2 26624 15745023 7859200 83 Linux
- root@cubieboard2:~#
- root@cubieboard2:~#
复制代码
分区验证,证明 /dev/mmcblk1 为当前 SD卡 的分区,/dev/mmcblk0 为 eMMC 的分区
- root@cubieboard2:~# ls
- debs sata-install.sh
- root@cubieboard2:~# pwd
- /root
- root@cubieboard2:~# touch 123
- root@cubieboard2:~# ls
- 123 debs sata-install.sh
- root@cubieboard2:~# mount /dev/mmcblk1
- mmcblk1 mmcblk1p1 mmcblk1p2
- root@cubieboard2:~# mount /dev/mmcblk1
- mmcblk1 mmcblk1p1 mmcblk1p2
- root@cubieboard2:~# mount /dev/mmcblk1p
- mmcblk1p1 mmcblk1p2
- root@cubieboard2:~# mount /dev/mmcblk1p2 /mnt
- root@cubieboard2:~# cd /mnt
- root@cubieboard2:/mnt# ls
- bin boot dev etc home lib lost+found md5sum.txt media mnt opt proc root run sbin srv sys tmp usr var
- root@cubieboard2:/mnt# cd root/
- root@cubieboard2:/mnt/root# ls
- 123 debs sata-install.sh
- root@cubieboard2:/mnt/root#
- root@cubieboard2:/mnt/root# cd /
- root@cubieboard2:/# umount /mnt
- root@cubieboard2:/#
- root@cubieboard2:/#
复制代码 先对 eMMC 进行清除分区
- root@cubieboard2:~# fdisk /dev/mmcblk0
- Command (m for help): p
- Disk /dev/mmcblk0: 3909 MB, 3909091328 bytes
- 4 heads, 16 sectors/track, 119296 cylinders, total 7634944 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: 0xa888fdf8
- Device Boot Start End Blocks Id System
- /dev/mmcblk0p1 1984 34815 16416 83 Linux
- /dev/mmcblk0p2 34816 7634943 3800064 83 Linux
- Command (m for help): d
- Partition number (1-4): 1
- Command (m for help): p
- Disk /dev/mmcblk0: 3909 MB, 3909091328 bytes
- 4 heads, 16 sectors/track, 119296 cylinders, total 7634944 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: 0xa888fdf8
- Device Boot Start End Blocks Id System
- /dev/mmcblk0p2 34816 7634943 3800064 83 Linux
- Command (m for help): d
- Selected partition 2
- Command (m for help): p
- Disk /dev/mmcblk0: 3909 MB, 3909091328 bytes
- 4 heads, 16 sectors/track, 119296 cylinders, total 7634944 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: 0xa888fdf8
- Device Boot Start End Blocks Id System
- Command (m for help): w
- The partition table has been altered!
- Calling ioctl() to re-read partition table.
- WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
- The kernel still uses the old table. The new table will be used at
- the next reboot or after you run partprobe(8) or kpartx(8)
- Syncing disks.
- root@cubieboard2:~#
复制代码 对 eMMC 进行分区
- root@cubieboard2:~# fdisk /dev/mmcblk0
- Command (m for help): n
- Partition type:
- p primary (0 primary, 0 extended, 4 free)
- e extended
- Select (default p):
- Using default response p
- Partition number (1-4, default 1):
- Using default value 1
- First sector (2048-7634943, default 2048):
- Using default value 2048
- Last sector, +sectors or +size{K,M,G} (2048-7634943, default 7634943): +64M
- Command (m for help): n
- Partition type:
- p primary (1 primary, 0 extended, 3 free)
- e extended
- Select (default p):
- Using default response p
- Partition number (1-4, default 2):
- Using default value 2
- First sector (133120-7634943, default 133120):
- Using default value 133120
- Last sector, +sectors or +size{K,M,G} (133120-7634943, default 7634943):
- Using default value 7634943
- Command (m for help): p
- Disk /dev/mmcblk0: 3909 MB, 3909091328 bytes
- 4 heads, 16 sectors/track, 119296 cylinders, total 7634944 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: 0xa888fdf8
- Device Boot Start End Blocks Id System
- /dev/mmcblk0p1 2048 133119 65536 83 Linux
- /dev/mmcblk0p2 133120 7634943 3750912 83 Linux
- Command (m for help): w
- The partition table has been altered!
- Calling ioctl() to re-read partition table.
- WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
- The kernel still uses the old table. The new table will be used at
- the next reboot or after you run partprobe(8) or kpartx(8)
- Syncing disks.
复制代码
对 eMMC 分区进行格式化
- # 格式化
- sudo mkfs.vfat -I /dev/mmcblk0p1
- sudo mkfs.ext4 /dev/mmcblk0p2
复制代码
把 eMMC 所需文件放进对应的 eMMC 分区内
- # 烧录 SPL (Second Program Loader,可以认为是 uboot 的 bootloader,用来加载完整 uboot 到 SDRAM 中)
- root@cubieboard2:~#
- root@cubieboard2:~# cd debs/emmc_boot/
- root@cubieboard2:~/debs/emmc_boot# ll
- total 216784
- drwxr-xr-x 2 root root 4096 Nov 12 2024 ./
- drwxrwxr-x 3 root root 4096 Nov 12 2024 ../
- -rw-r--r-- 1 root root 355 Nov 12 2024 boot.scr
- -rw-r--r-- 1 root root 216382472 Nov 12 2024 chroot-armhf_bullseye_cb2_20241026_142405-install-configure.tar.gz
- -rw-r--r-- 1 root root 25905 Nov 12 2024 sun7i-a20-cubieboard2.dtb
- -rw-r--r-- 1 root root 481431 Nov 12 2024 u-boot-sunxi-with-spl.bin
- -rwxr-xr-x 1 root root 5077552 Nov 12 2024 zImage*
- root@cubieboard2:~/debs/emmc_boot#
- root@cubieboard2:~/debs/emmc_boot# dd if=./u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8
- 470+1 records in
- 470+1 records out
- 481431 bytes (481 kB) copied, 0.0627928 s, 7.7 MB/s
- root@cubieboard2:~/debs/emmc_boot#
- root@cubieboard2:~/debs/emmc_boot# sync
复制代码
烧录第一分区
- root@cubieboard2:~/debs/emmc_boot#
- root@cubieboard2:~/debs/emmc_boot# mount /dev/mmcblk0p1 /mnt
- root@cubieboard2:~/debs/emmc_boot# cp boot.scr /mnt
- root@cubieboard2:~/debs/emmc_boot# cp sun7i-a20-cubieboard2.dtb /mnt
- root@cubieboard2:~/debs/emmc_boot# cp zImage /mnt/
- root@cubieboard2:~/debs/emmc_boot#
- root@cubieboard2:~/debs/emmc_boot# ls /mnt
- boot.scr sun7i-a20-cubieboard2.dtb zImage
- root@cubieboard2:~/debs/emmc_boot#
- root@cubieboard2:~/debs/emmc_boot# umount /mnt
- root@cubieboard2:~/debs/emmc_boot#
复制代码
烧录第二分区
- mount /dev/mmcblk0p2 /mnt
- cp chroot-armhf_bullseye_cb2_20241026_142405-install-configure.tar.gz /mnt
- cd /mnt
- tar -cvf chroot-armhf_bullseye_cb2_20241026_142405-install-configure.tar.gz
- mv rootfs/* ./ -f
- rm rootfs chroot-armhf_bullseye_cb2_20241026_142405-install-configure.tar.gz lost+found
- cd /
- sync
- umount /dev/mmcblk0p2
复制代码
注意:此时可以输入 poweroff,将 SD卡拔出,重新上电后能看到如下打印,那么恭喜你启动成功了
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x
|