LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 06-11-2009, 07:56 AM   #1
bluepenguine
LQ Newbie
 
Registered: Mar 2008
Posts: 16

Rep: Reputation: 1
Question how modify initramfs...init script


Hello , all
In linux boot process when using initramfs..
I dont want to use real rootfilesystem ..
I want to continue working on root filesystem on ram disk ..also want to have ability to read/write CF disk..
I am booting linux from CF disk , havind minimal debian 4.0 system on it....
any help / reference will do !!
thanks in advance
 
Old 07-11-2009, 02:19 AM   #2
ugglan
LQ Newbie
 
Registered: Jun 2009
Location: Sweden
Distribution: Debian, Ubuntu
Posts: 3

Rep: Reputation: 0
Take a look at the file Documentation/filesystems/ramfs-rootfs-initramfs.txt in the linux directory.

Basically, what I did to get this working was to create a directory containing all files for the initramfs and a file describing my initramfs and point to that file in the kernel configuration. You have to provide an /init file in your initramfs, I used a symlink to busybox for that purpose and then I created an /etc/inittab with an entry for my start script. I don't know how this will work in Debian though.
 
Old 07-14-2009, 02:21 PM   #3
EmbeddedSteve
LQ Newbie
 
Registered: Sep 2006
Posts: 17

Rep: Reputation: 0
ugglan,
Thanks for the pointer, I was going to post a similar/related question. Funny, I was looking for "initxxx" in the filesystems directory, never thought to look under ramxxx
 
Old 07-31-2009, 04:34 AM   #4
AjayCelst
LQ Newbie
 
Registered: Jul 2009
Location: Bangalore, INDIA
Distribution: Centos 5.2
Posts: 20

Rep: Reputation: 0
How to View, Modify and Recreate initrd.img

Question: How do I view, modify and recreate the new initrd.img on Ubuntu, Debian, CentOS, Fedora, Red-Hat, Arch Linux, or SUSE distributions?

1. How To View Content Of initrd.img file?

initrd.img is in gzip format. So move initrd.img to initrd.gz as shown below.

# cp /tftpboot/el5/initrd.img .

# ls
cdrom initrd.img

# mv initrd.img initrd.gz

Unzip the initrd.gz file as shown below.

# gunzip initrd.gz

# ls
cdrom initrd

After unziping the initrd.gz file, the initrd is further in cpio ‘newc’ format. So extract the files from initrd using cpio ‘newc’ format as shown below.
Note: info cpio will give more information about ‘newc’ format.

# mkdir tmp2

# cd tmp2/

# cpio -id < ../initrd
16524 blocks

Now you can view the content of initrd.img file

# ls
bin dev etc init modules proc sbin selinux sys tmp var

2. How To Modify Content of Image and Recreate New Image?

After extracting the file as shown below, make appropriate modification to any of those files. Then pack the files back into the archive using the following commands. Pack the modified files back to cpio ‘newc’ format.

# find . | cpio --create --format='newc' > /tmp/newinitrd
16524 blocks

# ls /tmp/
cdrom initrd newinitrd tmp2

# ls -l /tmp/newinitrd
-rw-r--r-- 1 root root 8460288 Jul 2 14:50 /tmp/newinitrd

Gzip the archive file.

# gzip newinitrd

# ls
cdrom initrd newinitrd.gz tmp2

# ls -l newinitrd.gz
-rw-r--r-- 1 root root 6649867 Jul 2 14:50 newinitrd.gz

Move file as an image file. You can use the newinitrd.img as your new boot image.

# mv newinitrd.gz newinitrd.img

# ls -l newinitrd.img
-rw-r--r-- 1 root root 6649867 Jul 2 14:50 newinitrd.img
 
  


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
module-init-tools, initramfs-tools broken virgilhowardson Debian 1 03-08-2009 12:30 AM
Cant find /init during PowerPC initramfs boot kermitG Linux - Embedded & Single-board computer 1 02-16-2009 09:59 AM
Bug in initramfs /init detected while booting from Fedora 9 liveusb nikhil010586 Linux - Newbie 1 09-16-2008 12:54 PM
Modify Perl script to work with txt - Permissions script joangopan Programming 4 09-14-2007 09:20 PM
script to modify url gazman1 Programming 2 06-14-2006 09:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 08:39 AM.

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