Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 396467

Summary: Install gentoo via PXE (integrated squashfs.image + init patch)
Product: Gentoo Release Media Reporter: Ax Warhawk <ax.warhawk>
Component: NetbootAssignee: Gentoo Release Team <releng>
Status: RESOLVED FIXED    
Severity: normal CC: gentoo, nikize, pinkbyte, zerochaos
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: init script patch to load squashfs.image
Patch Detection of squashfs in root
Updated patch

Description Ax Warhawk 2011-12-29 23:09:16 UTC
Created attachment 297349 [details]
init script patch to load squashfs.image

I'm writing a bug because somebody in the forum told me to do so.
http://forums.gentoo.org/viewtopic.php?p=6908770

In short: i like the idea of booting / installing systems over PXE, no USB stick, no DVD is needed, just a simple network cable needs to be attached.

I know the only supported way of installing Gentoo is by using the live CD provided by the developers. So to install Gentoo via PXE i unpacked the initrd file, attached the squashfs.image (/mnt/cdrom/squashfs.image) patched the init file, and packed everything back together again.

The patch for the init script is attached to this bug.

If you guys think it would be a good idea to (kinda) support this. i can write a simple bash script which will do everything i did fully automatically just having this script and the official installation image. So everybody how needs a PXE installation without NFS mounts or something like that can easily "convert" the cd image to a bootable kernel + initrd image.
Comment 1 Sergey Popov (RETIRED) gentoo-dev 2012-08-24 16:17:54 UTC
Subscribing to this bug. Patch exists long time ago. This patch is not production-quality, but it seems that some users really need such functionality(i am the such user also). Could we do something about this?
Comment 2 Christian Nilsson 2018-07-24 20:09:19 UTC
I have made similar implementations for SystemRescueCd[1],
The idea is simply to allow for squashfs image to be located in already existing/mounted filesystem, before search on different media is started.

I also made this work by injecting a /etc/initrd.splash (and squashfs) via additional cpios, .splash containing: 
got_good_root=1
bootstrapCD() {
    CDROOT_PATH=/
    cd /
    REAL_ROOT=/
    return 0
}


[1] https://github.com/NiKiZe/systemrescuecd/commit/e97479ddbd02075e1ed44e39460b9aa3b85ac306

I also think that BUG #74628, and BUG #494300 would be solved by this
Comment 3 Christian Nilsson 2018-07-24 23:27:10 UTC
Created attachment 540984 [details, diff]
Patch Detection of squashfs in root

Added patch that should work, hopefully without breaking anything else.
Example usage at http://b800.org/gentoo/boot.ipxe
With backup at https://gateway.ipfs.io/ipfs/QmP1hw69dV7kSUBEBTBpGtudxwcH5Apu1ngUzRtr5jEBCR/boot.ipxe

With attached patch applied however, the "/etc/initrd.splash" in boot.ipxe should not be needed.

What the patch does is "simply" to detect if the LOOP filename already exists in the existing filesystem (exact path match) and if it does it skips all CD detection and mounting.

the CDROOT_PATH modification is needed to avoid check_loop() in initrd.scripts to error out, didn't find a better way to handle that.
Comment 4 Christian Nilsson 2018-07-25 00:35:07 UTC
Created attachment 540986 [details, diff]
Updated patch

Updated patch with initialization of variables added, and some comments
Comment 5 Rick Farina (Zero_Chaos) gentoo-dev 2018-07-25 01:05:40 UTC
Robin,

ignore "init script patch to load squashfs.image", the other patch is good to go I think.
Comment 6 Larry the Git Cow gentoo-dev 2018-07-25 15:11:07 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=24ad5065fa856389ee9b058f57adffbe752da157

commit 24ad5065fa856389ee9b058f57adffbe752da157
Author:     Christian Nilsson <nikize@gmail.com>
AuthorDate: 2018-07-24 23:08:23 +0000
Commit:     Rick Farina (Zero_Chaos) <zerochaos@gentoo.org>
CommitDate: 2018-07-25 15:10:19 +0000

    linuxrc: Add detection of squashfs in initrd root
    
    Allows for the squashfs to be found in the initrd root without mounting CD
    This allows iPXE boot by adding the squashfs in a extra cpio initrd
    
    Related: https://bugs.gentoo.org/74628
    Related: https://bugs.gentoo.org/494300
    Closes: https://bugs.gentoo.org/396467
    Signed-off-by: Christian Nilsson <nikize@gmail.com>

 defaults/initrd.defaults |  5 +++++
 defaults/linuxrc         | 21 +++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)