Difference between revisions of "Remastering"

Finnix, the LiveCD for system administrators
Jump to navigation Jump to search
Line 6: Line 6:
 
1. Boot the Finnix CD.
 
1. Boot the Finnix CD.
  
2. Mount a disk to work within. For this guide, the mount point /finnix/build is assumed.  If you do not use /finnix/build, you will need to edit the build scripts later in this guide.
+
2. Mount a disk to work within. For this guide, the mount point /srv/finnix/build is assumed.  If you do not use /srv/finnix/build, you will need to edit the build scripts later in this guide.
 
<pre>
 
<pre>
(finnix)# mkdir -p /finnix/build
+
(finnix)# mkdir -p /srv/finnix/build
(finnix)# mount /dev/sdaX /finnix/build
+
(finnix)# mount /dev/sdaX /srv/finnix/build
 
</pre>
 
</pre>
 
The disk's file system must be a POSIX filesystem (ext2/3/4, xfs, jfs, etc).
 
The disk's file system must be a POSIX filesystem (ext2/3/4, xfs, jfs, etc).
Line 15: Line 15:
 
3. Create the necessary filesystem layout for this guide.
 
3. Create the necessary filesystem layout for this guide.
 
<pre>
 
<pre>
(finnix)# mkdir -p /finnix/build/master
+
(finnix)# mkdir -p /srv/finnix/build/master
(finnix)# mkdir -p /finnix/build/source/FINNIX
+
(finnix)# mkdir -p /srv/finnix/build/source/FINNIX
 
</pre>
 
</pre>
  
4. Copy the contents of /cdrom to /finnix/build/master.
+
4. Copy the contents of /cdrom to /srv/finnix/build/master.
 
<pre>
 
<pre>
(finnix)# cp -a /cdrom/* /finnix/build/master/
+
(finnix)# cp -a /cdrom/* /srv/finnix/build/master/
 
</pre>
 
</pre>
  
5. Copy the contents of /FINNIX (which is a mounted squashfs filesystem) to /finnix/build/source/FINNIX.  Remember that POSIX filesystems are case sensitive, so /FINNIX and /finnix are two separate directories.
+
5. Copy the contents of /FINNIX (which is a mounted squashfs filesystem) to /srv/finnix/build/source/FINNIX.  Remember that POSIX filesystems are case sensitive, so /FINNIX and /finnix are two separate directories.
 
<pre>
 
<pre>
(finnix)# cp -a /FINNIX/* /finnix/build/source/FINNIX/
+
(finnix)# cp -a /FINNIX/* /srv/finnix/build/source/FINNIX/
 
</pre>
 
</pre>
  
Line 35: Line 35:
 
x86:
 
x86:
 
<pre>
 
