== Custom Gumstix Image == We can make a custom linaro-based image by creating either or both a 1. Hardware pack 2. Root file system The hardware pack is a tar.gz file containing bootloaders, a kernel, and as well as a few hardware specific packages. A root file system is, well, a Debian, plain ol' rootfs. Combining these two ingredients makes a bootable microSD card: $ linaro-media-create --rootfs ext3 --mmc /dev/mmcblk0 --dev overo --hwpack --binary -- or a qemu image -- $ linaro-media-create --hwpack-force-yes --image_file overo.img --dev overo --image_size 3G --swap_file 500 --hwpack --binary === HWPACK === At the top level, hardware packs (see https://wiki.linaro.org/HardwarePacks) are generated by the linaro-hwpack-create utility distributed as part of linaro-image-tools (sudo apt-get install linaro-image-tools). $ linaro-hwpack-create 0 The used to make Overo hwpacks is maintained in a Bazaar repository. $ bzr branch lp:~linaro-maintainers/linaro-images/hwpack.precise.linaro-overo Likely you're making a hardware pack because you want a custom u-boot or kernel. To include a custom debian in a hardware pack, use the '--local-deb' switch (unless you happen to have a debian repository or PPA in which to dump packages in which case add the source to the ). $ linaro-hwpack-create --local-deb --local-deb linaro-overo 0 === Making a U-Boot Debian === To create a Debian package, both the (upstream) source code and a suitable packaging files (the 'debian' directory) are needed. https://wiki.linaro.org/Boards/ST-Ericsson/Snowball/building_uboot offers a detailed summary. In short, you need both a u-boot git repo and a Bazaar packaging repository. ==== U-boot Git Repository ==== Linaro maintains two u-boot repositories but any u-boot git will work: * git://git.linaro.org/boot/u-boot-linaro-stable.git * git://git.linaro.org/boot/u-boot-linaro-next.git Build u-boot. $ make CROSS_COMPILE=arm-linux-gnueabi- omap3_overo The packaging scripts need a tarball of the u-boot sources to package. You can directly export a tarball directly from the git repository. $ git archive HEAD --prefix='u-boot/' | gzip > u-boot-linaro_2012.02.3.orig.tar.gz The file name 'u-boot-linaro_2012.02.3.orig.tar.gz' depends on the packaging scripts. Note: Equally, you can instead hack the packaging rules file to suck code directly from your git repository. ==== U-Boot Packaging Repository ==== First, grab the pre-existing packaging repository. $ bzr branch lp:u-boot-linaro Next, add a changelog entry. This adds your name to the debian/changlog file so the generated packages are signed with your GPG key. $ dch -i (increment...new section) $ dch -a (append...add to existing change) $ dch -r (change to released) The release version number in the changlog should match the version number found in the name of the source tarball. Now, from within the u-boot-linaro packaging repository, build the source package. $ bzr builddeb -S This generates sources packages in the parent directory. Make a new directory and build the binary packages $ cd .. $ dpkg-source -x *.dsc $ cd $ debuild -eCROSS_COMPILE=arm-linux-gnueabi- -b -aarmel -k$GPGKEY == Kernel == The kernel is regrettably tricky as it requires two debian packages: A) a package containing the kernel. Simple enough right? B) a meta-package that depends on the the kernel package. This way, the kernel package can't be apt-get autoremoved. == Kernel Package == Note, if you just want to test a kernel image on hardware, stop here and look at this page instead: https://wiki.linaro.org/Resources/HowTo/KernelDeploy To build a kernel debian: $ dch --changelog debian.linaro/changelog --package linux-omap3 -v 2.6.38-1002.4 $ fdr clean $ fdr updateconfigs $ debuild -eCROSS_COMPILE=arm-linux-gnueabi- -k$GPGKEY -b -aarmel On the target, # dpkg -i To build a kernel normally (https://wiki.linaro.org/Resources/HowTo/KernelDeploy): 1. Get a config from an existing build e.g.: $ scp root@overo.local:/media/rootfs/boot/config-2.6.38-1002-linaro-omap .config -- OR -- $ cat debian.linaro/config/config.common.ubuntu debian.linaro/config/armel/config.common.armel debian.linaro/config/armel/config.linaro-omap > .config 2. Build $ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage modules -j8 3. Install $ cp arch/arm/boot/uImage /media/boot/ $ make ARCH=arm INSTALL_MOD_PATH=/media/rootfs/ modules_install $ make ARCH=arm INSTALL_FW_PATH=/media/rootfs/ firmware_install 4. Run (at the u-boot prompt) # setenv loadbootscript '' # setenv console 'ttyO2,115200n8' # saveenv # run bootcmd 5. Generate an initramfs (from running target) # update-initramfs -c -k `uname -r` # mount /dev/mmcblk0p1 /mnt # mkimage -A arm -T ramdisk -C none -n "MY RAMDISK" -d /boot/initrd.img-`uname -r` /mnt/uInitrd (see https://wiki.linaro.org/Resources/HowTo/KernelDeviceTree for dtb) Like u-boot, you need the kernel source and some debian packaging. Fortunately, Linaro regularly packages these together: $ git clone git://git.linaro.org/ubuntu/linux-linaro-precise.git The debian.linaro directory contains all the debian magic that specifies the modules, abi, and the configuration file snippets that are concatenated to make the kernel configuration. Read this page twice: https://wiki.edubuntu.org/KernelTeam/KernelMaintenance The official procedure is https://wiki.linaro.org/Resources/HowTo/PackageYourOwnKernel but much of the work has been done already. Just setup with $ fdr clean $ fdr updateconfigs And then build: $ debuild -eCROSS_COMPILE=arm-linux-gnueabi- -b -aarmel -k$GPGKEY == Meta Kernel Package == This one is a little easier than the kernel. Simply clone and build... $ git clone git://git.linaro.org/people/jcrigby/ubuntu/linux-meta-linaro-natty.git $ make binary As you need to change the ABI etc., you'll want to modify the changelog. To build a meta-package, use $ dch --changelog meta-source/debian/changelog --package linux-meta-linaro -v 2.6.38.1002.4 $ make binary At this point, you have a custom u-boot, kernel and kernel meta package which can be specified as local-debs for linaro-hwpack-create. == RootFS == Traditionally, Debian root file systems have been built natively. The Live-Build tool can be used to create a custom root file system in a cross-build environment such as multistrap. The instructions here https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/LiveBuild summarize the process well. Package seeds are here: https://code.launchpad.net/linaro To customize the branding, modify these packages: * linaro-plymouth-theme-logo * linaro-overlay (firefox default page etc.) https://wiki.linaro.org/TomGall/HowToBrand == Entertaining Extras == To get the toolchain, $ sudo apt-get install gcc-arm-linux-gnueabi To build QEMU (http://wiki.gumstix.org/index.php?title=Overo_emulation_in_qemu): $ ./configure --target-list=arm-softmmu $ make -j8 Tell bzr who you are $ bzr whoami "Ash Charles " Add some handy stuff to .bash_aliases: alias fdr='fakeroot ./debian/rules' export DEBEMAIL="ashcharles@gmail.com" export DEBFULLNAME="Ash Charles" export GPGKEY="869D18EC" === Useful Links === * https://wiki.linaro.org/CategoryHowTo * https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/LiveBuild * https://wiki.linaro.org/Boards/ST-Ericsson/Snowball/building_uboot * http://wiki.gumstix.org/index.php?title=Overo_emulation_in_qemu