Support for MEMDISK

The .iso can now be booted using Grub (memdisk from Syslinux package):

	linux16 /memdisk
	initrd16 /path/to/iso

As well as from Syslinux:

	LINUX memdisk
	INITRD path/to/iso
This commit is contained in:
Christian Neukirchen 2015-05-02 01:01:17 +02:00 committed by Juan RP
parent 1571ef8d44
commit 929175a025
5 changed files with 43 additions and 1 deletions

8
dracut/59-mtd.rules Normal file
View File

@ -0,0 +1,8 @@
SUBSYSTEM!="block", GOTO="ps_end"
ACTION!="add|change", GOTO="ps_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="ps_end"
KERNEL=="mtdblock[0-9]*", IMPORT BLKID
LABEL="ps_end"

20
dracut/61-mtd.rules Normal file
View File

@ -0,0 +1,20 @@
SUBSYSTEM!="block", GOTO="pss_end"
ACTION!="add|change", GOTO="pss_end"
# Also don't process disks that are slated to be a multipath device
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="pss_end"
ACTION=="change", KERNEL=="dm-[0-9]*", ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}!="1", GOTO="do_pss"
KERNEL=="mtdblock*", GOTO="do_pss"
GOTO="pss_end"
LABEL="do_pss"
# by-path (parent device path)
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="", DEVPATH!="*/virtual/*", IMPORT PATH_ID
ENV{DEVTYPE}=="disk", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}"
ENV{DEVTYPE}=="partition", ENV{ID_PATH}=="?*", SYMLINK+="disk/by-path/$env{ID_PATH}-part%n"
# by-label/by-uuid links (filesystem metadata)
ENV{ID_FS_USAGE}=="filesystem|other|crypto", ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-uuid/$env{ID_FS_UUID_ENC}"
ENV{ID_FS_USAGE}=="filesystem|other", ENV{ID_FS_LABEL_ENC}=="?*", SYMLINK+="disk/by-label/$env{ID_FS_LABEL_ENC}"
LABEL="pss_end"

View File

@ -14,6 +14,13 @@ install() {
inst /usr/bin/chroot
inst /usr/bin/chmod
inst /usr/bin/sed
inst /usr/bin/memdiskfind
instmods mtdblock phram
inst_rules "$moddir/59-mtd.rules" "$moddir/61-mtd.rules"
prepare_udev_rules 59-mtd.rules 61-mtd.rules
inst_hook pre-udev 01 "$moddir/mtd.sh"
inst_hook pre-pivot 01 "$moddir/adduser.sh"
inst_hook pre-pivot 02 "$moddir/display-manager-autologin.sh"
inst_hook pre-pivot 03 "$moddir/copy-initramfs.sh"

7
dracut/mtd.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
MEMDISK=$(memdiskfind)
if [ "$MEMDISK" ]; then
modprobe phram phram=memdisk,$MEMDISK
modprobe mtdblock
printf 'KERNEL=="mtdblock0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root /dev/mtdblock0"\n' >> /etc/udev/rules.d/99-live-squash.rules
fi

View File

@ -82,7 +82,7 @@ copy_void_conf() {
copy_dracut_files() {
mkdir -p $1/usr/lib/dracut/modules.d/01vmklive
cp dracut/*.sh $1/usr/lib/dracut/modules.d/01vmklive/
cp dracut/* $1/usr/lib/dracut/modules.d/01vmklive/
}
install_prereqs() {