LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-18-2019, 10:27 AM   #1
bifferos
Member
 
Registered: Jul 2009
Posts: 122

Rep: Reputation: 33
Unpacking and repacking initrd


Hi,

There is a program usr/gen_init_cpio in the kernel source. It uses a spec file to allow non-root users to generate the device file entries, e.g.:

Code:
  dir /dev 755 0 0
  nod /dev/console 644 0 0 c 5 1
  nod /dev/loop0 644 0 0 b 7 0
Is there a program that generates that spec file from an existing initrd?

I'm sure someone must have done it, but I've not found anything so far.

many thanks,
Biff.

Last edited by bifferos; 02-18-2019 at 01:11 PM.
 
Old 02-20-2019, 04:37 PM   #2
bifferos
Member
 
Registered: Jul 2009
Posts: 122

Original Poster
Rep: Reputation: 33
This appears to work, at least for my simple case:
https://github.com/bifferos/bb/blob/...t_init_cpio.py
 
Old 02-20-2019, 04:51 PM   #3
GazL
Senior Member
 
Registered: May 2008
Posts: 4,952
Blog Entries: 15

Rep: Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557Reputation: 2557
Have you considered just mounting devtmpfs? You'd probably get away with only having to include /dev/console in your initramfs cpio.


I didn't post earlier as I didn't want to take you off the zero reply list and I didn't have a proper answer for you.
 
Old 02-21-2019, 04:11 AM   #4
bifferos
Member
 
Registered: Jul 2009
Posts: 122

Original Poster
Rep: Reputation: 33
Yes that would have been a possibility, but the code was fewer lines than I expected in the end. You're right about /dev/console as well. I used to use some code for packing initrd that added the console only (https://github.com/bifferos/bb/blob/...ny/mkbiffrd.py) but I wanted to bring gen_init_cpio into the loop as it seemed to be a nice way of doing things. My code doesn't handle hard links, but I don't have a cpio archive that includes them for now.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] cpio complains when unpacking initrd.img PeterSteele Red Hat 4 09-26-2012 04:03 PM
to initrd or not to initrd... svu Slackware 31 10-05-2011 07:17 PM
Burning a DVD for Linux and repacking an iso Disco77 Linux - Newbie 2 06-01-2009 03:45 PM
How to create new initrd.gz (or initrd.img) file? kkpal Programming 2 12-10-2007 08:38 AM
Failed to symbolic-link boot/initrd.img-2.6.18-4-486 to initrd.img Scotteh Linux - Software 8 06-01-2007 11:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration