[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Using initrd as livefs_root



On 05/22/2017 09:54 AM, Daniel Lindgren wrote:
Hi Mert,


    live-boot initramfs hooks check the /live/filesystem.squashfs file
    by default. And you can add files to initramfs simply by appending
    it to the existing file (no need to unpack & repack).

    I already do this for quite some time and this is roughly the code I
    use:

            echo live/filesystem.squashfs | cpio -o -H newc | gzip -1 >
    $live_initrd
            cat $org_initrd $live_initrd > $new_initrd

    Replace the original initramfs image with the newly created one and
    there is no need for any other changes, it'll just work.


I've built a live environment and used your commands to concatenate a
new initrd.img, here's the command history from the build:

mkdir ~/lbwork && cd ~/lbwork
lb config
cp /usr/share/doc/live-build/examples/auto/* ~/lbwork/auto/
vi auto/config <--- Adding some build parameters, mostly archive and
mirror url:s
echo "cryptsetup dialog file firmware-linux-nonfree hdparm ntp pv ssh
vim" > config/package-lists/extrapaket.list.chroot
# set some console parameters and add startup script to root
mkdir -p config/includes.chroot/etc/sysctl.d
echo "kernel.printk = 3 4 1 3" >
config/includes.chroot/etc/sysctl.d/loggning.conf
mkdir -p config/includes.chroot/usr/local/bin/
cp -p ~/clean_machine.pl <http://clean_machine.pl>
config/includes.chroot/usr/local/bin/
mkdir config/includes.chroot/root
echo "alias ll='ls -la'" >> config/includes.chroot/root/.bashrc
echo "alias ltr='ls -latr'" >> config/includes.chroot/root/.bashrc
echo "setterm -blank 0" >> config/includes.chroot/root/.bashrc
echo "tty | grep -q /dev/tty1 && /usr/local/bin/clean_machine.pl
<http://clean_machine.pl>" >> config/includes.chroot/root/.bashrc
sudo lb config
sudo lb build
sudo -s
cd binary/
echo live/filesystem.squashfs | cpio -o -H newc | gzip -1 > fs.img
cat live/initrd.img fs.img > initrd_with_fs.img

This is a binwalk of initrd_with_fs.img:

DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             ASCII cpio archive (SVR4 with no CRC),
file name: "kernel", file name length: "0x00000007", file size: "0x00000000"
120           0x78            ASCII cpio archive (SVR4 with no CRC),
file name: "kernel/x86", file name length: "0x0000000B", file size:
"0x00000000"
244           0xF4            ASCII cpio archive (SVR4 with no CRC),
file name: "kernel/x86/microcode", file name length: "0x00000015", file
size: "0x00000000"
376           0x178           ASCII cpio archive (SVR4 with no CRC),
file name: "kernel/x86/microcode/GenuineIntel.bin", file name length:
"0x0000002A", file size: "0x000C9000"
823824        0xC9210         ASCII cpio archive (SVR4 with no CRC),
file name: "TRAILER!!!", file name length: "0x0000000B", file size:
"0x00000000"
824320        0xC9400         gzip compressed data, from Unix, last
modified: Mon May 22 08:25:03 2017
7667140       0x74FDC4        Zlib compressed data, compressed,
uncompressed size >= 75264
32989502      0x1F7613E       gzip compressed data, fastest compression,
from Unix, last modified: Mon May 22 08:29:28 2017
33034359      0x1F81077       xz compressed data
[...]

This is the PXELINUX menu entry:

label debian_live_x64
  MENU LABEL ^I: Debian LIVE x64
  KERNEL images/linux/debian/live/vmlinuz
  APPEND ipv6.disable=1 boot=live nopersistence noeject silent config
locales=sv_SE.UTF-8 keyboard-layouts=se timezone=Europe/Stockholm utc=no
username=root
  INITRD images/linux/debian/live/initrd_with_fs.img

Unfortunately I get the same result, no medium containing a live
filesystem found.

Any ideas?




Sorry I've missed a crucial step:

- Add "live-media=/" to boot arguments.



Reply to: