| 1 | #use wml::emdebian::mainpage title="STAGE - Emdebian with scratchbox" |
|---|
| 2 | |
|---|
| 3 | <pre> |
|---|
| 4 | Embedded Debian build environment |
|---|
| 5 | |
|---|
| 6 | $Id$ |
|---|
| 7 | |
|---|
| 8 | --------------------------------- |
|---|
| 9 | Table of Contents |
|---|
| 10 | |
|---|
| 11 | 1. Introduction |
|---|
| 12 | |
|---|
| 13 | 2. Initial setup |
|---|
| 14 | |
|---|
| 15 | 2.1 Setting up scratchbox environment |
|---|
| 16 | 2.1.1 Installing scratchbox packages |
|---|
| 17 | 2.1.2 Creating new scratchbox target |
|---|
| 18 | 2.1.3 installing development rootstrap inside scratchobx |
|---|
| 19 | |
|---|
| 20 | 2.2 Svn source repository |
|---|
| 21 | 2.2.1 Repository location |
|---|
| 22 | 2.2.1 Repository layout |
|---|
| 23 | 2.2.2 How to check out stuff from repository |
|---|
| 24 | |
|---|
| 25 | 3. Building packages |
|---|
| 26 | |
|---|
| 27 | 4. Root filesystem creation |
|---|
| 28 | |
|---|
| 29 | 5. TODO list |
|---|
| 30 | |
|---|
| 31 | 6. References |
|---|
| 32 | |
|---|
| 33 | -------------------------------------------------------------------------------- |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | 1. Introduction |
|---|
| 37 | --------------- |
|---|
| 38 | |
|---|
| 39 | This scratchbox-based environment is intended for building emdebian [1] |
|---|
| 40 | packages. It uses scheme based on emdebian STAG framework ideas [2]. It can |
|---|
| 41 | also be used for making root filesystem images out of emdebian packages. |
|---|
| 42 | |
|---|
| 43 | This is an attempt to share Nokia experience of Nokia 770 development and |
|---|
| 44 | building bootable root filesystem images using emdebian packaging scheme. |
|---|
| 45 | |
|---|
| 46 | Embedded Debian(Emdebian) is a project to make Debian GNU/Linux a mainstream |
|---|
| 47 | choice for embedded projects. |
|---|
| 48 | |
|---|
| 49 | This was taken from emdebian website [4] as an explanation of one of the |
|---|
| 50 | project's ideas: "We need a scheme that allows emdebian to stay in sync with |
|---|
| 51 | Debian as much as possible, whilst having fine control over package generation. |
|---|
| 52 | To do this we need to keep emdebian package modifications in each package, |
|---|
| 53 | maintained by package maintainers as much as possible." [4] |
|---|
| 54 | |
|---|
| 55 | One of the implementation of this scheme is STAG embedded framework [2] The |
|---|
| 56 | idea is to have a separate emdebian directory included into debian source |
|---|
| 57 | package, i.e. to have a possibility to make both debian and emdebian packages |
|---|
| 58 | out of the same source package. STAG proposes patched version of dpkg and |
|---|
| 59 | debhelper packaging tools packages using emdebian directory instead of debian. |
|---|
| 60 | |
|---|
| 61 | This enviroment is used STAG ideas, but a bit different way. It also offered |
|---|
| 62 | patched debian packaging tools, but modifications allow developer to make both |
|---|
| 63 | emdebian and debian packages using the same tools. It can be done by changing |
|---|
| 64 | DEBIAN_DIR environment variable. Moreover, it's possible to have even more |
|---|
| 65 | debian-like directories and have more than one type of packages built from the |
|---|
| 66 | same sources. |
|---|
| 67 | |
|---|
| 68 | This implementation uses scratchbox as a cross-compilation environment. It |
|---|
| 69 | includes modified scratchbox, emdebian development rootstrap, set of about 40 |
|---|
| 70 | emdebianized debian packages and 3 root filesystems built out of these |
|---|
| 71 | packages: minimal, dpkg+apt, dpkg+apt+xserver. Rootfses have been tested on |
|---|
| 72 | Nokia 770 device. Only basic tests like booting, ability to loging and get |
|---|
| 73 | working shell, working apt and dpkg and xserver depending on image. |
|---|
| 74 | |
|---|
| 75 | Project infrastructure includes svn source repository, debian package |
|---|
| 76 | repository filled by emdebianized packages and downloadable rootfs and |
|---|
| 77 | rootsrtap images. |
|---|
| 78 | |
|---|
| 79 | Please note that this is a work in progress and any kind of |
|---|
| 80 | help/feedback/suggestionsfrom emdebian developers is more than welcome. If |
|---|
| 81 | you're interested in this you can look at the TODO list at the end of this |
|---|
| 82 | document. |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | 2. Initial setup |
|---|
| 86 | ---------------- |
|---|
| 87 | |
|---|
| 88 | First of all it's assumed that you have Debian installalled on your PC. This |
|---|
| 89 | is a requirement. At least all this environment was developed and tested on |
|---|
| 90 | Debian. |
|---|
| 91 | |
|---|
| 92 | All you need for building is to install and configure scratchbox environment, |
|---|
| 93 | configure scratchobox target, install development rootstrap into this target. |
|---|
| 94 | Below is explanations of the setup in details. |
|---|
| 95 | |
|---|
| 96 | 2.1 Setting up scratchbox environment |
|---|
| 97 | ------------------------------------ |
|---|
| 98 | |
|---|
| 99 | 2.1.1 Installing scratchbox packages |
|---|
| 100 | |
|---|
| 101 | Add the following lines to your /etc/apt/sources.list: |
|---|
| 102 | |
|---|
| 103 | deb http://stage.maemo.org/ emdebian/tools glibc |
|---|
| 104 | deb-src http://stage.maemo.org/ emdebian/tools glibc |
|---|
| 105 | |
|---|
| 106 | And perform the command |
|---|
| 107 | |
|---|
| 108 | $ sudo apt-get update |
|---|
| 109 | |
|---|
| 110 | Install scratchbox [3] 0.9.8.5 packages modified for emdebian: |
|---|
| 111 | |
|---|
| 112 | $ sudo apt-get install scratchbox-core scratchbox-libs \ |
|---|
| 113 | scratchbox-devkit-debian scratchbox-doctools |
|---|
| 114 | |
|---|
| 115 | Install needed toolchains (you shouldn't install all of them, |
|---|
| 116 | just those that you're going to deal with): |
|---|
| 117 | |
|---|
| 118 | $ sudo apt-get install scratchbox-toolchain-arm-gcc3.4.cs-glibc \ |
|---|
| 119 | scratchbox-toolchain-i686-glibc \ |
|---|
| 120 | scratchbox-toolchain-arm-gcc3.4.cs-uclibc |
|---|
| 121 | |
|---|
| 122 | Note that toolchains have not been modified and can be |
|---|
| 123 | downloaded and installed from scratchbox site [3] |
|---|
| 124 | |
|---|
| 125 | Add scratchbox user(s): |
|---|
| 126 | $ sudo /scratchbox/sbin/sbox_adduser <username> |
|---|
| 127 | |
|---|
| 128 | 2.1.2 Creating new scratchbox target |
|---|
| 129 | |
|---|
| 130 | Run scratchbox: |
|---|
| 131 | $ scratchbox |
|---|
| 132 | |
|---|
| 133 | Create target (ct): |
|---|
| 134 | [sbox-HOST: ~] > sbox-config -ct <target_name> |
|---|
| 135 | |
|---|
| 136 | You'll be asked for the compiler number. |
|---|
| 137 | Choose arm-linux-gcc3.4.cs-glibc2.3 for arm-glibc target, |
|---|
| 138 | arm-linux-gcc3.4.cs-uclibc0.9.27 for arm-uclibc target and so on. |
|---|
| 139 | |
|---|
| 140 | Choose quemu-arm as a CPU-transparency method for arm target or |
|---|
| 141 | 'none' for i386 target. |
|---|
| 142 | |
|---|
| 143 | Choose debian devkit. |
|---|
| 144 | |
|---|
| 145 | select target you've just created: |
|---|
| 146 | [sbox-HOST: ~] > sbox-config -st <target_name> |
|---|
| 147 | |
|---|
| 148 | copy fakeroot and c libraries: |
|---|
| 149 | [sbox-target: ~] > sbox-config -cc |
|---|
| 150 | [sbox-target: ~] > sbox-config -cf |
|---|
| 151 | |
|---|
| 152 | 2.1.3 installing development rootstrap inside scratchobx: |
|---|
| 153 | |
|---|
| 154 | Run scratchbox if you're not inside it already: |
|---|
| 155 | |
|---|
| 156 | $ scratchbox |
|---|
| 157 | |
|---|
| 158 | Download rootstrap from stage.maemo.org: |
|---|
| 159 | |
|---|
| 160 | [sbox-target: ~] > wget http://stage.maemo.org/emdebian/configurations/arm-glibc-emdebian-dev/arm-glibc-emdebian-dev-rootstrap.tgz |
|---|
| 161 | |
|---|
| 162 | install rootstrap: |
|---|
| 163 | [sbox-target: ~] > sbox-config -er arm-glibc-emdebian-dev-rootstrap.tgz |
|---|
| 164 | |
|---|
| 165 | At this point environment is ready and you can start to build packages. |
|---|
| 166 | |
|---|
| 167 | 2.2 Svn source repository |
|---|
| 168 | ------------------------- |
|---|
| 169 | |
|---|
| 170 | Repository contains sources for emdebianized packages. There are about 40 |
|---|
| 171 | packages at the moment. |
|---|
| 172 | |
|---|
| 173 | Repostitory layout is according to svn-buildpackage recomendations |
|---|
| 174 | (see /usr/share/doc/svn-buildpackage/HOWTO.html/index.html) |
|---|
| 175 | |
|---|
| 176 | 2.2.1 Repository location |
|---|
| 177 | |
|---|
| 178 | https://stage.maemo.org/svn/emdebian/ |
|---|
| 179 | you should use guest/guest username/password for read-only access. |
|---|
| 180 | |
|---|
| 181 | 2.2.1 Repository layout |
|---|
| 182 | |
|---|
| 183 | target/trunk/<package> - source directories ready to be built using svn-buildpackage |
|---|
| 184 | ... (for packages which go to target root filesystem) |
|---|
| 185 | target/tags - directory for svn tags |
|---|
| 186 | target/branches - directory for branches |
|---|
| 187 | target/releases - directory for release tags |
|---|
| 188 | |
|---|
| 189 | tools/trunk/<package> - tools modified for emdebian usage (dbs,cdbs...) |
|---|
| 190 | ... |
|---|
| 191 | tools/{tags,branches,releases} - the same as for target |
|---|
| 192 | doc/ - documentation |
|---|
| 193 | configurations/<name> - rootfilesystem or scratchbox rootstap images and lists |
|---|
| 194 | name conventions for configurations is <arch>-<libc>-<name>-<type> |
|---|
| 195 | arch - architecture (arm,i385...) |
|---|
| 196 | libc - libc variant (glibc or uclibc) |
|---|
| 197 | name - name of configuration. Coudld be device-specific or usage-specific, |
|---|
| 198 | for example (nokia770 - for nokia 770 device) |
|---|
| 199 | type - image type (for example minimal,apt,dev) |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | 2.2.2 How to check out stuff from repository: |
|---|
| 203 | |
|---|
| 204 | Run scratchbox: |
|---|
| 205 | |
|---|
| 206 | $ scratchbox |
|---|
| 207 | |
|---|
| 208 | Check out the stuff: |
|---|
| 209 | |
|---|
| 210 | [sbox-target: ~] > svn co https://stage.maemo.org/svn/emdebian/ |
|---|
| 211 | |
|---|
| 212 | You should use 'guest/guest' as username/password |
|---|
| 213 | |
|---|
| 214 | You can also browse the repository through http whith your browser. |
|---|
| 215 | Just point browser to https://stage.maemo.org/svn/emdebian/. |
|---|
| 216 | |
|---|
| 217 | |
|---|
| 218 | 3. Building packages |
|---|
| 219 | -------------------- |
|---|
| 220 | |
|---|
| 221 | Run scratchbox: |
|---|
| 222 | $ scratchobox |
|---|
| 223 | |
|---|
| 224 | Set DEBIAN_DIR variable to 'emdebian'. After that packaging tools will be |
|---|
| 225 | using emdebian as a name for directory with packaging-relatet files |
|---|
| 226 | (control, rules, changelog etc.): |
|---|
| 227 | |
|---|
| 228 | [sbox-target: ~] > export DEBIAN_DIR=emdebian |
|---|
| 229 | |
|---|
| 230 | (you might want to add this line to your ~/.bashrc) |
|---|
| 231 | |
|---|
| 232 | Go to source directory for your package: |
|---|
| 233 | |
|---|
| 234 | [sbox-target: ~] > cd emdebian/target/trunk/<package> |
|---|
| 235 | |
|---|
| 236 | Build it using svn-buildpackage: |
|---|
| 237 | |
|---|
| 238 | [sbox-target: ~] > svn-buildpackage -rfakeroot -uc -us -sa -D |
|---|
| 239 | |
|---|
| 240 | You can start with already emdebianized packages from svn repository |
|---|
| 241 | discribed in section 2.2 of this document. |
|---|
| 242 | |
|---|
| 243 | 4. Root filesystem creation |
|---|
| 244 | --------------------------- |
|---|
| 245 | |
|---|
| 246 | 4.1 initial setup: |
|---|
| 247 | |
|---|
| 248 | Install rootimagescripts outside scratchbox: |
|---|
| 249 | |
|---|
| 250 | $ sudo apt-get install rootimagescripts |
|---|
| 251 | |
|---|
| 252 | 4.2 Rootstrap creation using emdebian package repository |
|---|
| 253 | |
|---|
| 254 | Run scratchbox: |
|---|
| 255 | |
|---|
| 256 | $ scratchbox |
|---|
| 257 | |
|---|
| 258 | Rootfs configurations are ready for build: |
|---|
| 259 | [sbox-target: ~] > cd emdebian/configurations/ |
|---|
| 260 | [sbox-target: ~] > make_rootimage.sh -p arm-glibc-nokia770-apt/packages \ |
|---|
| 261 | -o arm-glibc-nokia770-apt/arm-glibc-nokia770-apt \ |
|---|
| 262 | --jffs --rootfs --genlists -f |
|---|
| 263 | or |
|---|
| 264 | [sbox-target: ~] > make_rootimage.sh -p arm-glibc-nokia770-minimal/packages \ |
|---|
| 265 | -o arm-glibc-nokia770-minimal/arm-glibc-nokia770-minimal \ |
|---|
| 266 | --jffs --rootfs --genlists --strip=all -f |
|---|
| 267 | |
|---|
| 268 | 4.3 Rootstrap creation using local directory with packages |
|---|
| 269 | |
|---|
| 270 | $ scratchbox |
|---|
| 271 | [sbox-target: ~] > cd emdebian/configurations/ |
|---|
| 272 | |
|---|
| 273 | Make workarounds directory and put packages there: |
|---|
| 274 | |
|---|
| 275 | [sbox-target: ~] > mkdir workarounds |
|---|
| 276 | [sbox-target: ~] > cp *.deb workarounds/ |
|---|
| 277 | |
|---|
| 278 | Run make_rootimage.sh with necessary options. All packages |
|---|
| 279 | from workarounds directory will be installed on the target. |
|---|
| 280 | |
|---|
| 281 | 5. TODO list |
|---|
| 282 | ------------ |
|---|
| 283 | |
|---|
| 284 | o uclibc builds (arm and i386) |
|---|
| 285 | |
|---|
| 286 | o i386 glibc build (-dev rootstrap and rootfses) |
|---|
| 287 | |
|---|
| 288 | o build system |
|---|
| 289 | |
|---|
| 290 | o continue stripping unneeded binaries/libraries from packages |
|---|
| 291 | |
|---|
| 292 | o cleanup rootimage scripts |
|---|
| 293 | |
|---|
| 294 | o upgrade packages to upstrim(testing?) versions. |
|---|
| 295 | |
|---|
| 296 | o implement lintian check for emdebian packages |
|---|
| 297 | |
|---|
| 298 | |
|---|
| 299 | 6. References |
|---|
| 300 | ------------- |
|---|
| 301 | |
|---|
| 302 | [1] Emdebian home: http://emdebian.sourceforge.net/ |
|---|
| 303 | |
|---|
| 304 | [2] STAG embedded framework: http://stag.mind.be/ |
|---|
| 305 | |
|---|
| 306 | [3] Scratchbox http://www.scratchbox.org/ |
|---|
| 307 | |
|---|
| 308 | [4] Emdebian and Debian http://emdebian.sourceforge.net/emdebian/emdebian.html |
|---|
| 309 | </pre> |
|---|