{D89D8038-4057-40B6-A14F-A01C1B3C4A87}_20191219171033.jpg

配置环境 ubuntu 18.04

  1. SD 分区
        Ubuntu 打开 GParted 分区工具f7e3a4a8-e395-4a50-85b8-e30182ac3b69.jpg,分成三区如下:

d0739213-f1b4-47fb-9024-6f3db361beca.png

  1. 写入 U-boot
        编译 u-boot-2019.10
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- LicheePi_Zero_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

生成 u-boot-sunxi-with-spl.bin,写入 SD 分区表空白处,注意设置正确的SD卡设备路径, 例如 /dev/sdb

sudo dd if=u-boot-sunxi-with-spl.bin of=/dev/<sdx> bs=1024 seek=8
  1. 解压 alpine-uboot-3.10.3-armv7.tar.gz 至 boot 分区
sudo tar xvzf alpine-uboot-3.10.3-armv7.tar.gz -C /media/<user>/<mount path>
  1. 解压 alpine-minirootfs-3.10.3-armv7.tar.gz 至 ‘Alpine Linux’ 分区
sudo tar xvzf alpine-minirootfs-3.10.3-armv7.tar.gz -C /media/<user>/<mount path>

修改 "Alpine Linux" 分区目录下 /etc/inittab,使能 getty tty0, 并添加自动登录脚本

cd /media/<user>/<mount path>
sudo vi inittab
# /etc/inittab
::sysinit:/sbin/openrc sysinit
::sysinit:/sbin/openrc boot
::wait:/sbin/openrc default
# Set up a couple of getty's
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
tty3::respawn:/sbin/getty 38400 tty3
tty4::respawn:/sbin/getty 38400 tty4
tty5::respawn:/sbin/getty 38400 tty5
tty6::respawn:/sbin/getty 38400 tty6
# Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100 -n -l /etc/autologin -I "console auto login as root..."
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/sbin/openrc shutdown

添加 /etc/autologin,

cd /media/<user>/<mount path>
sudo vi autologin
sudo chmod +x autologin
#!/bin/sh
exec /bin/login -f root

5. 写入 buildroot 编译的 rootfs, 输出目录  outputimages,rootfs.tar。buildroot 编译参考  “xxxx”
“boot.scr” 文件信息

setenv bootargs console=ttyS0,115200 panic=5 console=tty0 rootwait root=/dev/mmcblk0p2 earlyprintk rw
load mmc 0:1 0x41000000 zImage
load mmc 0:1 0x41800000 sun8i-v3s-licheepi-zero-dock.dtb
bootz 0x41000000 - 0x41800000
sudo tar xvf buildroot_rootfs.tar -C /media/<user>/<mount path>
  1. 拷贝编译好的 zImage 到 boot 目录下
  2. 移除 extlinux
  3. 修改 boot/grup/grub.cfg, 添加启动项菜单:
  4. timeout=3

menuentry "Linux vanilla" {
linux /boot/vmlinuz-vanilla modules=loop,squashfs,sd-mod,usb-storage quiet
initrd /boot/initramfs-vanilla
}
menuentry "Busybox" {
linux /boot/zImage console=ttyS0,115200 panic=5 console=tty0 rootwait root=/dev/mmcblk0p2 earlyprintk rw
}
menuentry "Alpine Linux" {
linux /boot/zImage console=ttyS0,115200 panic=5 console=tty0 rootwait root=/dev/mmcblk0p3 earlyprintk rw
}

标签: none

添加新评论