grub, hdt: Add hdt support for grub-pc (memdisk + floppy image)

Note: syslinux --install needed /proc, so:
@$(call set,GLOBAL_HSH_PROC,1)

See-also: mkimage/doc/README.ru
This commit is contained in:
Anton Midyukov 2021-04-22 18:44:52 +07:00
parent 09d751fcc0
commit 2b6c37afcd
3 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,6 @@
if [ "$grub_platform" = "pc" ]; then
menuentry "Hardware Info" {
linux16 /boot/memdisk
initrd16 /boot/hdt.img
}
fi

View File

@ -1,9 +1,12 @@
# optimized out use/syslinux due to use/memtest
ifeq (,$(filter-out i586 x86_64,$(ARCH)))
use/hdt: use/memtest
use/hdt: use/syslinux use/memtest
@$(call add_feature)
@$(call add,STAGE1_PACKAGES,pciids)
@$(call add,STAGE1_PACKAGES,dosfstools)
@$(call add,SYSLINUX_MODULES,hdt)
@$(call add,GRUB_CFG,hdt_bios)
@$(call set,GLOBAL_HSH_PROC,1)
else
use/hdt: ; @:
endif

View File

@ -0,0 +1,27 @@
#!/bin/sh -efu
[ "$GLOBAL_BOOTLOADER" = grubpcboot ] || exit 0
cd "$WORKDIR"
mkdir -p boot syslinux
cp /usr/lib/syslinux/hdt.c32 "$WORKDIR"/syslinux/
cat > syslinux/syslinux.cfg << EOF
default hdt
label hdt
menu label ^Hardware info
com32 hdt.c32
append quiet
EOF
# floppy disk 720 KiB
dd if=/dev/zero of=boot/hdt.img bs=512 count="1440"
mkfs.fat -n HDT -F 12 boot/hdt.img
mcopy -i boot/hdt.img -s syslinux ::
#dd if=/usr/lib/syslinux/ldlinux.bss of=boot/hdt.img conv=notrunc
syslinux -d /syslinux --install boot/hdt.img
rm -r syslinux
cp /usr/lib/syslinux/memdisk boot