LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 05-26-2009, 01:06 AM   #1
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Looking for script to generate isolinux/initrd.img


I'm looking for the script, or whatever setup is used, to generate the isolinux/initrd.img file. Something needs to be making decisions as to what files are put there, which contents, etc. Not everything in there is a replica of a regular system. Where do these files come from?

The particulars for making isolinux/isolinux.bin (the ISO boot loader) might also be useful.
 
Old 05-26-2009, 09:38 PM   #2
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 875

Rep: Reputation: 282Reputation: 282Reputation: 282
Some of the stuff can be found :- (on a slackware mirror)

source/installer
source/a/pkgtools
source/a/syslinux

Making a bootable CD/DVD :-
http://syslinux.zytor.com/wiki/index.php/ISOLINUX

Look in /boot on an installed system for info on making an initrd
 
Old 05-26-2009, 10:25 PM   #3
quanta
Member
 
Registered: Aug 2007
Location: Vietnam
Distribution: RedHat based, Debian based, Slackware, Gentoo
Posts: 724

Rep: Reputation: 101Reputation: 101
man mkinitrd?
 
Old 05-26-2009, 10:36 PM   #4
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
I've got the construction process down. Been doing that for ages. I just need know what to put in the tree that does get built, and where these files come from. I took the distributed isolinux/initrd.img apart and compared that to the running system (matched versions). Some files were the same and some files were different. Well over 200 files in there did not even exist in the installed system, most of which didn't appear to be specific to an installer. Once I can build the file tree, I'm ready for a home run the rest of the way.

But I want to patch some things in there that are not necessarily just scripts. If only scripts need to be changed, I can just use the original isolinux/initrd.img as the "source" and apply a patch and rebuild. But I really want to be building this from 100% source. What's in there may involve separate builds of some components using different configuration options, different libraries available to the build, as well as a subset selection of installed files (this much might easy enough to reverse engineer since I have a list of files). Of course, "installing" in this case would be targeting a directory acting as the root for what will be collected into isolinux/initrd.img.

I can't rule out that Pat just builds it manually. I've built bootable ISOs manually myself, too.
 
Old 05-26-2009, 10:40 PM   #5
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by quanta View Post
man mkinitrd?
This is primarily for the installed system. It builds the initrd.img expected to run at system bootup. It might be usable, too, for the installer ISO bootup using the distributed image isolinux/initrd.img file. But what I need is where the files that go into it come from. They are not all the same as what is in the installed running system.
 
Old 05-27-2009, 12:35 PM   #6
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,542

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Quote:
Originally Posted by Skaperen View Post
This is primarily for the installed system. It builds the initrd.img expected to run at system bootup. It might be usable, too, for the installer ISO bootup using the distributed image isolinux/initrd.img file. But what I need is where the files that go into it come from. They are not all the same as what is in the installed running system.
The installer initrd is comprised of the installer scripts which live in /usr/lib/setup within the installer filesystem, various binaries (and Kernel modules) which are extracted from the Slackware binary tree at the time the initrd.img and the USB/PXE installers are created, plus a couple of bits which are compiled each time - such as busybox and dropbear.

There are many other tools which create the distributable tree, but aren't included because they're very specific to the environment in which they are run -- the installer build is one such tool which is why it's not in the source tree.

However, it's reasonably easy to update by hand if you want to make modifications to it.

cd isolinux
mkdir tmp
cd tmp
zcat ../initrd.img | cpio -div
make your changes
find . | cpio -o -H newc | gzip -9fv > ../initrd.img
cd ..
rm -rf tmp
 
Old 05-27-2009, 03:24 PM   #7
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by drmozes View Post
However, it's reasonably easy to update by hand if you want to make modifications to it.
Not so for the parts compiled from source code.

Quote:
Originally Posted by drmozes View Post
cd isolinux
mkdir tmp
cd tmp
zcat ../initrd.img | cpio -div
make your changes
find . | cpio -o -H newc | gzip -9fv > ../initrd.img
cd ..
rm -rf tmp
I do know how to extract the tree and rebuild it back into the image. But that's not the whole picture.

