:: Re: [DNG] udev rule to create mount…
Góra strony
Delete this message
Reply to this message
Autor: aitor
Data:  
Dla: dng
Temat: Re: [DNG] udev rule to create mount point /dev/hugepages
Hi Adrian,

On 8/7/22 15:40, Adrian Zaugg wrote:
> But I'm failing to write a (e)udev rule, that does the following:
>
>     if the directory /sys/kernel/mm/hugepages exists,
>     create the directory /dev/hugepages

>
> Thank you very much for your help!


Add a new script named, for example, `/usr/share/initramfs-tools/scripts/init-bottom/zz-hugepage`
with the following code:

#!/bin/sh -e

PREREQS=""

prereqs() { echo "$PREREQS"; }

case "$1" in
    prereqs)
    prereqs
    exit 0
    ;;
esac

if [ -d /sys/kernel/mm/hugepages ]; then
    /bin/mkdir ${rootmnt}/dev/hugepages
fi

I'm adding the prefix 'zz' to the name of the script because the scripts are found in lexical order,
and the temporary symlink `${rootmnt}/dev` to the final `/dev` for other initramfs scripts is created
in `/usr/share/initramfs-tools/scripts/init-bottom/udev`.

HTH,

Aitor.