DF723(FT2000+) DF716(FT2000/4)基于grub2.05、openEuler 20.03内核、busybox1.32.1源码制作最小系统U盘
settings->Build Options选中Build staitc binary。格式化U盘,一个vfat小分区用于efi,一个ext4大分区用于存放根文件系统。双击Esc按键退回到主菜单,再次双击,保存退出。重新执行grub-install覆盖安装。登录查看详细信息(登录密码参考。劣质3.1U盘,更换U盘。解压busybox源码。编译grub2.06。安装grub到usb。
·
麒麟桌面系统V10 grub编译+安装到USB 参考(efi独立分区)
格式化U盘,一个vfat小分区用于efi,一个ext4大分区用于存放根文件系统
yeqiang@yeqiang-PC:/media/yeqiang$ sudo fdisk /dev/sdb
Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (1-4, default 1):
First sector (2048-15730687, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15730687, default 15730687): +200M
Created a new partition 1 of type 'Linux' and of size 200 MiB.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p):
Using default response p.
Partition number (2-4, default 2):
First sector (411648-15730687, default 411648):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (411648-15730687, default 15730687):
Created a new partition 2 of type 'Linux' and of size 7.3 GiB.
Command (m for help): p
Disk /dev/sdb: 7.5 GiB, 8054112256 bytes, 15730688 sectors
Disk model: USB DISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8654fae2
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 411647 409600 200M 83 Linux
/dev/sdb2 411648 15730687 15319040 7.3G 83 Linux
Filesystem/RAID signature on partition 1 will be wiped.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
yeqiang@yeqiang-PC:/media/yeqiang$ sudo mkfs.vfat /dev/sdb1
mkfs.fat 4.1 (2017-01-24)
yeqiang@yeqiang-PC:/media/yeqiang$ sudo mkfs.ext4 /dev/sdb2
mke2fs 1.44.5 (15-Dec-2018)
Creating filesystem with 1914880 4k blocks and 479552 inodes
Filesystem UUID: 44183bbd-95aa-4c08-875d-628bedb72d15
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632
Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
编译grub2.06
sudo apt install -y bison flex
./configure --prefix=/usr/local
make -j4
sudo make install
安装grub到usb
sudo apt install -y efibootmgr
sudo mkdir /mnt/efi
sudo mount /dev/sdb1 /mnt/efi
sudo mkdir /mnt/efi/boot
sudo /usr/local/sbin/grub-install --efi-directory=/mnt/efi --boot-directory=/mnt/efi/boot /dev/sdb --removable
内核编译参考
https://blog.csdn.net/hknaruto/article/details/129360777?spm=1001.2014.3001.5501
busybox做sysroot根文件系统
编译busybox
wget https://busybox.net/downloads/busybox-1.32.1.tar.bz2
安装依赖工具
yum install -y tar ncurses-devel
解压busybox源码
tar -xvf busybox-1.32.1.tar.bz2
生成配置文件
make menuconfig
settings->Build Options选中Build staitc binary
双击Esc按键退回到主菜单,再次双击,保存退出
编译
make -j64
查看编译输出
生成系统目录
make install
生成sysroot
#!/bin/bash
set -x
workdir=$(pwd)
mkdir sysroot
rsync -avr -P res/* sysroot/
rsync -av -P src/linux-4.19.90-2112.8.0.0131.oe1.aarch64/arch/arm64/boot/Image.gz sysroot/boot/vmlinuz-4.19.90
rsync -av -P src/linux-4.19.90-2112.8.0.0131.oe1.aarch64/System.map sysroot/boot/System.map-4.19.90
rsync -av -P src/linux-4.19.90-2112.8.0.0131.oe1.aarch64/initramfs-4.19.90.img sysroot/boot/initramfs-4.19.90.img
rsync -avr src/busybox-1.32.1/_install/* sysroot/
(
cd sysroot
mkdir home mnt opt var media -p
mkdir proc sys dev run -p
(
cd dev
mknod console c 5 1
mknod null c 1 3
)
ln -svf bin/busybox init
ln -svf usr/lib lib
ln -svf usr/lib64 lib64
)
文件同步到U盘
rsync -avr --delete -P sysroot/* /media/yeqiang/c788260c-05f3-48e6-a9b6-23c9f2375cfa/
cp -f res/boot/efi/boot/grub/grub.cfg /media/yeqiang/2ACD-883D/boot/grub/grub.cfg
sync
启动验证(DF716 FT2000/4)
完整的源码及编译脚本
https://gitee.com/hknarutofk/myarm64os
故障处理
U盘读写后不能引导了
重新执行grub-install覆盖安装
U盘引导时好时坏
劣质3.1U盘,更换U盘
[FAILED] Failed to start Switch Root.
登录查看详细信息(登录密码参考https://blog.csdn.net/hknaruto/article/details/129399710)
更多推荐
已为社区贡献46条内容
所有评论(0)