slitaz-doc-wiki-data view pages/en/devnotes/cook-flavor-from-scratch.txt @ rev 7

Add pages/en folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Feb 26 12:17:18 2011 +0000 (2011-02-26)
parents
children
line source
1 ====== Cook a flavor from scratch ======
3 ===== Introduction =====
5 Welcome to this howto! it's the base for a second scratchbook which explains how to recompile SliTaz entirely from scratch including the toolchain. All jobs will be done using tazwok-experimental (actually in Alpha state). Even if the scripts have some major issues, the steps explained here should do the job without too many problems. Please report any problems to the author (tazpkg info tazwok-experimental gives you my mail).
7 Having some knowledge about how the legacy SliTaz tools and basic commands work will help you to understand what's going on in this howto. However, simply copying/pasting the given command lines will probably work.
9 ==== Explanation ====
11 Tazwok now provides tools to cook the [[en:terms:W?&#wok|wok]] from scratch using a minimal chroot. You have to use a special version of the wok called wok-experimental. It contains the needed patches which should be applied on top of the cooking wok. Explanations about how to obtain the wok experimental are here: [[en:devnotes:prepare-experimental|Prepare experimental wok]].
13 **Tools needed**
14 * A functional cooking system (live or installed), you also can use the [[http://people.slitaz.org/~gokhlayeh/experimental/iso/slitaz-experimental-base.iso|slitaz-experimental-base]] ISO.
15 * tazwok-experimental-0.0.2, tazchroot-0.0.1 and libtaz-0.0.1. Note: installing tazwok-experimental removes tazwok legacy.
16 * An internet connection to download sources.
18 **Steps**
19 * Make the chroot (in this how-to we use the packages of the new toolchain from the experimental repository; but this should work with the cooking toolchain).
20 * Cook a temporary toolchain: it's a cross-compiled toolchain which will cook the "real" toolchain (the packaged one) without linking anything to the host system.
21 * Cook the definitive toolchain.
22 * Cook some of the other packages of one of the SliTaz flavors.
23 * Create the iso.
24 * Burn, boot & enjoy :).
27 ==== Install the tools ====
29 <note tip>Note: all the following commands should be executed as root. You don't have to add the experimental repository if you wish to use the cooking toolchain.</note>
31 Add the cooking-experimental repository as undigest:
32 <code>
33 tazpkg add-undigest experimental http://people.slitaz.org/~gokhlayeh/experimental/packages
34 </code>
36 Give it priority over the main repository:
37 <code>
38 echo experimental > /var/lib/tazpkg/priority
39 </code>
41 Install the cooking tools:
42 <code>
43 tazpkg get-install tazwok-experimental
44 tazpkg get-install tazchroot
45 </code>
47 ==== Cook toolchain ====
49 <note tip>The following command-lines work for a wok at: /home/slitaz/experimental/wok. If you put the wok elsewhere, you can use the option --SLITAZ_DIR=address; where the address is equivalent to /home/slitaz. This option must be used each time --SLITAZ_VERSION is used. You can also define SLITAZ_VERSION & SLITAZ_DIR globally using /etc/slitaz/slitaz.conf.</note>
51 Configure the //chroot//:
52 <code>
53 tazwok configure-chroot --SLITAZ_VERSION=experimental
54 </code>
56 If you have at least 1GB RAM free you can put the minimal chroot in RAM speeding-up the cooking process:
57 <code>
58 sed 's~chroot_dir=.*~chroot_dir=/tmp/chroot-experimental~' -i /home/slitaz/experimental/tazchroot.conf
59 </code>
61 All-in-one command to cook the toolchain packages:
62 <code>
63 tazwok cook-toolchain --SLITAZ_VERSION=experimental
64 </code>
66 At the end of this operation the chroot should be removed. If you have modified its address before, you have to do this manually:
67 <code>
68 rm -r /tmp/chroot-experimental
69 </code>
71 Toolchain packages are now ready to be used. They're actually are in the packages-incoming repository. If all was cooked fine it's possible to push them to the classical packages directory using:
72 <code>
73 tazwok check-incoming --SLITAZ_VERSION=experimental
74 </code>
76 You need to tell to tazpkg that you now have a local version of experimental:
77 <code>
78 # If you had already defined the experimental repository:
79 echo "/home/slitaz/experimental/packages" > /var/lib/tazpkg/undigest/experimental/mirror
80 tazpkg recharge
81 # Else:
82 tazpkg add-undigest experimental /home/slitaz/experimental/packages
83 echo experimental > /var/lib/tazpkg/priority
84 tazpkg recharge
85 </code>
87 Recook the toolchain packages except core (linux-api-headers/glibc/binutils/gcc) over themselves to consolidate it; in fact it's not really needed with an actual configuration but it's generally good to do to solve loop dependencies. It warrants consistency of the toolchain before and after an update of non-core toolchain packages. Note that core-toolchain should never be updated in this way - but by reusing the cook-toolchain script:
88 <code>
89 tazwok chroot --SLITAZ_VERSION=experimental
90 tazwok build-depends toolchain-cooklist | sed '1,/^gcc$/d' > /tmp/consolidate.list
91 tazwok cook-list /tmp/consolidate.list
92 rm /tmp/consolidate.list
93 </code>
95 As packages has been re-cooked, you have to update the packages repository once again:
96 <code>
97 tazwok check-incoming
98 </code>
100 Still in the chroot for the next step.
101 ==== Cook packages of a flavor ====
103 First you need data about cooking flavors:
104 <code>
105 cd /home/slitaz/experimental/flavors
106 hg clone http://hg.slitaz.org/flavors .
107 </code>
109 Generate the cooklist for a given flavor. Note: for the next step, use the chosen flavor name instead of FLAVOR in the command line:
110 <code>
111 tazwok gen-cooklist --list=/home/slitaz/experimental/flavors/FLAVOR/packages.list > /tmp/FLAVOR.list
112 </code>
114 This list contains some already cooked packages, remove them:
115 <code>
116 cat /tmp/FLAVOR.list | while read p; do
117 grep -q ^$p$ /home/slitaz/experimental/packages/packages.txt && \
118 sed "/^$p$/d" -i /tmp/FLAVOR.list
119 done
120 </code>
123 The cooklist is now ready to create the packages:
124 <code>
125 tazwok cook-list /tmp/FLAVOR.list
126 </code>
128 Update packages repository:
129 <code>
130 tazwok check-incoming
131 </code>
133 <note tip>You can repeat these steps each time you wish to add new packages to your repository.</note>
135 Still in chroot for the next step.
137 ==== Create the ISO ====
139 Actually tazlito uses /home/slitaz/flavors. Create a symbolic link:
140 <code>
141 ln -s /home/slitaz/experimental/flavors /home/slitaz
142 </code>
144 Set release as experimental for the future ISO:
145 <code>
146 cd /home/slitaz/flavors/FLAVOR
147 mkdir -p rootfs/etc
148 echo experimental > rootfs/etc/slitaz-release
149 </code>
151 Configure your ISO to use your local repository:
152 <code>
153 mkdir -p rootfs/var/lib/tazpkg
154 echo /home/slitaz/experimental/packages > rootfs/var/lib/tazpkg/mirror
155 </code>
157 Use tazwok-experimental instead of tazwok and add tazchroot:
158 <code>
159 sed 's/tazwok/tazwok-experimental/' -i packages.list
160 echo tazchroot >> packages.list
161 </code>
163 Pack FLAVOR:
164 <code>
165 tazlito pack-flavor FLAVOR
166 </code>
168 Get FLAVOR:
169 <code>
170 tazlito get-flavor FLAVOR
171 </code>
173 Generate ISO:
174 <code>
175 tazlito gen-distro
176 </code>
178 Save ISO in your home dir:
179 <code>
180 mv /home/slitaz/distro/slitaz-FLAVOR.iso /home/slitaz/distro/slitaz-FLAVOR.md5 /home/slitaz/experimental/iso
181 </code>
183 Exit chroot:
184 <code>
185 exit
186 </code>