Skip to main content

BlissOSx86 - Unpacking & Repacking ISO

Every ISO modification begins with a clean extraction. Whether you're replacing the kernel or applying a low-level patch to the system image.

Updated 2 min readMarkdown
Part of seriesBlissOS x86

This is a quick guide to the full round trip:

  • extract a bootable ISO
  • unpack compressed system image
  • apply modifications
  • repack it back into a bootable ISO.

1. Prerequisites

Make sure you have the following packages installed:

  1. p7zip - extracting iso
  2. squashfs-tools / erofs-utils - unpacking system image
  3. genisoimage - creating iso

2. Extract ISO contents

7z x <ISO_PATH>.iso -oextracted

3. Unpack system image

Depending on the build, you'll find either system.sfs (SquashFS) or system.efs (EROFS) inside the extracted folder.

3.1. Case A - system.sfs

3.1.1. Prerequisites

  • Make sure you have the squashfs-tools package installed.

3.1.2. Extract system image

mkdir -p system-root
sudo unsquashfs -d system-root extracted/system.sfs

3.2. Case B - system.efs

3.2.1 Prerequisites

  • Make sure you have the erofs-utils package installed.

3.2.2. Extract system image

mkdir -p system-root
sudo fsck.erofs --extract=system-root --preserve extracted/system.efs

4. Mount system image

Whatever case you dealt with will finally give you a system.img which we all were waiting for from the beginning.

mkdir -p system_mnt/
sudo mount -o loop system-root/system.img system_mnt/
馃帀

5. Unmount system image

Now that you are done modifying your system image, you need to unmount it to proceed further.

sudo umount system_mnt/
rm -rfd system_mnt/

6. Repack system image

Just like we faced two cases during unpacking, steps differ here also

6.1. Case A - system.sfs

  • Create the SquashFS file
sudo mksquashfs system-root extracted/system.sfs -comp zstd -noappend

6.2. Case B - system.efs

  • Create the EROFS file
sudo mkfs.erofs -z zlz4hc -C 65536 extracted/system.efs system-root

7. ISO Creation

The final step before creating the bootable ISO file of your own modified system!

7.1. Prerequisites

  • Make sure you have the genisoimage package installed.

7.2. Create ISO

mkisofs \
 -V "BlissOS-Custom" \
 -o BlissOS-Custom.iso \
 -b isolinux/isolinux.bin \
 -c isolinux/boot.cat \
 -boot-info-table \
 -boot-load-size 4 \
 -joliet-long \
 -no-emul-boot \
 -J \
 -l \
 -R \
 extracted/

About the author

No comments yet. Be the first to comment.

BlissOS x86

Part 1 of 1

A beginner friendly tutorial series of BlissOS x86 modification. Keeping usable after the project was halted.