Initramfs: Difference between revisions
From Lolly's Wiki
Jump to navigationJump to search
(Created page with "=Adding binaries to the initial ram disk in ubuntu= == Adding vi to initramfs == <SyntaxHighlight lang=bash> $ sudo cat >/etc/initramfs-tools/hooks/vi <<EOH #!/bin/sh PREREQ="" prereqs() { echo "$PREREQ" } case $1 in prereqs) prereqs exit 0 ;; esac . /usr/share/initramfs-tools/hook-functions # Begin real processing below this line copy_exec /usr/bin/vim.basic /bin exit 0 EOH $ sudo update-initramfs -k $(uname -r) -u </SyntaxHighlight>") |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
=Adding binaries to the initial ram disk in | [[Category:Bootprocess]] | ||
=Adding binaries to the initial ram disk in Ubuntu= | |||
See manual page for initramfs-tools for this, too. | |||
== Adding vi to initramfs == | == Adding vi to initramfs == | ||
<SyntaxHighlight lang=bash> | <SyntaxHighlight lang=bash> | ||
$ sudo apt --yes install vim | |||
$ sudo cat >/etc/initramfs-tools/hooks/vi <<EOH | $ sudo cat >/etc/initramfs-tools/hooks/vi <<EOH | ||
#!/bin/sh | #!/bin/sh -e | ||
PREREQ="" | PREREQ="" | ||
prereqs() | prereqs() | ||
{ | { | ||
echo "$PREREQ" | echo "\$PREREQ" | ||
} | } | ||
case $1 in | case \$1 in | ||
prereqs) | prereqs) | ||
prereqs | prereqs | ||
Line 25: | Line 28: | ||
exit 0 | exit 0 | ||
EOH | EOH | ||
$ sudo update-initramfs -k $(uname -r) -u | $ sudo chmod 0755 /etc/initramfs-tools/hooks/vi | ||
$ sudo update-initramfs -k $(uname -r) -u -v | |||
... | |||
Calling hook vi | |||
Adding binary /usr/bin/vim.basic | |||
Adding binary-link /usr/lib/x86_64-linux-gnu/libtinfo.so.6 | |||
Adding binary /usr/lib/x86_64-linux-gnu/libtinfo.so.6.3 | |||
Adding binary-link /usr/lib/x86_64-linux-gnu/libsodium.so.23 | |||
Adding binary /usr/lib/x86_64-linux-gnu/libsodium.so.23.3.0 | |||
Adding binary /lib/x86_64-linux-gnu/libgpm.so.2 | |||
Adding binary /lib/x86_64-linux-gnu/libpython3.10.so.1.0 | |||
Adding binary-link /usr/lib/x86_64-linux-gnu/libexpat.so.1 | |||
Adding binary /usr/lib/x86_64-linux-gnu/libexpat.so.1.8.7 | |||
... | |||
</SyntaxHighlight> | </SyntaxHighlight> | ||
As you can see all needed libraries for the binary are added automatically. |
Latest revision as of 09:47, 6 October 2022
Adding binaries to the initial ram disk in Ubuntu
See manual page for initramfs-tools for this, too.
Adding vi to initramfs
$ sudo apt --yes install vim
$ sudo cat >/etc/initramfs-tools/hooks/vi <<EOH
#!/bin/sh -e
PREREQ=""
prereqs()
{
echo "\$PREREQ"
}
case \$1 in
prereqs)
prereqs
exit 0
;;
esac
. /usr/share/initramfs-tools/hook-functions
# Begin real processing below this line
copy_exec /usr/bin/vim.basic /bin
exit 0
EOH
$ sudo chmod 0755 /etc/initramfs-tools/hooks/vi
$ sudo update-initramfs -k $(uname -r) -u -v
...
Calling hook vi
Adding binary /usr/bin/vim.basic
Adding binary-link /usr/lib/x86_64-linux-gnu/libtinfo.so.6
Adding binary /usr/lib/x86_64-linux-gnu/libtinfo.so.6.3
Adding binary-link /usr/lib/x86_64-linux-gnu/libsodium.so.23
Adding binary /usr/lib/x86_64-linux-gnu/libsodium.so.23.3.0
Adding binary /lib/x86_64-linux-gnu/libgpm.so.2
Adding binary /lib/x86_64-linux-gnu/libpython3.10.so.1.0
Adding binary-link /usr/lib/x86_64-linux-gnu/libexpat.so.1
Adding binary /usr/lib/x86_64-linux-gnu/libexpat.so.1.8.7
...
As you can see all needed libraries for the binary are added automatically.