Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 3688  / 3 Years ago, thu, may 6, 2021, 6:11:10

Most Busybox questions are related to the fact that users are dropped to a Busybox shell due to some unknown issues at boot time. This must make Busybox one of the most hated pieces of software.



My problem is the opposite. I want to deliberately start Busybox at boot time either from GRUB, or even before GRUB. Is this possible? How can I do it? The purpose is to execute some commands before the boot sequence is reinitiated. So basically I want to execute some commands to make some hardware available to the bootloader.


More From » boot

 Answers
3

You will need to make a custom initrd.



Extract an initrd, note I use ~/initrd as a working directory



cp /boot/initrd_your_version ~
cd ~/initrd
gzip -dc ../initrd_your_version | cpio -imvd --no-absolute-filenames


You did not mention what you wanted to do, so I can only give general advice here.



Now, add any libs and/or binaries you need into the ~/initrd . Use ldd to identify dependencies.



Edit ~/initrd/init , it is a shell script, so add in what you need.



Package it up



cd ~/initrd
find . | cpio --quiet --dereference -o -H newc | gzip -9 > ../initrd-custom.img.your_version


See also: http://en.gentoo-wiki.com/wiki/Initramfs



Sure that link is gentoo, but I do not know of any such detailed document for Ubuntu.



See also : http://www.busybox.net/about.html


[#37697] Friday, May 7, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
musining

Total Points: 171
Total Questions: 124
Total Answers: 121

Location: Zambia
Member since Thu, Jun 25, 2020
4 Years ago
;