Hi. I'd like to add program to initrd.img so it could run before the root filesystem mounted. How is this possible?
EDIT: I'd like to add qemu-utils which is installed by apt-get and it's dependencies to initrd.img
topic title: Add program to initrd.img
4 posts
• Page 1 of 1
-
Posts: 22
- Joined: 02 Sep 2015
#1
Last edited by wean_irdeh on 01 Aug 2016, 15:47, edited 2 times in total.
-
Posts: 1,445
- Joined: 09 Feb 2012
#2
For live-init, I've used /usr/local/bin/ps_initrd.sh (Usage: ps_initrd.sh INITRD open|close|cancel)
but it's been more than a year since I messed with it. To confirm the workflow, I would need to dig through my old notes.
(something like: create a dir to work in, copy the current init..gz file into workdir, cd workdir, run"ps_initrd.sh init..gz open" to extract contents...)
In the meantime, examining ps_initrd.sh in a text editor might be enlightening for you.
IIRC, it's primarily a wrapper script which employs tools (commands) which are provided by the debian package"initramfs-tools" (preinstalled in antiX)
manpages:
man initramfs-tools
man mkinitramfs
man update-initramfs
You can also skim the docs-n-examples here:
/etc/initramfs-tools/*
/usr/share/doc/initramfs-tools/*
/usr/share/initramfs-tools/*
but it's been more than a year since I messed with it. To confirm the workflow, I would need to dig through my old notes.
(something like: create a dir to work in, copy the current init..gz file into workdir, cd workdir, run"ps_initrd.sh init..gz open" to extract contents...)
In the meantime, examining ps_initrd.sh in a text editor might be enlightening for you.
IIRC, it's primarily a wrapper script which employs tools (commands) which are provided by the debian package"initramfs-tools" (preinstalled in antiX)
manpages:
man initramfs-tools
man mkinitramfs
man update-initramfs
You can also skim the docs-n-examples here:
/etc/initramfs-tools/*
/usr/share/doc/initramfs-tools/*
/usr/share/initramfs-tools/*
Bear in mind that your injected"program" probably has only busybox command interpreter available at that point during init.before the root filesystem mounted
-
Posts: 22
- Joined: 02 Sep 2015
#3
EDIT:
How could one determine if a program would run in busybox or not?skidoo wrote:Bear in mind that your injected"program" probably has only busybox command interpreter available at that point during init.before the root filesystem mounted
EDIT:
Does this means all antiX distro use initramfs instead of initrd? There's different instruction regarding unpack eitherskidoo wrote: manpages:
man initramfs-tools
man mkinitramfs
man update-initramfs
-
Posts: 1,445
- Joined: 09 Feb 2012
#4
sudo locate initrd
sudo locate initramfs
doesn't bode well for the prospect of your success.
I not familiar enough with busybox to discuss what is or isn't possible. I'm not even certain the init for an installed (not live-boot) antiX uses busybox.
The fact that you're asking, rather than determining for yourself, viaantiX distro use initramfs instead of initrd?
sudo locate initrd
sudo locate initramfs
doesn't bode well for the prospect of your success.
A google search would have pointed you straightaway to busybox.netHow could one determine if a program would run in busybox or not?
I not familiar enough with busybox to discuss what is or isn't possible. I'm not even certain the init for an installed (not live-boot) antiX uses busybox.