Remaster Linux Mint .iso (for HP Mini 2140)

  13 years ago

Basically, all we do here is to

  • unpack the Linux Mint .iso file / cdrom,
  • update its contents,
  • add the bcmwl-kernel-source package (so that the wireless chipset used by the HP Mini 2140 can be used right from our new Live CD) and
  • put it all back together again.

During the 'Do your stuff' step you can install all the packages you'd like to use right away or purge packages you aren't likely to use anyway (I used nano as an example).

This guide was tested with the LinuxMint-8-RC1.iso but should work with any .iso / cdrom out there, just alter the bold parts.

Let's start!

Create working directories.

  1. mkdir mint{,/cdrom,/tmp,/root}

Mount the CD, or ISO or whatever (replace '../Downloads/LinuxMint-8-RC1.iso' accordingly) and copy the files to mint/image/ ...

  1. sudo su
  2. mount -o loop,ro ../Downloads/LinuxMint-8-RC1.iso mint/cdrom
  3. cp -r mint/cdrom/ mint/image/
  4. cd mint/

Move the filesystem.squashfs, mount it and rsync the rootfs to the remaster folder.

  1. mv image/casper/filesystem.squashfs tmp/
  2. mount -o loop tmp/filesystem.squashfs root/
  3. rsync -a root/ remaster/
  4. cp /etc/resolv.conf remaster/etc/

chroot magic ;)

  1. MOUNTS='proc sys dev'
  2. for i in $MOUNTS; do mount -o bind /${i} remaster/${i}; done
  3. chroot remaster /bin/bash
  4. mount -t devpts none /dev/pts

Do your stuff.
Install and build the broadcom driver (and lvm tools for anyone who installed Mint on an encrypted lvm on a netbook ...)

  1. apt-get update
  2. apt-get upgrade
  3. apt-get install bcmwl-kernel-source lvm2
  4. apt-get purge nano


  1. apt-get clean
  2. rm -rf /tmp/*
  3. rm /etc/resolv.conf
  4. umount /dev/pts
  5. exit

Detach mountpoints

  1. for i in $MOUNTS; do umount remaster/${i}; done

Rebuild rootfs squash image.

  1. mksquashfs remaster image/casper/filesystem.squashfs -e remaster/boot

Copy the new initramfs to your new image.

  1. cp remaster/boot/initrd.img-2.6.31-14-generic image/casper/initrd.gz

Update the manifest files ...

  1. chroot remaster dpkg-query -W --showformat='${Package} ${Version}\n' |tee image/casper/filesystem.manifest
  2. cp -v image/casper/filesystem.manifest{,-desktop}
  3. REMOVE='ubiquity casper live-initramfs user-setup discover xresprobe os-prober libdebian-installer4'
  4. for i in $REMOVE; do sed -i "/${i}/d" image/casper/filesystem.manifest-desktop; done

... and update the md5sum file.

  1. cd image && find . -type f ! -name 'md5sum.txt' -print0 |xargs -0 md5sum > md5sum.txt

Done! Build the new image ...

  1. mkisofs -r -V "Mint8-Remix" -cache-inodes -J -l -b isolinux/isolinux.bin -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table -o ../Mint8-HPMini-Remix.iso .

... and unmout cdrom and rootfs.

  1. cd ..
  2. umount cdrom/
  3. umount root/
  4. exit

Finally burn the new .iso file to CD / DVD or use it to create a bootable USB stick.

Gabor 10 years ago

Could we have an updated tutorial for this? I tried doing this with Maya and it broke.

bdheeman 13 years ago

Highly informative and accurate Mini-HOWTO, Tutorial or post.

It worked fine for LinuxMint 9 XFCE also, but I had to tweak around a few more things after 'apt-get update; apt-get-upgrade'

1) edit remaster/etc/casper.conf; change USERNAME and HOSTNAME to "mint"
2) zcat remaster/boot/initrd.img-2.6.32-21-generic |lzma -9 >image/casper/initrd.lz
3) cp -p image/casper/initrd.lz remaster/boot/initrd.img-2.6.32-21-generic

I think, the last 2 steps will save more disk/squashfs space.