Author Topic: How to make your own NuTyX iso that boot faster by not copying all files to RAM  (Read 5913 times)


  • Newbie
  • *
  • Posts: 43
  • Karma: +0/-0
On you can see how to make your own NuTyX iso.

I wanted an ISO that would boot faster.
I discovered the reason the Mate USB key is slow to boot in Live mode is that it copy everything to RAM.
That can be very good, if by example, you wish to remove the USB key after booting.
Or if you wish to have programs load very fast.

But often, I need to boot fast, and I am very happy letting the USB key connected after I booted.

So there is two aspects to make this:

First in the boot menu, we have to add a new option that will determine if files will be copied to RAM or not.
I decided to call this option: toram

Next we need to modify the file that load to ram, to say to copy the files to RAM only if the new toram option was present as a kernel parameter.

So where to add the new toram option?
At first I tried to modify $LFS/ISO/isolinux/live.cfg file.
But it turned out that the mkiso script overwrite this file.
So you have to edit the file mkiso use to overwrite the previously mentioned file.
It is $NUTYX_TMP/iso/isolinux/live.cfg.

I changed it that way:
Code: [Select]
paul [ ~/tmpnutyx/iso/isolinux ]$ diff -u live.cfg.orig live.cfg
--- live.cfg.orig 2019-12-01 08:53:51.403293971 -0500
+++ live.cfg 2019-12-01 08:55:53.606625004 -0500
@@ -7,3 +7,13 @@
  menu label li^ve-Debug
  kernel /boot/kernel-#VERSION_KERNEL#
  append initrd=/boot/initrd-#VERSION_KERNEL# vga=788 ro testiso live
+label live-toram
+ menu label Live copied to ^RAM
+ kernel /boot/kernel-#VERSION_KERNEL#
+ append initrd=/boot/initrd-#VERSION_KERNEL# vga=788 ro quiet live toram
+label live-debug-toram
+ menu label live-Debug copied to RA^M
+ kernel /boot/kernel-#VERSION_KERNEL#
+ append initrd=/boot/initrd-#VERSION_KERNEL# vga=788 ro testiso live toram
paul [ ~/tmpnutyx/iso/isolinux ]$

Next, inside nutyx-install -ec, I did modify /lib/lsb/ file as follows:
paul [ /ISO-NuTyX/lib/lsb ]$ diff -u
---   2019-12-01 09:18:18.[12:58 x86_64 4.19.86-NuTyX-lts paul@nutyx]
+++   2019-12-01 11:29:40.519997441 -0500
@@ -174,7 +174,7 @@
          MAX_ROOTFS_SIZE=$((ROOTFS_AVAIL * 90 / 100 ))
          SQFS_SIZE=`ls -s $SQFS/$DIR.squashfs| cut -d " " -f1`
          # We going to keep 10 % as reserve (calculation rounding issue etc)
-         if [ $SQFS_SIZE -gt $((ROOTFS_AVAIL * 90 / 100 )) ];then
+         if [ ! "$toram" == "yes" ] || [ $SQFS_SIZE -gt $((ROOTFS_AVAIL * 90 / 100 )) ];then
             # Not enough RAM
             [ "$verbose" == "no" ] || printf "mount -o loop -t squashfs %s/%s.squashfs /%s\n" $SQFS/$DIR.squashfs /$DIR
             [ "$verbose" == "no" ] || printf "not enough space in RAM\n"
@@ -334,6 +334,7 @@
     quiet        ) export verbose="no"               ;;
     testiso      ) export verbose="yes"              ;;
     testinitrd   ) export verbose="yes"              ;;
+    toram        ) export toram="yes"                ;;
paul [ /ISO-NuTyX/lib/lsb ]$

Which basically means that if the toram parameter was not found on the kernel line, or if there is not enough memory available anymore, do like if there was not memory available anymore. Which might be a bit confusing to the one that read boot messages, because it can falsely say that there is no memory left, when the toram option is/was passed.

After modifying that file it is important to regenerate the initrd file with:
Code: [Select]
mkinitramfs `basename /lib/modules/*` -nf
So after that you regenerate the squashfs files, exit the nutyx -ec (enter chroot), then #bash $NUTYX_TMP/scripts/mkiso to redo a new iso file that you will find in $LFS.
« Last Edit: Sun Dec 01 22:23:32 2019 by dufresnep »


  • Administrator
  • Hero Member
  • *****
  • Posts: 706
  • Karma: +13/-0
  • Gender: Male
    • NuTyX distribution
Thanks for initiating the idea, I commit it:

This functionnality should be available in NuTyX 11.3.