LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 03-19-2013, 09:58 AM   #1
chesschi
Member
 
Registered: May 2011
Posts: 41

Rep: Reputation: 0
switch_root in busybox


Hi,

I had an embedded device which uses busybox as the Linux operating system. There is a hard disk (hda) attached to the device. My goal is to deploy a linux operating system to the kit.

I use UNetbootin to create a bootable USB and this will install the image as per syslinux.cfg. The installation image contains some scripts to create a partition and format the hard disk, install the GRUB to the hard disk (using grub-install command), and copy my own grub files to the boot directory of the GRUB.

My own grub files include the kernel image (bzImage) and menu.lst, where menu.lst will tell where to find the kernel bzImage (p.s. I did not specify initrd option). i.e.
Quote:
...
root (hd0,0)
kernel /boot/bzImage root=/dev/hda1
When I remove the USB pendrive and reboot, it can load the bzImage and start the operating system. However, the filesystem is volatile (i.e. the changes to the filesystem will be lost after reboot)!

I am very new to the kernel build. I guess to make the filesystem is non-volatile, I have to write a script to mount the hard disk and use switch_root for the initramfs to point the root to the hard disk. However, switch_root requires PID 1 and the process ID started by /etc/inittab is not 1. I have seen in threads/forum mentioning there is a /init script but did not specify where it is located.

Is switch_root the correct way to make the filesystem to non-volatile in initramfs?

If so, where should I put the /init script to execute switch_root command? Can I put the /init script inside the kernel bzImage, or the installation image, or something else?

Many thanks!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Busybox qwerty4061 Linux - Embedded & Single-board computer 3 01-11-2012 11:56 AM
Grub- Send kernel mounting paramaters and does it use switch_root? dman777 Linux - General 1 10-06-2011 05:09 AM
BusyBox v1.1.3 Rameses Linux - Server 1 08-01-2010 01:27 AM
Busybox Meh Linux - Newbie 4 03-01-2010 01:31 AM
Busybox and vi krizzz Linux - Software 3 03-24-2005 05:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration