Skip to content

Instantly share code, notes, and snippets.

@noslin005
Last active December 2, 2023 06:41
Show Gist options
  • Save noslin005/686af3db7cc9ebdea1b401065b802bad to your computer and use it in GitHub Desktop.
Save noslin005/686af3db7cc9ebdea1b401065b802bad to your computer and use it in GitHub Desktop.
Remastering grml

Re-mastering GRML 2018.12 Small

Nilson Lopes | Thursday, March 12, 2020

It is recommended that you use grml-live to build your own disc.

  • Loop mount the ISO image:
├── iso      	<-- mount the original iso here
├── remaster 	<-- folder with files for the new iso
├── squashmount <-- mount the original grml64-small.squashfs
└── target		<-- build enviroment (chroot)

mkdir -p GRML/iso

cd GRML
mount -o loop /path/to/grml.iso iso/*
  • Create a local build directory excluding the original squashfs image - we'll create our own in a moment:
mkdir -p remaster
rsync -av --exclude=live/grml64-small/grml64-small.squashfs iso/ remaster/
  • Loop mount the squash image itself:
mkdir -p squashmount target
mount -o loop -t squashfs iso/live/grml64-small/grml64-small.squashfs squashmount/
cp -a squashmount/* target
umount squashmount
  • chroot to the the new build environment, complete at this point:
mount -o bind /proc target/proc
mount -o bind /dev target/dev
mount -o bind /dev/pts target/dev/pts
mount -o bind /sys  target/sys

rm -rf target/etc/resolv.conf
cat /etc/resolv.conf > target/etc/resolv.conf

chroot ~/GRML/target /usr/bin/zsh
  • Change the debian apt source.list (optional)
vim /etc/apt/sources.list.d/debian.list

deb http://deb.debian.org/debian buster main contrib non-free
deb-src http://deb.debian.org/debian buster main contrib non-free

deb http://deb.debian.org/debian-security/ buster/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ buster/updates main contrib non-free

deb http://deb.debian.org/debian buster-updates main contrib non-free
deb-src http://deb.debian.org/debian buster-updates main contrib non-free
  • Update and install all desired packages
apt-get update
apt-get install BLAH BLAH BLAH
apt-get clean
  • Locales (optional)
vim /etc/locale.gen 
apt-get install locales localepurge
localegen
localepurge
  • Create a new package list from chroot
cd ~
dpkg -l > packages.txt

# The new package list lives in target/root
  • Important that you umount /proc, /sys, /dev and /dev/pts
exit 
# make sure you're not in the chroot enviroment
for i in proc sys dev dev/pts; do umount ~/GRML/target/${i}; done
  • Add the packages to build
mv target/root/packages.txt remaster/GRML/grml64-small/packages.txt
  • Add your custom squashfs image to the build:
mksquashfs ./target grml64-small.squashfs -b 1048576 -comp xz -Xdict-size 100% 

cp grml64-small.squashfs remaster/live/grml64-small/grml64-small.squashfs
  • Update the md5sum database
# update grml64-small.squashfs md5sum
md5sum remaster/live/grml64-small/grml64-small.squashfs
chmod 755 remaster/GRML/grml64-small/md5sums
vim remaster/GRML/grml64-small/md5sums
<PASTE THE NEW MD5SUM HERE> ../live/grml64-small/grml64-small.squashfs
chmod 644 remaster/GRML/grml64-small/md5sums

# update packages.txt md5sum
md5sum remaster/GRML/grml64-small/packages.txt
chmod 755 remaster/GRML/grml64-small/packages.txt
vim remaster/GRML/grml64-small/packages.txt
<PASTE THE NEW MD5SUM HERE> ../GRML/grml64-small/packages.txt
chmod 644 remaster/GRML/grml64-small/packages.txt 
  • Make the new ISO image:
mkisofs -pad -l -r -J -v -V "grml-2020.03.12-remastered" -no-emul-boot -boot-load-size 4 -boot-info-table -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat -hide-rr-moved -o grml-2020.03.12-remastered.iso ./remaster
  • Test the new ISO
qemu-system-x86_64 -cdrom grml-2020.03.12-remastered.iso -boot b  -m 1024 -enable-kvm

References:

  1. http://glenngreenfield.blogspot.com/2010/05/remastering-grml.html
  2. https://techoverflow.net/2013/01/11/creating-a-highly-compressed-squashfs-from-a-folder/
  3. https://wiki.n0r1sk.com/index.php/Debian_Remaster_Netinstaller_-_Integrate_Firmware_bnx2x_and_Preseed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment