This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
doc:howto:tce [2019/09/17 10:42] stefanbaur [Build system prerequisites for all variants] updated list of required, recommended and optional packages |
doc:howto:tce [2019/09/18 19:34] stefanbaur [Starting the Build] added some double quotes (stylefix) |
||
---|---|---|---|
Line 31: | Line 31: | ||
* We suggest leaving at least 4 GB of free disk space so the build won't abort due to insufficient disk space while packages are downloaded, unpacked and copied around. | * We suggest leaving at least 4 GB of free disk space so the build won't abort due to insufficient disk space while packages are downloaded, unpacked and copied around. | ||
* Make sure your package list is up to date by running: < | * Make sure your package list is up to date by running: < | ||
- | * Install the required package(s) by running: < | + | * Install the required package(s) by running: < |
* If you want to speed up subsequent builds, install the recommended package(s) by running: < | * If you want to speed up subsequent builds, install the recommended package(s) by running: < | ||
* If you want to be prepared to be able to cross-build across different architectures (e.g. building an ARM image on an Intel/AMD build host) - a feature coming soon - install the optional package(s) by running: < | * If you want to be prepared to be able to cross-build across different architectures (e.g. building an ARM image on an Intel/AMD build host) - a feature coming soon - install the optional package(s) by running: < | ||
Line 44: | Line 44: | ||
# we have a successful connect on port 3142, assume | # we have a successful connect on port 3142, assume | ||
# it's apt-cacher-ng and use it | # it's apt-cacher-ng and use it | ||
+ | # | ||
if nc -z 127.0.0.1 3142 ; then | if nc -z 127.0.0.1 3142 ; then | ||
- | export https_proxy=http:// | + | # bad idea with apt-cacher-ng, |
- | export http_proxy=http:// | + | # export https_proxy=http:// |
- | export ftp_proxy=http:// | + | # |
+ | # | ||
- | export LB_APT_FTP_PROXY=$ftp_proxy | + | |
- | export LB_APT_HTTP_PROXY=$http_proxy | + | export LB_APT_HTTP_PROXY=http:// |
fi | fi | ||
# Select ONE of the following git reposities | # Select ONE of the following git reposities | ||
# this one loosely corresponds to " | # this one loosely corresponds to " | ||
- | #export LBX2GO_CONFIG=' | + | # export LBX2GO_CONFIG=' |
# this one loosely corresponds to " | # this one loosely corresponds to " | ||
export LBX2GO_CONFIG=' | export LBX2GO_CONFIG=' | ||
Line 67: | Line 68: | ||
export LBX2GO_ARCH=' | export LBX2GO_ARCH=' | ||
# 32-Bit, larger memory footprint, but faster performance on i686 and newer | # 32-Bit, larger memory footprint, but faster performance on i686 and newer | ||
- | #export LBX2GO_ARCH=' | + | # export LBX2GO_ARCH=' |
# 32-Bit, smallest memory footprint - not available on buster | # 32-Bit, smallest memory footprint - not available on buster | ||
# export LBX2GO_ARCH=' | # export LBX2GO_ARCH=' | ||
+ | # EXPERIMENTAL: | ||
+ | # export LBX2GO_ARCH=' | ||
+ | # Note that ARM builds are currently not working, at least not on the Pi. | ||
# If you want to use the stock ISO image as created by this script, add your boot parameters here | # If you want to use the stock ISO image as created by this script, add your boot parameters here | ||
- | #export LBX2GO_BOOTAPPEND_LIVE=" | + | # export LBX2GO_BOOTAPPEND_LIVE=" |
# detect if the selected git repo is meant to build a buster, stretch or jessie image | # detect if the selected git repo is meant to build a buster, stretch or jessie image | ||
if [ -z " | if [ -z " | ||
- | | + | |
- | export LBX2GO_BOOTAPPEND_LIVE+=" | + | export LBX2GO_BOOTAPPEND_LIVE+=" |
elif [ -z " | elif [ -z " | ||
- | | + | |
- | export LBX2GO_BOOTAPPEND_LIVE+=" | + | export LBX2GO_BOOTAPPEND_LIVE+=" |
else | else | ||
- | | + | |
fi | fi | ||
# newer versions of live-build use the plural form of this parameter | # newer versions of live-build use the plural form of this parameter | ||
if $(LANG=C lb config --help | grep -q bootloaders) ; then | if $(LANG=C lb config --help | grep -q bootloaders) ; then | ||
- | | + | |
else | else | ||
- | | + | |
fi | fi | ||
# set boot loader type - leave this unchanged unless you really know what you're doing | # set boot loader type - leave this unchanged unless you really know what you're doing | ||
- | export LBX2GO_BOOTLOADER=" | + | if echo $LBX2GO_ARCH | awk ' |
+ | # This is part of our experimental ARM support | ||
+ | LBX2GO_BOOTLOADERPARAMNAME=" | ||
+ | LBX2GO_BOOTLOADER=" | ||
+ | else | ||
+ | | ||
+ | fi | ||
# These options are meant to reduce the image size. | # These options are meant to reduce the image size. | ||
Line 127: | Line 137: | ||
--distribution $LBX2GO_DEBVERSION" | --distribution $LBX2GO_DEBVERSION" | ||
+ | # This is part of our experimental ARM support | ||
+ | if echo " | ||
+ | export LBX2GO_DEFAULTS+=" | ||
+ | --bootstrap-qemu-static / | ||
+ | fi | ||
export LBX2GO_ARCHIVE_AREAS=" | export LBX2GO_ARCHIVE_AREAS=" | ||
# This is for minidesktop builds and currently only adds firefox-esr language packs | # This is for minidesktop builds and currently only adds firefox-esr language packs | ||
- | #export LBX2GO_LANG=' | + | # export LBX2GO_LANG=' |
# This is to optimize squashfs size, based on a suggestion by intrigeri from the TAILS team | # This is to optimize squashfs size, based on a suggestion by intrigeri from the TAILS team | ||
Line 144: | Line 159: | ||
# This patches the squashfs file into the initrd. Only parsed when image type " | # This patches the squashfs file into the initrd. Only parsed when image type " | ||
# Will require boot parameter live-media=/ | # Will require boot parameter live-media=/ | ||
- | # Both TFTP client and TFTP server must support file transfers >32MB for this to work, if you want to deploy this initrd via TFTP, | + | # Both TFTP client and TFTP server must support file transfers >32MB for this to work, if you want to deploy this initrd via TFTP, |
# so e.g. atftpd will not work - tftpd-hpa, however, seems to have no problem with larger files. | # so e.g. atftpd will not work - tftpd-hpa, however, seems to have no problem with larger files. | ||
# When using iPXE, you can use http instead of TFTP. | # When using iPXE, you can use http instead of TFTP. | ||
Line 154: | Line 169: | ||
# export LBX2GO_IMAGETYPE=' | # export LBX2GO_IMAGETYPE=' | ||
# to create an iso image that can also be dd'ed to USB media: | # to create an iso image that can also be dd'ed to USB media: | ||
- | #export LBX2GO_IMAGETYPE=' | + | # export LBX2GO_IMAGETYPE=' |
# to create a netboot-image: | # to create a netboot-image: | ||
export LBX2GO_IMAGETYPE=' | export LBX2GO_IMAGETYPE=' | ||
Line 193: | Line 208: | ||
# Set Directory name | # Set Directory name | ||
- | LBX2GO_TCEDIR=" | + | LBX2GO_TCEDIR=" |
if [ -z " | if [ -z " | ||
Line 242: | Line 257: | ||
if [ -f config/ | if [ -f config/ | ||
if [ -n " | if [ -n " | ||
- | for LBX2GO_SINGLE_LANG in $(echo $LBX2GO_LANG | tr ';' | + | for LBX2GO_SINGLE_LANG in $(echo |
echo "LANG: ' | echo "LANG: ' | ||
sed -i -e ' | sed -i -e ' | ||
Line 260: | Line 275: | ||
chmod 755 ./ | chmod 755 ./ | ||
fi | fi | ||
+ | |||
+ | if [ -n " | ||
+ | echo " | ||
+ | echo " | ||
+ | echo " | ||
+ | # Here, we should have reached a point where it is safe to point all proxy variables | ||
+ | # at the apt-cacher-ng proxy. | ||
+ | # at files not being downloaded, disable these three entries. | ||
+ | export https_proxy=$LB_APT_HTTP_PROXY | ||
+ | export http_proxy=$LB_APT_HTTP_PROXY | ||
+ | export ftp_proxy=$LB_APT_FTP_PROXY | ||
+ | fi | ||
+ | |||
+ | # This is a crude hack to detect crossbuilds for ARM on Intel/AMD hardware. | ||
+ | # It makes some necessary changes, and also tries to speed up squashfs creation. | ||
+ | if (uname -r | grep -q ' | ||
+ | echo " | ||
+ | |||
+ | # This command removes all references to fuseext and x2gothinclient from the | ||
+ | # package list files. | ||
+ | echo " | ||
+ | sed -e ' | ||
+ | |||
+ | # This command removes the X2Go repository from the directory where additional | ||
+ | # archives are stored. | ||
+ | # packages, but Debian Buster does - so that's what we're falling back to. | ||
+ | echo " | ||
+ | rm ./ | ||
+ | |||
+ | # The following is a hack to reduce squashfs creation time. We're replacing mksquashfs | ||
+ | # in the changeroot environment with a wrapper script that drops the original | ||
+ | # mksquashfs call into a file. | ||
+ | |||
+ | # We need to do this as a background task, waiting for the mksquashfs executable to | ||
+ | # appear in the changeroot; as the changeroot will only be created later on, once | ||
+ | # lb build is called. | ||
+ | | ||
+ | # The other background task waits until the command file has been created, then | ||
+ | # it applies some necessary patches to it, and starts the mksquashfs command natively | ||
+ | # on the build host, rather than in the changeroot environment. | ||
+ | # This is because in the changeroot, we'd be running the ARM mksquashfs in a qemu | ||
+ | # software emulation of the ARM architecture, | ||
+ | # native, raw CPU power and cores available to us. | ||
+ | |||
+ | # To make sure we don't have any lingering processes in the background, we're passing | ||
+ | # our own PID along to the background tasks, and tell them to terminate if our PID | ||
+ | # disappears while they' | ||
+ | |||
+ | MASTERPID=$$ | ||
+ | |||
+ | # Replace mksquashfs in chroot with script | ||
+ | # (script will undo this upon completion) | ||
+ | ( | ||
+ | # wait until the chroot has been populated or until our parent process dies | ||
+ | while ! [ -x ./ | ||
+ | ps $MASTERPID >/ | ||
+ | sleep 1 | ||
+ | done | ||
+ | # make sure we don't overwrite the real executable if it has already been | ||
+ | # moved out of the way | ||
+ | if ! [ -x ./ | ||
+ | cp ./ | ||
+ | fi | ||
+ | echo '# | ||
+ | # log the name we've been called with and all parameters into this file | ||
+ | echo 'echo "$0 $@" >/ | ||
+ | # once the native mksquashfs is complete, we will remove this file | ||
+ | echo 'while [ -f / | ||
+ | echo ' | ||
+ | echo ' | ||
+ | # so let's wait until it has been removed before deleting ourselves ... | ||
+ | echo 'rm / | ||
+ | # ... and moving the real executable back into its place | ||
+ | echo 'mv / | ||
+ | chmod 755 ./ | ||
+ | ) & | ||
+ | |||
+ | # start the native mksquashfs after patching the parameters | ||
+ | ( | ||
+ | # wait until the trigger file has been created or until our parent process dies | ||
+ | while ! [ -f ./ | ||
+ | ps $MASTERPID >/ | ||
+ | sleep 1 | ||
+ | done | ||
+ | # using any of the available filters (x86, arm, armthumb) for the | ||
+ | # -Xbcj command results in an unusable squashfs on arm, so we drop the | ||
+ | # parameter completely if it's there. | ||
+ | # also, all absolute paths (detected by beginning with " /") need to be | ||
+ | # prefixed with " | ||
+ | # to look for the corresponding paths/ | ||
+ | sed -e 's/ -Xbcj x86/ /g' -e 's# /# ./ | ||
+ | ./ | ||
+ | # now let's make this executable | ||
+ | chmod 755 ./ | ||
+ | |||
+ | # we also need to add some more excludes because they shouldn' | ||
+ | # in the squashfs - no idea why we don't need them while inside the chroot ... | ||
+ | echo ' | ||
+ | echo ' | ||
+ | echo ' | ||
+ | # now let's execute the script and, if it terminates without an error, | ||
+ | # we'll move the newly created squashfs into the chroot where the chrooted | ||
+ | # mksquashfs command would have created it; if that worked as well, we'll | ||
+ | # remove the script file so our dummy mksquashfs inside the chroot knows | ||
+ | # it's time to terminate itself. | ||
+ | ./ | ||
+ | mv ./ | ||
+ | rm ./ | ||
+ | ) & | ||
+ | fi | ||
+ | |||
if lb build ; then | if lb build ; then | ||
echo -e "Build is done: ' | echo -e "Build is done: ' | ||
- | ln ./binary/live/vmlinuz ./ | + | ln $(realpath |
- | ln ./binary/live/initrd.img ./ | + | ln $(realpath |
ln ./ | ln ./ | ||
if [ " | if [ " | ||
- | ln ./ | + | ln ./ |
- | | + | |
fi | fi | ||
if [ " | if [ " | ||
Line 281: | Line 407: | ||
if [ " | if [ " | ||
genisoimage -o ./ | genisoimage -o ./ | ||
- | if [ -e ./ | + | if [ -e ./ |
- | ln ./ | + | ln ./ |
- | | + | |
- | elif [ -e ./ | + | elif [ -e ./ |
- | ln ./ | + | ln ./ |
- | | + | |
fi | fi | ||
mv ./ | mv ./ |