Difference between revisions of "Live CD Kernel"

From LFScript
(Created page with "Compiles the Linux kernel with UnionFS and SquashFS support. <scriptname>kernel-live</scriptname> == Sources == * <sourcecode>https://www.kernel.org/pub/linux/kernel/v3.x/li...")
 
Line 1: Line 1:
Compiles the Linux kernel with UnionFS and SquashFS support.
+
Compiles the Linux kernel with UnionFS and OverlayFS support.
  
 
<scriptname>kernel-live</scriptname>
 
<scriptname>kernel-live</scriptname>
  
 
== Sources ==
 
== Sources ==
* <sourcecode>https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.16.1.tar.xz</sourcecode>
+
* <sourcecode>https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.9.9.tar.xz</sourcecode>
* <sourcecode>http://download.filesystems.org/unionfs/unionfs-2.x-latest/unionfs-2.6_for_3.16.1.diff.gz</sourcecode>
 
  
<md5>e7a985a243b7941b6bc6240fcbc797fc linux-3.16.1.tar.xz
+
<md5>de43a1a9e3a1ad97467c9a413bcdf896 linux-4.9.9.tar.xz</md5>
f2c22645a7306720a8278acae72969cd  unionfs-2.6_for_3.16.1.diff.gz</md5>
 
  
 
== Installation ==
 
== Installation ==
<build># Add UnionFS to the kernel
+
<build># Ensure OverlayFS is selected in the kernel configuration
cp -v ../$(readlink ../unionfs-2.6_for_3.16.1.diff.gz) .
+
if [ "$(cat .config | grep '# CONFIG_OVERLAY_FS is not set')" ]; then
gzip -d unionfs-2.6_for_3.16.1.diff.gz
+
    sed -i "s@# CONFIG_OVERLAY_FS is not set@@g" .config
patch -Np1 -i unionfs-2.6_for_3.16.1.diff</build>
+
    echo "CONFIG_OVERLAY_FS=y" >> .config
 
+
fi</build>
<build># Add UnionFS to the kernel configuration
 
echo "CONFIG_UNION_FS=y"                  >> .config
 
echo "# CONFIG_UNION_FS_XATTR is not set" >> .config
 
echo "# CONFIG_UNION_FS_DEBUG is not set" >> .config</build>
 
  
 
<build># Ensure SquashFS is selected in the kernel configuration
 
<build># Ensure SquashFS is selected in the kernel configuration
Line 33: Line 27:
 
     echo "# CONFIG_SQUASHFS_XATTR is not set"              >> .config
 
     echo "# CONFIG_SQUASHFS_XATTR is not set"              >> .config
 
     echo "CONFIG_SQUASHFS_ZLIB=y"                          >> .config
 
     echo "CONFIG_SQUASHFS_ZLIB=y"                          >> .config
 +
    echo "CONFIG_SQUASHFS_LZ4=y"                            >> .config
 
     echo "CONFIG_SQUASHFS_LZO=y"                            >> .config
 
     echo "CONFIG_SQUASHFS_LZO=y"                            >> .config
 
     echo "CONFIG_SQUASHFS_XZ=y"                            >> .config
 
     echo "CONFIG_SQUASHFS_XZ=y"                            >> .config
Line 44: Line 39:
  
 
<build user="root"># Install
 
<build user="root"># Install
cp -v arch/x86/boot/bzImage /boot/vmlinuz-3.16.1-live
+
cp -v arch/x86/boot/bzImage /boot/vmlinuz-4.9.9-live
cp -v .config /boot/config-3.16.1-live</build>
+
cp -v .config /boot/config-4.9.9-live</build>

Revision as of 20:17, 26 February 2017

Compiles the Linux kernel with UnionFS and OverlayFS support.

LFScript can find this software under the name kernel-live.

Sources


MD5 Checksums:

de43a1a9e3a1ad97467c9a413bcdf896  linux-4.9.9.tar.xz

Installation

# Ensure OverlayFS is selected in the kernel configuration
if [ "$(cat .config | grep '# CONFIG_OVERLAY_FS is not set')" ]; then
    sed -i "s@# CONFIG_OVERLAY_FS is not set@@g" .config
    echo "CONFIG_OVERLAY_FS=y" >> .config
fi
# Ensure SquashFS is selected in the kernel configuration
if [ "$(cat .config | grep '# CONFIG_SQUASHFS is not set')" ]; then
    sed -i "s@# CONFIG_SQUASHFS is not set@@g" .config

    echo "CONFIG_SQUASHFS=y"                                >> .config
    echo "CONFIG_SQUASHFS_FILE_CACHE=y"                     >> .config
    echo "# CONFIG_SQUASHFS_FILE_DIRECT is not set"         >> .config
    echo "CONFIG_SQUASHFS_DECOMP_SINGLE=y"                  >> .config
    echo "# CONFIG_SQUASHFS_DECOMP_MULTI is not set"        >> .config
    echo "# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set" >> .config
    echo "# CONFIG_SQUASHFS_XATTR is not set"               >> .config
    echo "CONFIG_SQUASHFS_ZLIB=y"                           >> .config
    echo "CONFIG_SQUASHFS_LZ4=y"                            >> .config
    echo "CONFIG_SQUASHFS_LZO=y"                            >> .config
    echo "CONFIG_SQUASHFS_XZ=y"                             >> .config
    echo "# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set"      >> .config
    echo "# CONFIG_SQUASHFS_EMBEDDED is not set"            >> .config
    echo "CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3"            >> .config
fi
# Compile
make

As the root user:

# Install
cp -v arch/x86/boot/bzImage /boot/vmlinuz-4.9.9-live
cp -v .config /boot/config-4.9.9-live