I want to make changes that are patches to the source code that gets compiled to binary programs that become part of the root tree that is used to build isolinux/initrd.img. Many of these programs are different than in the installed system. That means some changes have been made. These changes may be simply different options on the ./configure script. Or they may be source level patches (or equivalent hacks). Or it could be as benign as being based on a previous version of Slackware.

I want to be able to reproduce that. If there are any patches to GPL programs, I have a legal right to those since the binary was distributed to me (e.g. a right to the complete source which includes all patches or hacks to it), just as you would have a legal right to the same (anything and everything that comprises any product that is in any part derived from any component licensed under GPL) for whatever I do, if I distribute a binary form (such as the initrd.img of it) to you.

In the end, I could simply ask Pat for it. But if this is already available somewhere I'm not seeing, I would not want to be wasting Pat's time by such asking.
 
Old 05-27-2009, 03:45 PM   #8
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
I guess the source of confusion here is the different perspective people have for "script to generate". The popular perception seems to be that such a script would only be a minimal script, and that it would use input that is as close to the desired output as possible. For example, a "script to generate an ISO" would be thought of as something to take an already complete file tree of what files will be in the ISO image, and run mkisofs appropriately, possibly also making it bootable.

So I guess I wasn't clear in a poor choice of title. My perspective comes from building things all the way from source. Many people use SlackBuild scripts to do this, already, for at least some packages, if not all of them, for their target system. Or try Linux From Scratch. I've also worked for Timesys building embedded Linux systems.

Ideally, there would be a script to select file components for the tree that goes into the isolinux/initrd.img. It could select them from existing packages (e.g. .tgz or .txz packages that are installed with ROOT=the directory where the tree is being built). It could run special SlackBuild scripts to make modified versions of some packages (e.g. leave out stuff not needed for the installer to keep RAM usage lighter). It could then leave the file tree as the resulting product, or proceed to use mkinitrd or discrete commands to build isolinux/initrd.img as the final product.

So in summary, to me, a "script to generate" something will, where practical, build things from original pristine source (plus desired patches).
 
Old 05-27-2009, 04:03 PM   #9
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
As I read it what you are trying to do is rebuild a custom bootloader from source, but would like to modify a script to do it. However I could be wrong as your explanations are extremely convoluted.

It may be easier just to say what you would like to create and then it might be more apparent what you are looking for.

I have only modified the bootloader, rather than patch and build it, but as far as I remember it is only the stuff that wildwizard mentioned plus a kernel.
Quote:
Some of the stuff can be found :- (on a slackware mirror)

source/installer
source/a/pkgtools
source/a/syslinux

Making a bootable CD/DVD :-
http://syslinux.zytor.com/wiki/index.php/ISOLINUX

Look in /boot on an installed system for info on making an initrd
samac

Last edited by samac; 05-27-2009 at 04:04 PM.
 
Old 05-28-2009, 02:45 AM   #10
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by samac View Post
As I read it what you are trying to do is rebuild a custom bootloader from source, but would like to modify a script to do it. However I could be wrong as your explanations are extremely convoluted.

It may be easier just to say what you would like to create and then it might be more apparent what you are looking for.

I have only modified the bootloader, rather than patch and build it, but as far as I remember it is only the stuff that wildwizard mentioned plus a kernel.
It is not the bootloader (isolinux) that I am wanting to modify. I would expect if there is a script to build all this stuff, the isolinux bootloader package would be built by that script.

There is other stuff in there. Other binary programs. Maybe there is no master script to build it all. But maybe there are a bunch of SlackBuild scripts to build each package that goes into the file tree for that isolinux/initrd.img file. Those things that are different would be in there. The binary programs that are the same could just use the same SlackBuild scripts as the regular system.

Think about it this way. You want to build the isolinux/initrd.img file. But you don't have the file tree that goes into it, nor do you have the original isolinux/initrd.img file, either. You need to build everything from source. Some of it probably could be build at source level using regular SlackBuild scripts and the resulting package file installed with ROOT= to the directory the file tree is being built in. But some of the packages are different than a regular system. How do you build those?

In my case, I want to modify some stuff. At this point, what it is I want to modify is not important. I have not made final decisions, yet.
 
Old 05-28-2009, 03:04 AM   #11
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
Sorry I used the word bootloader incorrectly. I was using it to mean the whole of the initrd.img that booted Slackware. However you have had your answer. If you unpack that image file and look at it you will see it is just the items in the source/installer directory some scripts a kernel and not a awful lot else.

As you list LFS in your signature, I would assume that you are familiar with a toolchain, init scripts etc., if this is the case you should be able to figure your way round this fairly easily.

samac
 
Old 05-28-2009, 12:15 PM   #12
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by samac View Post
Sorry I used the word bootloader incorrectly. I was using it to mean the whole of the initrd.img that booted Slackware. However you have had your answer. If you unpack that image file and look at it you will see it is just the items in the source/installer directory some scripts a kernel and not a awful lot else.
There's a lot more than just the source/installer stuff in isolinux/initrd.img.

Quote:
Originally Posted by samac View Post
As you list LFS in your signature, I would assume that you are familiar with a toolchain, init scripts etc., if this is the case you should be able to figure your way round this fairly easily.
Sure, once I know what modifications to the other source are made, I'd have no trouble building it. I could even build one now, and make it work. But it wouldn't necessarily be the same as, or work exactly like, what isolinux/initrd.img has.

Maybe some of the SlackBuild scripts are looking for an environment variable that says "we are building the installer, so do stuff different". I'll look around for that.
 
Old 05-28-2009, 01:34 PM   #13
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,542

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Quote:
Originally Posted by Skaperen View Post
There's a lot more than just the source/installer stuff in isolinux/initrd.img.

Sure, once I know what modifications to the other source are made, I'd have no trouble building it. I could even build one now, and make it work. But it wouldn't necessarily be the same as, or work exactly like, what isolinux/initrd.img has.

Maybe some of the SlackBuild scripts are looking for an environment variable that says "we are building the installer, so do stuff different". I'll look around for that.
As I said, the only parts compiled are dropbear and busybox. All other binaries are imported from the EXISTING .t?z packages in -current at the time the initrd.img is created. The packages are literally "installpkg -root" into a temporary dir, and the binaries and other bits pulled out.

Why do you think they are patched? Check for yourself the md5sums of any of the binaries against the md5sums in the .t?z packages. They will be identical.

If you want to modify the component binaries, then all you have to do is patch the source of the binary you want, and reinclude it into the initrd.img.
 
Old 05-29-2009, 09:18 AM   #14
Skaperen
Senior Member
 
Registered: May 2009
Location: center of singularity
Distribution: Xubuntu, Ubuntu, Slackware, Amazon Linux, OpenBSD, LFS (on Sparc_32 and i386)
Posts: 2,684

Original Poster
Blog Entries: 31

Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by drmozes View Post
As I said, the only parts compiled are dropbear and busybox. All other binaries are imported from the EXISTING .t?z packages in -current at the time the initrd.img is created. The packages are literally "installpkg -root" into a temporary dir, and the binaries and other bits pulled out.

Why do you think they are patched? Check for yourself the md5sums of any of the binaries against the md5sums in the .t?z packages. They will be identical.
I did that a few days ago. They were not identical. That's why I posted my question in the first place.

Quote:
Originally Posted by drmozes View Post
If you want to modify the component binaries, then all you have to do is patch the source of the binary you want, and reinclude it into the initrd.img.
I can certainly make my own initrd with no problem. I wanted to start with the original one as a reference point and go from there.
 
Old 05-29-2009, 04:49 PM   #15
drmozes
Slackware Contributor
 
Registered: Apr 2008
Distribution: Slackware
Posts: 1,542

Rep: Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310Reputation: 1310
Quote:
Originally Posted by Skaperen View Post
I did that a few days ago. They were not identical. That's why I posted my question in the first place.
Which in particular are not identical?
 
  


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
How to create new initrd.gz (or initrd.img) file? kkpal Programming 2 12-10-2007 08:38 AM
Add new cciss driver module to initrd.img ,stage2.img kunalroy2002 Linux - Software 4 09-25-2007 12:09 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
Initrd.img Error...Isolinux: Disk Error 80 bohh Slackware - Installation 1 07-29-2004 11:20 AM
What's an initrd.img? hotel-lima Linux - Newbie 2 06-11-2004 05:50 PM

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

All times are GMT -5. The time now is 04:10 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