menuentry 'Arch Linux Btrfs' {
load_video
set gfxpayload=keep
insmod gzio
#insmod zlib
insmod btrfs
#set root='hd1'
set btrfs_rootfs=arch64_rootfs
set root_label=arch64
search --label --no-floppy --set=root $root_label
linux /$btrfs_rootfs/boot/vmlinuz-linux root=/dev/disk/by-label/$root_label ro rootfstype=btrfs rootflags=subvol=$btrfs_rootfs,compress=lzo,space_cache,autodefrag rootwait init=/usr/lib/systemd/systemd
initrd /$btrfs_rootfs/boot/initramfs-linux.img
#linux /boot/vmlinuz-linux root=/dev/disk/by-label/$root_label rw rootfstype=btrfs rootflags=subvol=$btrfs_rootfs rootwait init=/usr/lib/systemd/systemd
#initrd /boot/initramfs-linux.img
}
parted -a optimal -s ${DISC} mkpart 1 1 ${GUID_PART_SIZE} >${LOG}
parted -a optimal -s ${DISC} set 1 bios_grub on 脚本自动设置指定分区为bios_grub
ip link set enp2s0f0 up
ip addr add 192.168.1.2/24 dev enp2s0f0
ip route add default via IP地址
nano /etc/modules-load.d/virtio-net.conf
# Load 'virtio-net.ko' at boot.
在第一扇区选择 New (或者按 N) – Enter – Enter 以使用全部剩余空间(或者您也可以输入确定的大小,比如 "30G") – Enter 以保持默认的十六进制码 (8300) –
UEFI boot. It should be marked as EF00 or ef00 type code in gdisk,
Create a FAT32 partition and in GNU Parted set/activate the boot flag (not legacy_boot flag) on that partition
Note: If you get the message WARNING: Not enough clusters for a 32 bit FAT!, reduce cluster size with mkfs.fat -s2 -F32 ... or -s1, otherwise the partition may be unreadable by UEFI.
Shell代码
GUID Partition Table aka GPT
Main article GUID_Partition_Table
Bit 2 of the attributes for the /boot partition need to be set.
# sgdisk /dev/sda --attributes=1:set:2
This would toggle the attribute legacy bios bootable on partition 1