From 2b6c37afcd8e7827078f53a5610a906dfbc91cc9 Mon Sep 17 00:00:00 2001 From: Anton Midyukov Date: Thu, 22 Apr 2021 18:44:52 +0700 Subject: [PATCH] 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 --- features.in/grub/cfg.in/90hdt_bios.cfg | 6 +++++ features.in/hdt/config.mk | 5 +++- features.in/hdt/stage1/scripts.d/10-hdt-img | 27 +++++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 features.in/grub/cfg.in/90hdt_bios.cfg create mode 100755 features.in/hdt/stage1/scripts.d/10-hdt-img diff --git a/features.in/grub/cfg.in/90hdt_bios.cfg b/features.in/grub/cfg.in/90hdt_bios.cfg new file mode 100644 index 00000000..e78474c4 --- /dev/null +++ b/features.in/grub/cfg.in/90hdt_bios.cfg @@ -0,0 +1,6 @@ +if [ "$grub_platform" = "pc" ]; then + menuentry "Hardware Info" { + linux16 /boot/memdisk + initrd16 /boot/hdt.img + } +fi diff --git a/features.in/hdt/config.mk b/features.in/hdt/config.mk index 1969eb02..be05678c 100644 --- a/features.in/hdt/config.mk +++ b/features.in/hdt/config.mk @@ -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 diff --git a/features.in/hdt/stage1/scripts.d/10-hdt-img b/features.in/hdt/stage1/scripts.d/10-hdt-img new file mode 100755 index 00000000..c4343649 --- /dev/null +++ b/features.in/hdt/stage1/scripts.d/10-hdt-img @@ -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