Traduction souhaitée ! La traduction de cette page n'a pas encore été effectuée, elle apparait donc ici dans sa forme originale en anglais. La collaboration de traducteurs est la bienvenue ! Traduisez le texte de cette page puis envoyez-le à gobolinux-www AT lists.gobolinux.org et nous l'incluerons ici (en créditant son traducteur, bien entendu ! :-)).
Tweaking the GoboLinux LiveCD: a tutorial
This is a quick guide to the internals of how the GoboLinux Live CD is constructed. It will get you up to speed with the tools that build the CD, allowing you to make customizations. With this we hope to lower the entry barrier to potential contributors to the distro's development.
This tutorial assumes you're running a GoboLinux system, with the most recent version of the Scripts package installed. Your kernel needs to support UnionFS, SquashFS and CramFS. You also need the SquashFS-Tools installed. All of this is available from the GoboLinux repositories.
To get started, you need to install the BuildLiveCD package. You can install it by typing:
A number of other GoboLinux tools and packages will be involved in the process of building the CD, but this is the only one you need to install in your /Programs directory. We'll get to them in detail one by one, but here's an overview:
The CD mastering environment
Once you have BuildLiveCD installed in your system, you can set up the CD mastering environment. A single command creates the necessary directories and downloads all needed packages: UpdateEnvironment. Run it in an empty directory; in our examples we'll use /Depot/LiveCD.
mkdir /Depot/LiveCD cd /Depot/LiveCD UpdateEnvironment
Note that this will download hundreds of megabytes worth of packages, so this may take a while.
Building the CD
The whole process of building the CD is wrapped by the CompressAndBuildISO script. In your first run, you can simply call it with no parameters and it will go through the whole process:
The script is composed of a few stages -- when you make a modification that affects only one of the later stages, you can pass a parameter to have it skip the earlier ones, in order to save time. The stages are:
A walkthrough of the Live CD boot process
The CD bootloader
To be written
The InitRD environment
To be completed
The InitRD environment is a mini-GoboLinux system created by the MakeInitRDTree script, which was called when you run CompressAndBuildISO. You will find it at the Output/InitRD directory.
Do not modify Output/InitRD directly: its contents are rewritten when CompressAndBuildISO runs through the initrd step. To tweak the InitRD scripts, modify instead the local SVN copy of InitRDScripts, located at LocalSVN/tools/InitRDScripts.
Currently, this part of the build environment is not very friendly to customized versions. If you want to keep a custom version of the InitRD, you need to replace LocalSVN/InitRD with your own copy after running UpdateEnvironment.
At the end of the startGoboLinux script of the InitRDScripts package, the SquashFS images are mounted, the pivot operation to make it the root directory is performed and init is called to proceed with the boot process.
From there on, we're inside a GoboLinux system very much like the one that's installed in the hard disk. In fact, the same packages are used. When init runs, it calls the BootDriver from the BootScripts package. The BootDriver detects it is running from the Live CD, so instead of running its usual bootscripts, it calls the StartLiveCD script from the LiveCD package. That script is responsible for the rest of the initialization.
The SquashFS structure
The main LiveCD environment (i.e., the directory tree you see once the LiveCD booted) is stored as a series of SquashFS images. These images are built from two layers: one read-only layer that is the actual filesystem, (Programs, Files, System, etc.), and a read-write layer that sits on top for debugging purposes, containing assorted files that you may have created while logged in using ChrootEnvironment.
The main, first layer is generated at Output/ROLayer. This is built out of packages listed in Archives/Packages that are combined to build /Programs, additional files under Archives/Ext that are unpacked to their proper locations, plus a series of files and directories that are generated on-the-fly by the BuildRoot script. BuildRoot is called by CompressAndBuildISO during the rolayer step.
Keep in mind that when you make modifications that alter the LiveCD environment itself, you need to regenerate the SquashFS image. To do this, pass an additional parameter to CompressAndBuildISO: