Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi all,
I have an USB stick with two partiton (called for semplicity P1 and P2).
I need to create bootable usb with this constrain:
1. The bootloader stay on P1
2. The Linux OS stay on P2
3. Before the Bootloader load the root Partition on P2, I NEED TO CALL A BASH SCRIPT. (this is the most important thing).
I've try to doing this with SYSLINUX + initrd without success.
My idea was SYSLINUX boot initrd, call the script and after load the root partition.
After the kernel is booted and initialized, the kernel starts the first user-space application. This is the first program invoked that is compiled with the standard C library. Prior to this point in the process, no standard C applications have been executed.
In a desktop Linux system, the first application started is commonly /sbin/init. But it need not be. Rarely do embedded systems require the extensive initialization provided by init (as configured through /etc/inittab). In many cases, you can invoke a simple shell script that starts the necessary embedded applications.
If you are looking to run a script after the kernel is loaded but before the root partition is mounted, then you will need to look at the init process.
after the kernel is loaded, if an initrd is present, the kernel looks for a file named linuxrc in the root directory of the initrd and executes it. then the actual root is mounted and /sbin/init is executed.
if you want to run a bash script before the root filesystem is mounted, put it in the root directory of the initrd, make it executable and name it linuxrc
Last edited by abdul_ahad; 06-13-2012 at 05:38 AM.
Thanks for reply.
I'm able to boot the initrd and execute the relative command using init. But now i need a method to found the root partition and boot it.. Any ideas?
Thanks a lot.
the normal procedure for the kernel, if an initrd is found is to execute linuxrc or init from it and then proceed to mount the root filesystem from the device given in the kernel command line at boot time, and then run /sbin/init from the actual rootfs. there is generally no need to run any special commands for mounting the actual root from the initrd.
Quote:
Originally Posted by ciclonite
Thanks for reply.
I'm able to boot the initrd and execute the relative command using init. But now i need a method to found the root partition and boot it.. Any ideas?
Thanks a lot.
are you referring to a shell script you have named as init in the initrd. if so, can you post its contents here so that we can have some idea of what goes on after loading the initrd and then work from there.
Last edited by abdul_ahad; 06-13-2012 at 05:33 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.