1 Catalyst is a release-buildcing tool for Gentoo. If you use Gentoo
2 and want to roll your own live CD or bootable USB stick, this is the
3 way to go. First, get a Gentoo development box and install the
6 # emerge -av dev-util/catalyst
8 Configure catalyst by editing `/etc/catalyst/catalyst.conf`, which is
9 well commented. This sets up defaults such as hashing algorithms and
10 storage directories. The defaults will probably be fine unless disk
13 Assembling a starting point
14 ---------------------------
19 Create a snapshot of your current Portage tree (you may want to
20 `emerge --sync` first):
22 # catalyst --snapshot 20130131
23 # ls /var/tmp/catalyst/snapshots/
24 portage-20130131.tar.bz2
25 portage-20130131.tar.bz2.CONTENTS
26 portage-20130131.tar.bz2.DIGESTS
28 where the storage location is relative to the default
29 `$storedir=/var/tmp/catalyst`.
34 Get a stage3 tarball (containing the build tools you'll need to
35 construct your stage1) from your local
36 http://www.gentoo.org/main/en/mirrors.xml[Gentoo mirror].
38 $GENTOO_MIRROR/releases/$ARCH/current-stage3/
42 http://distfiles.gentoo.org/releases/amd64/current-stage3/stage3-amd64-20121213.tar.bz2
44 Grab the tarball and put it where catalyst will find it:
46 # wget http://…/stage3-amd64-20121213.tar.bz2
47 # wget http://…/stage3-amd64-20121213.tar.bz2.CONTENTS
48 # wget http://…/stage3-amd64-20121213.tar.bz2.DIGESTS.asc
49 # sha512sum -c stage3-amd64-20121213.tar.bz2.DIGESTS.asc
50 # gpg --verify stage3-amd64-20121213.tar.bz2.DIGESTS.asc
51 # mv stage3-amd64-20121213.tar.bz2* /var/tmp/catalyst/builds/default/
53 where the storage dir is `$storedir/builds/$source_subpath`
54 (`$storedir` from `catalyst.conf`, `$source_subpath` from your
60 `.*spec` files tell catalyst about the system you're trying to build.
61 There are a number of examples distributed with catalyst. Look in
62 `/usr/share/doc/catalyst-*/examples/`. A minimal `*.spec` file for
65 # cat default-stage1-amd64-2013.1.spec
70 profile: default/linux/amd64/10.0/no-multilib
72 source_subpath: default/stage3-amd64-20121213
74 You may need to adjust the `subarch`, `snapshot`, and `source_subpath`
75 fields of the `*.spec` to match your target host, Portage snapshot,
76 and stage3 tarball name respectively.
78 For more details on what can go into a `*.spec` file, see
84 Now that everything's setup, run catalyst:
86 # catalyst -f default-stage1-amd64-2013.1.spec
88 which will build the target and install something like:
90 # ls /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.*
91 /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.tar.bz2
92 /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.tar.bz2.CONTENTS
93 /var/tmp/catalyst/builds/default/stage1-amd64-2013.1.tar.bz2.DIGESTS
95 The name is an expansion of
96 `$storedir/builds/$rel_type/$target-$subarch-$version_stamp…`.
98 Building stage2 and stage3
99 --------------------------
101 Once you've built the stage1 from your seed stage3, you can use that
102 stage1 to build a stage2 and stage3. The `*.spec` files are similar:
104 $ diff -u default-stage{1,2}-amd64-2013.1.spec
105 --- default-stage1-amd64-2013.1.spec
106 +++ default-stage2-amd64-2013.1.spec
109 version_stamp: 2013.1
113 profile: default/linux/amd64/10.0/no-multilib
115 -source_subpath: default/stage3-amd64-20121213
116 +source_subpath: default/stage1-amd64-2013.1
117 $ diff default-stage{2,3}-amd64-2013.1.spec
118 --- default-stage2-amd64-2013.1.spec
119 +++ default-stage3-amd64-2013.1.spec
122 version_stamp: 2013.1
126 profile: default/linux/amd64/10.0/no-multilib
128 -source_subpath: default/stage1-amd64-2013.1
129 +source_subpath: default/stage2-amd64-2013.1
134 You can't compile a big pile of source code without an already
135 compiled toolchain, which is where Gentoo's stages come in. The “base
136 system” contains the necessary build tools and supporting
137 infrastructure to get things going. The stages are:
139 1. System must be bootstrapped and the base system must be compiled
140 (a new toolchain built with external seed tools).
141 2. Stage1 + bootstrapped (a new toolchain build with stage1 tools).
142 3. Stage2 + base system compiled (the base system built with stage2 tools).
143 4. Stage3 + non-base packages.
145 For more details on the differences between the stages, look at the
146 target helper scripts (e.g. `targets/stage1/*.sh`).
148 Building with a kernel
149 ----------------------
151 If you're shooting for a live CD or bootable USB stick, you'll need to
152 compile your own kernel. Here's how that works.
157 When you don't know exactly which kernel options you need, add
158 something like the following to your `*.spec`:
161 boot/kernel/gentoo/sources: gentoo-sources
163 You can still set `boot/kernel/<label>/config` when you're using
164 genkernel if you want to give genkernel some hints.
166 Genkernel alternatives
167 ~~~~~~~~~~~~~~~~~~~~~~
169 If you don't want to use a genkernel, your options are fairly limited.
170 The currently suggested route is to create your own binary kernel
176 `examples/stage4_template.spec` is a good template for building a
177 stage4 tarball. Besides setting `target: stage4` and adjusting
178 `source_subpath`, I usually use `stage4/packages`, `stage4/rcadd`, and
179 the `boot/kernel` stuff described above. This gives an almost
180 bootable stage that you can dump on a USB flash drive.
185 Live CDs should be built in two stages: `livecd-stage1` (based on a
186 stage3 source) for building extra packages (along the same lines as a
187 stage4) and `livecd-stage2` (based on `livecd-stage1`) for setting up
188 the kernel, bootloader, filesystem, and other details. See
189 `examples/livecd-stage*_template.spec` for some ideas.
194 The easiest way to create a live USB is currently to install a live CD
196 http://www.syslinux.org/wiki/index.php/Doc/isolinux#HYBRID_CD-ROM.2FHARD_DISK_MODE[isohybrid]
199 # isohybrid filename.iso
200 # dd if=filename.iso of=/dev/sdX
202 replacing `X` with the appropriate drive letter for your USB disk.
203 See https://bugs.gentoo.org/show_bug.cgi?id=251719[bug 251719] for
206 Running catalyst from a Git checkout
207 ------------------------------------
209 If you're developing catalyst, you'll want to test your altered
210 version. An easy way to run it without reinstalling is to setup a
211 local configuration file and run:
213 # ./catalyst -c catalyst.conf -f path/to/your.spec
215 The local configuration file can use all the defaults except for
216 `sharedir`, which you should change to point to your development
219 sharedir="/home/wking/src/catalyst"