<pre>
(finnix)# mkdir -p /finnix/build/initrd
+
(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /finnix/build/initrd
+
(finnix)# cd /srv/finnix/build/initrd
 
(finnix)# gunzip -c /cdrom/isolinux/initrd.gz | cpio -idm
 
(finnix)# gunzip -c /cdrom/isolinux/initrd.gz | cpio -idm
 
</pre>
 
</pre>
Line 42: Line 42:
 
PPC:
 
PPC:
 
<pre>
 
<pre>
(finnix)# mkdir -p /finnix/build/initrd
+
(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /finnix/build/initrd
+
(finnix)# cd /srv/finnix/build/initrd
 
(finnix)# gunzip -c /cdrom/boot/initrd.gz | cpio -idm
 
(finnix)# gunzip -c /cdrom/boot/initrd.gz | cpio -idm
 
</pre>
 
</pre>
Line 51: Line 51:
 
x86:
 
x86:
 
<pre>
 
<pre>
(finnix)# mkdir -p /finnix/build/initrd
+
(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /finnix/build/initrd
+
(finnix)# cd /srv/finnix/build/initrd
 
(finnix)# xz -dc /cdrom/isolinux/initrd.xz | cpio -idm  
 
(finnix)# xz -dc /cdrom/isolinux/initrd.xz | cpio -idm  
 
</pre>
 
</pre>
Line 58: Line 58:
 
PPC:
 
PPC:
 
<pre>
 
<pre>
(finnix)# mkdir -p /finnix/build/initrd
+
(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /finnix/build/initrd
+
(finnix)# cd /srv/finnix/build/initrd
 
(finnix)# xz -dc /cdrom/boot/initrd.xz | cpio -idm  
 
(finnix)# xz -dc /cdrom/boot/initrd.xz | cpio -idm  
 
</pre>
 
</pre>
Line 66: Line 66:
 
<pre>
 
<pre>
 
(finnix)# export FINNIXDEV=1
 
(finnix)# export FINNIXDEV=1
(finnix)# chroot /finnix/build/source/FINNIX /bin/bash -l
+
(finnix)# chroot /srv/finnix/build/source/FINNIX /bin/bash -l
 
</pre>
 
</pre>
  
Line 82: Line 82:
 
Beware, the scripts can be somewhat destructive to 3rd-party modifications. To save space, many files in the chroot are automatically removed if found.  For example, the contents of /usr/share/doc and /root are completely deleted.  Again be sure to review the scripts, and have proper backups.
 
Beware, the scripts can be somewhat destructive to 3rd-party modifications. To save space, many files in the chroot are automatically removed if found.  For example, the contents of /usr/share/doc and /root are completely deleted.  Again be sure to review the scripts, and have proper backups.
 
<pre>
 
<pre>
(finnix)# /finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
+
(finnix)# /srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
(finnix)# /finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2
+
(finnix)# /srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2
 
</pre>
 
</pre>
  
 
Again, while the scripts are within the chroot, they must both be executed outside of the chroot.  For simplicity, I like assigning aliases:
 
Again, while the scripts are within the chroot, they must both be executed outside of the chroot.  For simplicity, I like assigning aliases:
 
<pre>
 
<pre>
(finnix)# alias stage1=/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
+
(finnix)# alias stage1=/srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
(finnix)# alias stage2=/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2
+
(finnix)# alias stage2=/srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2
 
(finnix)# stage1 && stage2
 
(finnix)# stage1 && stage2
 
</pre>
 
</pre>
  
If all goes well, you should have a file named /finnix/build/finnix.iso (or /finnix/build/finnix-ppc.iso). Burn it, test it and enjoy!
+
If all goes well, you should have a file named /srv/finnix/build/finnix.iso (or /srv/finnix/build/finnix-ppc.iso). Burn it, test it and enjoy!
  
 
==Modification ideas==
 
==Modification ideas==

Revision as of 19:04, 24 December 2012

Finnix-dev-machine.jpg

Warning: This guide is valid as of Finnix 101. Finnix 100 and earlier used a substantially different filesystem layout, and will not work with this guide.

Quick remaster guide

1. Boot the Finnix CD.

2. Mount a disk to work within. For this guide, the mount point /srv/finnix/build is assumed. If you do not use /srv/finnix/build, you will need to edit the build scripts later in this guide.

(finnix)# mkdir -p /srv/finnix/build
(finnix)# mount /dev/sdaX /srv/finnix/build

The disk's file system must be a POSIX filesystem (ext2/3/4, xfs, jfs, etc).

3. Create the necessary filesystem layout for this guide.

(finnix)# mkdir -p /srv/finnix/build/master
(finnix)# mkdir -p /srv/finnix/build/source/FINNIX

4. Copy the contents of /cdrom to /srv/finnix/build/master.

(finnix)# cp -a /cdrom/* /srv/finnix/build/master/

5. Copy the contents of /FINNIX (which is a mounted squashfs filesystem) to /srv/finnix/build/source/FINNIX. Remember that POSIX filesystems are case sensitive, so /FINNIX and /finnix are two separate directories.

(finnix)# cp -a /FINNIX/* /srv/finnix/build/source/FINNIX/

6. (Optional) If you plan on upgrading the kernel, you must extract the initrd.

Finnix 101

x86:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# gunzip -c /cdrom/isolinux/initrd.gz | cpio -idm

PPC:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# gunzip -c /cdrom/boot/initrd.gz | cpio -idm

Finnix 103

x86:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# xz -dc /cdrom/isolinux/initrd.xz | cpio -idm 

PPC:

(finnix)# mkdir -p /srv/finnix/build/initrd
(finnix)# cd /srv/finnix/build/initrd
(finnix)# xz -dc /cdrom/boot/initrd.xz | cpio -idm 

7. Chroot into the extracted Finnix filesystem. Setting FINNIXDEV=1 allows for some chroot-specific features to make, for example, dist-upgrading easier. In most cases, you do not need to mount /proc and /sys manually; the Finnix dev enironment should do it for you in many cases (during apt-get operations, for example).

(finnix)# export FINNIXDEV=1
(finnix)# chroot /srv/finnix/build/source/FINNIX /bin/bash -l

8. Now that you are chrooted, you can make your desired modifications. What you do now is up to you. For ideas, please see Modification Ideas below.

9. When you are finished, exit the chroot.

(chroot)# exit

10. Creating the squashfs filesystem and ISO are very easy, with the assistance of two helper scripts, finnix-build-stage1 and finnix-build-stage2. They're located within the chroot, but must be executed outside of the chroot.

Please review these build scripts! They are the same scripts used to create the main Finnix distribution, and have a couple extra features, such as updating the boot menu with the build tag. However, you do not need to worry about this, as they are only used by the scripts if necessary files are present. Likewise, the initrd will be re-created only if you extracted it in step 6.

Beware, the scripts can be somewhat destructive to 3rd-party modifications. To save space, many files in the chroot are automatically removed if found. For example, the contents of /usr/share/doc and /root are completely deleted. Again be sure to review the scripts, and have proper backups.

(finnix)# /srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
(finnix)# /srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2

Again, while the scripts are within the chroot, they must both be executed outside of the chroot. For simplicity, I like assigning aliases:

(finnix)# alias stage1=/srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage1
(finnix)# alias stage2=/srv/finnix/build/source/FINNIX/usr/sbin/finnix-build-stage2
(finnix)# stage1 && stage2

If all goes well, you should have a file named /srv/finnix/build/finnix.iso (or /srv/finnix/build/finnix-ppc.iso). Burn it, test it and enjoy!

Modification ideas

  • Add proprietary software that can't be included in free download, such as compression tools like rar. (Obviously, if you do this, you will not be able to release your modified copy to the public.)
  • Add software that is not included due to size reasons or because it is not needed often enough.
  • Update clamav's database for AV scans of systems with no internet connection.
  • Personalize your Finnix -- add boot messages and such to show that it is your personalized copy.