~vcs-imports/ipfire/ipfire-2.x

« back to all changes in this revision

Viewing changes to make.sh

  • Committer: Michael Tremer
  • Date: 2024-07-22 15:21:20 UTC
  • Revision ID: git-v1:dd813c6bc889fb7eca4340401e609877c183e42a
make.sh: Explicitely download packages when building the toolchain

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
###############################################################################
3
3
#                                                                             #
4
4
# IPFire.org - A linux based firewall                                         #
5
 
# Copyright (C) 2007-2023  IPFire Team  <info@ipfire.org>                     #
 
5
# Copyright (C) 2007-2024  IPFire Team  <info@ipfire.org>                     #
6
6
#                                                                             #
7
7
# This program is free software: you can redistribute it and/or modify        #
8
8
# it under the terms of the GNU General Public License as published by        #
22
22
NAME="IPFire"                                                   # Software name
23
23
SNAME="ipfire"                                                  # Short name
24
24
# If you update the version don't forget to update backupiso and add it to core update
25
 
VERSION="2.27"                                                  # Version number
26
 
CORE="181"                                                      # Core Level (Filename)
 
25
VERSION="2.29"                                                  # Version number
 
26
CORE="187"                                                      # Core Level (Filename)
27
27
SLOGAN="www.ipfire.org"                                         # Software slogan
28
28
CONFIG_ROOT=/var/ipfire                                         # Configuration rootdir
29
 
MAX_RETRIES=1                                                   # prefetch/check loop
30
 
BUILD_IMAGES=1                                                  # Flash and Xen Downloader
31
29
KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
32
30
 
33
31
# Information from Git
35
33
GIT_TAG="$(git tag | tail -1)"                                  # Git Tag
36
34
GIT_LASTCOMMIT="$(git rev-parse --verify HEAD)"                 # Last commit
37
35
 
38
 
TOOLCHAINVER=20230731
 
36
TOOLCHAINVER=20240521
39
37
 
40
38
# use multicore and max compression
41
39
ZSTD_OPT="-T0 --ultra -22"
46
44
#
47
45
###############################################################################
48
46
 
 
47
LC_ALL=POSIX
 
48
PS1='\u:\w$ '
 
49
 
49
50
# Remember if the shell is interactive or not
50
51
if [ -t 0 ] && [ -t 1 ]; then
51
52
        INTERACTIVE=true
53
54
        INTERACTIVE=false
54
55
fi
55
56
 
 
57
# Define color for messages
 
58
BOLD="\\033[1;39m"
 
59
DONE="\\033[1;32m"
 
60
SKIP="\\033[1;34m"
 
61
WARN="\\033[1;35m"
 
62
FAIL="\\033[1;31m"
 
63
NORMAL="\\033[0;39m"
 
64
 
 
65
# New architecture variables
 
66
HOST_ARCH="$(uname -m)"
 
67
 
 
68
PWD=$(pwd)
 
69
 
56
70
# Sets or adjusts pretty formatting variables
57
71
resize_terminal() {
58
72
        ## Screen Dimentions
81
95
# Call resize_terminal when terminal is being resized
82
96
trap "resize_terminal" WINCH
83
97
 
84
 
# Define color for messages
85
 
BOLD="\\033[1;39m"
86
 
DONE="\\033[1;32m"
87
 
SKIP="\\033[1;34m"
88
 
WARN="\\033[1;35m"
89
 
FAIL="\\033[1;31m"
90
 
NORMAL="\\033[0;39m"
91
 
 
92
 
# New architecture variables
93
 
HOST_ARCH="$(uname -m)"
94
 
 
95
 
PWD=$(pwd)
96
 
BASENAME=$(basename $0)
97
 
 
98
 
# Debian specific settings
99
 
if [ ! -e /etc/debian_version ]; then
100
 
        FULLPATH=`which $0`
101
 
else
102
 
        if [ -x /usr/bin/realpath ]; then
103
 
                FULLPATH=`/usr/bin/realpath $0`
104
 
        else
105
 
                echo "ERROR: Need to do apt-get install realpath"
106
 
                exit 1
107
 
        fi
108
 
fi
109
 
 
110
 
# This is the directory where make.sh is in
111
 
export BASEDIR=$(echo $FULLPATH | sed "s/\/$BASENAME//g")
112
 
 
113
 
LOGFILE=$BASEDIR/log/_build.preparation.log
114
 
export LOGFILE
115
 
DIR_CHK=$BASEDIR/cache/check
116
 
mkdir $BASEDIR/log/ 2>/dev/null
 
98
# Writes a line to the log file
 
99
log() {
 
100
        local line="$@"
 
101
 
 
102
        # Fetch the current timestamp
 
103
        local t="$(date -u "+%b %e %T")"
 
104
 
 
105
        # Append the line to file
 
106
        if [ -w "${LOGFILE}" ]; then
 
107
                echo "${t}: ${line}" >> "${LOGFILE}"
 
108
        fi
 
109
 
 
110
        return 0
 
111
}
 
112
 
 
113
find_base() {
 
114
        local path
 
115
 
 
116
        # Figure out the absolute script path using readlink
 
117
        path="$(readlink -f "${0}" 2>&1)"
 
118
 
 
119
        # If that failed, try realpath
 
120
        if [ -z "${path}" ]; then
 
121
                path="$(realpath "${0}" 2>&1)"
 
122
        fi
 
123
 
 
124
        # If that failed, I am out of ideas
 
125
        if [ -z "${path}" ]; then
 
126
                echo "${0}: Could not determine BASEDIR" >&2
 
127
                return 1
 
128
        fi
 
129
 
 
130
        # Return the dirname
 
131
        dirname "${path}"
 
132
}
117
133
 
118
134
system_processors() {
119
135
        getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1"
179
195
        fi
180
196
 
181
197
        BUILD_ARCH="${build_arch}"
182
 
        TOOLS_DIR="/tools_${BUILD_ARCH}"
183
198
 
184
199
        # Enables hardening
185
 
        HARDENING_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection"
 
200
        HARDENING_CFLAGS="-Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection"
186
201
 
187
 
        CFLAGS="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
 
202
        CFLAGS="-O2 -g0 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
188
203
        CXXFLAGS="${CFLAGS}"
189
204
 
190
205
        RUSTFLAGS="-Copt-level=3 -Clink-arg=-Wl,-z,relro,-z,now -Ccodegen-units=1 --cap-lints=warn ${RUSTFLAGS_ARCH}"
245
260
        esac
246
261
}
247
262
 
248
 
stdumount() {
249
 
        umount $BASEDIR/build/sys                       2>/dev/null;
250
 
        umount $BASEDIR/build/dev/shm           2>/dev/null;
251
 
        umount $BASEDIR/build/dev/pts           2>/dev/null;
252
 
        umount $BASEDIR/build/dev                       2>/dev/null;
253
 
        umount $BASEDIR/build/proc                      2>/dev/null;
254
 
        umount $BASEDIR/build/install/mnt               2>/dev/null;
255
 
        umount $BASEDIR/build/usr/src/cache     2>/dev/null;
256
 
        umount $BASEDIR/build/usr/src/ccache    2>/dev/null;
257
 
        umount $BASEDIR/build/usr/src/config    2>/dev/null;
258
 
        umount $BASEDIR/build/usr/src/doc               2>/dev/null;
259
 
        umount $BASEDIR/build/usr/src/html              2>/dev/null;
260
 
        umount $BASEDIR/build/usr/src/langs     2>/dev/null;
261
 
        umount $BASEDIR/build/usr/src/lfs               2>/dev/null;
262
 
        umount $BASEDIR/build/usr/src/log               2>/dev/null;
263
 
        umount $BASEDIR/build/usr/src/src               2>/dev/null;
264
 
        umount $BASEDIR/build/usr/src           2>/dev/null;
265
 
        umount $BASEDIR/build/tmp               2>/dev/null;
266
 
}
267
 
 
268
263
format_runtime() {
269
264
        local seconds=${1}
270
265
 
363
358
        print_status DONE
364
359
}
365
360
 
 
361
# Launches a timer process as a co-process
 
362
launch_timer() {
 
363
        # Do nothing if the timer is already running
 
364
        if [ -n "${TIMER_PID}" ]; then
 
365
                return 0
 
366
        fi
 
367
 
 
368
        # Launch the co-process
 
369
        coproc TIMER { "${0}" "__timer" "$$"; }
 
370
 
 
371
        # Register the signal handlers
 
372
        trap "__timer_event" SIGUSR1
 
373
        trap "terminate_timer" EXIT
 
374
}
 
375
 
 
376
# Terminates a previously launched timer
 
377
terminate_timer() {
 
378
        if [ -n "${TIMER_PID}" ]; then
 
379
                kill -TERM "${TIMER_PID}"
 
380
        fi
 
381
}
 
382
 
 
383
# The timer main loop
 
384
__timer() {
 
385
        local pid="${1}"
 
386
 
 
387
        # Send SIGUSR1 to the main process once a second
 
388
        # If the parent process has gone away, we will terminate.
 
389
        while sleep 1; do
 
390
                if ! kill -USR1 "${pid}" &>/dev/null; then
 
391
                        break
 
392
                fi
 
393
        done
 
394
 
 
395
        return 0
 
396
}
 
397
 
 
398
# Called when the timer triggers
 
399
# This function does nothing, but is needed interrupt the wait call
 
400
__timer_event() {
 
401
        return 0
 
402
}
 
403
 
366
404
exiterror() {
367
 
        stdumount
368
 
        for i in `seq 0 7`; do
369
 
                if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
370
 
                losetup -d /dev/loop${i} 2>/dev/null
371
 
                fi;
372
 
        done
373
 
 
374
405
        # Dump logfile
375
406
        if [ -n "${LOGFILE}" ] && [ -e "${LOGFILE}" ]; then
376
407
                echo # empty line
406
437
        trap "exiterror 'Build process interrupted'" SIGINT SIGTERM SIGQUIT
407
438
 
408
439
        # Checking if running as root user
409
 
        if [ $(id -u) -ne 0 ]; then
410
 
                        exiterror "root privileges required for building"
 
440
        if [ "${UID}" -ne 0 ]; then
 
441
                exiterror "root privileges required for building"
411
442
        fi
412
443
 
413
 
        # Checking for necessary temporary space
414
 
        print_line "Checking for necessary space on disk $BASE_DEV"
415
 
        BASE_DEV=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $1 }'`
416
 
        BASE_ASPACE=`df -P -k $BASEDIR | tail -n 1 | awk '{ print $4 }'`
417
 
        if (( 2048000 > $BASE_ASPACE )); then
418
 
                        BASE_USPACE=`du -skx $BASEDIR | awk '{print $1}'`
419
 
                        if (( 2048000 - $BASE_USPACE > $BASE_ASPACE )); then
420
 
                                print_status FAIL
421
 
                                exiterror "Not enough temporary space available, need at least 2GB on $BASE_DEV"
422
 
                        fi
423
 
        else
424
 
                        print_status DONE
 
444
        local required_space
 
445
 
 
446
        # Parse arguments
 
447
        while [ $# -gt 0 ]; do
 
448
                case "${1}" in
 
449
                        --required-space=*)
 
450
                                required_space="${1#--required-space=}"
 
451
                                ;;
 
452
 
 
453
                        *)
 
454
                                exiterror "Unknown argument: ${1}"
 
455
                                ;;
 
456
                esac
 
457
                shift
 
458
        done
 
459
 
 
460
        # Do we need to check the required space?
 
461
        if [ -n "${required_space}" ]; then
 
462
                local free_space free_blocks block_size
 
463
 
 
464
                # Fetch free blocks
 
465
                read -r free_blocks block_size <<< "$(stat --file-system --format="%a %S" "${BASEDIR}")"
 
466
 
 
467
                # Calculate free space
 
468
                (( free_space = free_blocks * block_size / 1024 / 1024 ))
 
469
 
 
470
                # Check if we have at least 4GB of space
 
471
                if [ "${free_space}" -lt "${required_space}" ]; then
 
472
                        exiterror "Not enough temporary space available, need at least ${required_space}MiB"
 
473
                fi
425
474
        fi
426
475
 
427
476
        # Set umask
428
477
        umask 022
429
478
 
430
 
        # Set LFS Directory
431
 
        LFS=$BASEDIR/build
432
 
 
433
 
        # Setup environment
434
 
        set +h
435
 
        LC_ALL=POSIX
436
 
        export LFS LC_ALL CFLAGS CXXFLAGS DEFAULT_PARALLELISM RUSTFLAGS NINJAJOBS
437
 
        unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
438
 
 
439
479
        # Make some extra directories
440
 
        mkdir -p "${BASEDIR}/build${TOOLS_DIR}" 2>/dev/null
441
 
        mkdir -p $BASEDIR/build/{etc,usr/src} 2>/dev/null
442
 
        mkdir -p $BASEDIR/build/{dev/{shm,pts},proc,sys}
443
 
        mkdir -p $BASEDIR/{cache,ccache/${BUILD_ARCH}/${TOOLCHAINVER}} 2>/dev/null
444
 
 
445
 
        if [ "${ENABLE_RAMDISK}" = "on" ]; then
446
 
                mkdir -p $BASEDIR/build/usr/src
447
 
                mount -t tmpfs tmpfs -o size=8G,nr_inodes=1M,mode=1777 $BASEDIR/build/usr/src
448
 
 
449
 
                mkdir -p ${BASEDIR}/build/tmp
450
 
                mount -t tmpfs tmpfs -o size=4G,nr_inodes=1M,mode=1777 ${BASEDIR}/build/tmp
451
 
        fi
452
 
 
453
 
        mkdir -p $BASEDIR/build/usr/src/{cache,config,doc,html,langs,lfs,log,src,ccache}
454
 
 
455
 
        mknod -m 600 $BASEDIR/build/dev/console c 5 1 2>/dev/null
456
 
        mknod -m 666 $BASEDIR/build/dev/null c 1 3 2>/dev/null
 
480
        mkdir -p "${CCACHE_DIR}"
 
481
        mkdir -p "${IMAGES_DIR}"
 
482
        mkdir -p "${BUILD_DIR}/${TOOLS_DIR}"
 
483
        mkdir -p "${BUILD_DIR}/cache"
 
484
        mkdir -p "${BUILD_DIR}/dev"
 
485
        mkdir -p "${BUILD_DIR}/etc"
 
486
        mkdir -p "${BUILD_DIR}/proc"
 
487
        mkdir -p "${BUILD_DIR}/sys"
 
488
        mkdir -p "${BUILD_DIR}/tmp"
 
489
        mkdir -p "${BUILD_DIR}/usr/src"
 
490
        mkdir -p "${BUILD_DIR}/usr/src/cache"
 
491
        mkdir -p "${BUILD_DIR}/usr/src/ccache"
 
492
        mkdir -p "${BUILD_DIR}/usr/src/config"
 
493
        mkdir -p "${BUILD_DIR}/usr/src/doc"
 
494
        mkdir -p "${BUILD_DIR}/usr/src/html"
 
495
        mkdir -p "${BUILD_DIR}/usr/src/images"
 
496
        mkdir -p "${BUILD_DIR}/usr/src/langs"
 
497
        mkdir -p "${BUILD_DIR}/usr/src/lfs"
 
498
        mkdir -p "${BUILD_DIR}/usr/src/log"
 
499
        mkdir -p "${BUILD_DIR}/usr/src/src"
 
500
 
 
501
        # Make BUILD_DIR a mountpoint
 
502
        mount -o bind "${BUILD_DIR}" "${BUILD_DIR}"
 
503
 
 
504
        # Create a new, minimal /dev
 
505
        mount build_dev "${BUILD_DIR}/dev" \
 
506
                -t tmpfs -o "nosuid,noexec,mode=0755,size=4m,nr_inodes=64k"
 
507
 
 
508
        # Create device nodes
 
509
        mknod -m 600 "${BUILD_DIR}/dev/console"                 c   5   1
 
510
        mknod -m 666 "${BUILD_DIR}/dev/null"                    c   1   3
 
511
        mknod -m 666 "${BUILD_DIR}/dev/zero"                    c   1   5
 
512
        mknod -m 666 "${BUILD_DIR}/dev/full"                    c   1   7
 
513
        mknod -m 444 "${BUILD_DIR}/dev/random"                  c   1   8
 
514
        mknod -m 444 "${BUILD_DIR}/dev/urandom"                 c   1   9
 
515
        mknod -m 444 "${BUILD_DIR}/dev/kmsg"                    c   1  11
 
516
        mknod -m 666 "${BUILD_DIR}/dev/tty"                             c   5   0
 
517
        mknod -m 666 "${BUILD_DIR}/dev/rtc0"                    c 252   0
 
518
 
 
519
        # Create loop devices
 
520
        mknod -m 666 "${BUILD_DIR}/dev/loop-control"    c  10 237
 
521
        mknod -m 666 "${BUILD_DIR}/dev/loop0"                   c   7   0
 
522
        mknod -m 666 "${BUILD_DIR}/dev/loop1"                   c   7   1
 
523
        mknod -m 666 "${BUILD_DIR}/dev/loop2"                   c   7   2
 
524
        mknod -m 666 "${BUILD_DIR}/dev/loop3"                   c   7   3
 
525
        mknod -m 666 "${BUILD_DIR}/dev/loop4"                   c   7   4
 
526
        mknod -m 666 "${BUILD_DIR}/dev/loop5"                   c   7   5
 
527
        mknod -m 666 "${BUILD_DIR}/dev/loop6"                   c   7   6
 
528
        mknod -m 666 "${BUILD_DIR}/dev/loop7"                   c   7   7
 
529
 
 
530
        # Create directories
 
531
        mkdir -p "${BUILD_DIR}/dev/pts"
 
532
        mkdir -p "${BUILD_DIR}/dev/shm"
 
533
 
 
534
        # Create symlinks
 
535
        ln -s  "pts/ptmx"                               "${BUILD_DIR}/dev/ptmx"
 
536
        ln -s "../proc/self/fd"                 "${BUILD_DIR}/dev/fd"
 
537
        ln -s "../proc/self/fd/0"               "${BUILD_DIR}/dev/stdin"
 
538
        ln -s "../proc/self/fd/1"               "${BUILD_DIR}/dev/stdout"
 
539
        ln -s "../proc/self/fd/2"               "${BUILD_DIR}/dev/stderr"
 
540
        ln -s "../proc/kcore"                   "${BUILD_DIR}/dev/core"
 
541
 
 
542
        # Mount a new /dev/pts
 
543
        mount build_dev_pts "${BUILD_DIR}/dev/pts" \
 
544
                -t devpts -o "nosuid,noexec,newinstance,ptmxmode=0666,mode=620"
 
545
 
 
546
        # Mount a new /dev/shm
 
547
        mount build_dev_shm "${BUILD_DIR}/dev/shm" \
 
548
                -t tmpfs -o "nosuid,nodev,strictatime,mode=1777,size=1024m"
 
549
 
 
550
        # Mount a new /tmp
 
551
        mount build_tmp "${BUILD_DIR}/tmp" \
 
552
                -t tmpfs -o "nosuid,nodev,strictatime,size=4G,nr_inodes=1M,mode=1777"
457
553
 
458
554
        # Make all sources and proc available under lfs build
459
 
        mount --bind /dev            $BASEDIR/build/dev
460
 
        mount --bind /dev/pts        $BASEDIR/build/dev/pts
461
 
        mount --bind /dev/shm        $BASEDIR/build/dev/shm
462
 
        mount --bind /proc           $BASEDIR/build/proc
463
 
        mount --bind /sys            $BASEDIR/build/sys
464
 
        mount --bind $BASEDIR/cache  $BASEDIR/build/usr/src/cache
465
 
        mount --bind $BASEDIR/ccache/${BUILD_ARCH}/${TOOLCHAINVER} $BASEDIR/build/usr/src/ccache
466
 
        mount --bind $BASEDIR/config $BASEDIR/build/usr/src/config
467
 
        mount --bind $BASEDIR/doc    $BASEDIR/build/usr/src/doc
468
 
        mount --bind $BASEDIR/html   $BASEDIR/build/usr/src/html
469
 
        mount --bind $BASEDIR/langs  $BASEDIR/build/usr/src/langs
470
 
        mount --bind $BASEDIR/lfs    $BASEDIR/build/usr/src/lfs
471
 
        mount --bind $BASEDIR/log    $BASEDIR/build/usr/src/log
472
 
        mount --bind $BASEDIR/src    $BASEDIR/build/usr/src/src
473
 
 
474
 
        # Run LFS static binary creation scripts one by one
475
 
        export CCACHE_DIR=$BASEDIR/ccache
 
555
        mount --bind            /sys                                    "${BUILD_DIR}/sys"
 
556
        mount --bind -o ro      "${BASEDIR}/cache"              "${BUILD_DIR}/usr/src/cache"
 
557
        mount --bind -o ro      "${BASEDIR}/config"             "${BUILD_DIR}/usr/src/config"
 
558
        mount --bind -o ro      "${BASEDIR}/doc"                "${BUILD_DIR}/usr/src/doc"
 
559
        mount --bind -o ro      "${BASEDIR}/html"               "${BUILD_DIR}/usr/src/html"
 
560
        mount --bind -o ro      "${BASEDIR}/langs"              "${BUILD_DIR}/usr/src/langs"
 
561
        mount --bind -o ro      "${BASEDIR}/lfs"                "${BUILD_DIR}/usr/src/lfs"
 
562
        mount --bind -o ro      "${BASEDIR}/src"                "${BUILD_DIR}/usr/src/src"
 
563
 
 
564
        # Mount the log directory
 
565
        mount --bind "${LOG_DIR}"                       "${BUILD_DIR}/usr/src/log"
 
566
 
 
567
        # Mount the ccache
 
568
        mount --bind "${CCACHE_DIR}"            "${BUILD_DIR}/usr/src/ccache"
 
569
 
 
570
        # Mount the images directory
 
571
        mount --bind "${IMAGES_DIR}"            "${BUILD_DIR}/usr/src/images"
 
572
 
 
573
        # Configure the ccache
476
574
        export CCACHE_TEMPDIR="/tmp"
477
575
        export CCACHE_COMPILERCHECK="string:toolchain-${TOOLCHAINVER} ${BUILD_ARCH}"
478
576
 
 
577
        # Install the QEMU helper
 
578
        qemu_install_helper
 
579
 
479
580
        # Remove pre-install list of installed files in case user erase some files before rebuild
480
 
        rm -f $BASEDIR/build/usr/src/lsalr 2>/dev/null
 
581
        rm -f "${BUILD_DIR}/usr/src/lsalr"
481
582
 
482
583
        # Prepare string for /etc/system-release.
483
584
        local system_release="${NAME} ${VERSION} (${BUILD_ARCH})"
513
614
        esac
514
615
 
515
616
        # Setup ccache cache size
516
 
        enterchroot ccache --max-size="${CCACHE_CACHE_SIZE}"
517
 
}
518
 
 
519
 
enterchroot() {
520
 
        # Install QEMU helper, if needed
521
 
        qemu_install_helper
522
 
 
523
 
        local PATH="${TOOLS_DIR}/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin"
524
 
 
525
 
        # Prepend any custom changes to PATH
526
 
        if [ -n "${CUSTOM_PATH}" ]; then
527
 
                PATH="${CUSTOM_PATH}:${PATH}"
528
 
        fi
529
 
 
530
 
        PATH="${PATH}" chroot ${LFS} env -i \
531
 
                HOME="/root" \
532
 
                TERM="${TERM}" \
533
 
                PS1="${PS1}" \
534
 
                PATH="${PATH}" \
535
 
                SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
536
 
                PAKFIRE_TREE="${PAKFIRE_TREE}" \
537
 
                NAME="${NAME}" \
538
 
                SNAME="${SNAME}" \
539
 
                VERSION="${VERSION}" \
540
 
                CORE="${CORE}" \
541
 
                SLOGAN="${SLOGAN}" \
542
 
                TOOLS_DIR="${TOOLS_DIR}" \
543
 
                CONFIG_ROOT="${CONFIG_ROOT}" \
544
 
                CFLAGS="${CFLAGS} ${HARDENING_CFLAGS}" \
545
 
                CXXFLAGS="${CXXFLAGS} ${HARDENING_CFLAGS}" \
546
 
                RUSTFLAGS="${RUSTFLAGS}" \
547
 
                BUILDTARGET="${BUILDTARGET}" \
548
 
                CROSSTARGET="${CROSSTARGET}" \
549
 
                BUILD_ARCH="${BUILD_ARCH}" \
550
 
                BUILD_PLATFORM="${BUILD_PLATFORM}" \
551
 
                CCACHE_DIR=/usr/src/ccache \
552
 
                CCACHE_TEMPDIR="${CCACHE_TEMPDIR}" \
553
 
                CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
554
 
                GOCACHE="/usr/src/ccache/go" \
555
 
                KVER="${KVER}" \
556
 
                XZ_OPT="${XZ_OPT}" \
557
 
                DEFAULT_PARALLELISM="${DEFAULT_PARALLELISM}" \
558
 
                SYSTEM_PROCESSORS="${SYSTEM_PROCESSORS}" \
559
 
                SYSTEM_MEMORY="${SYSTEM_MEMORY}" \
560
 
                $(fake_environ) \
561
 
                $(qemu_environ) \
562
 
                "$@"
 
617
        execute --chroot ccache --max-size="${CCACHE_CACHE_SIZE}"
563
618
}
564
619
 
565
620
entershell() {
566
 
        if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
567
 
                exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
568
 
        fi
 
621
        echo "Entering to a shell inside the build environment, go out with exit"
569
622
 
570
 
        echo "Entering to a shell inside LFS chroot, go out with exit"
571
623
        local PS1="ipfire build chroot (${BUILD_ARCH}) \u:\w\$ "
572
624
 
573
 
        if enterchroot bash -i; then
574
 
                stdumount
575
 
        else
576
 
                print_status FAIL
577
 
                exiterror "chroot error"
578
 
        fi
 
625
        # Run an interactive shell
 
626
        execute --chroot --interactive bash -i
579
627
}
580
628
 
581
629
lfsmakecommoncheck() {
598
646
                fi
599
647
        fi
600
648
 
601
 
        # Script slipped?
602
 
        local i
603
 
        for i in $SKIP_PACKAGE_LIST
604
 
        do
605
 
                if [ "$i" == "$1" ]; then
606
 
                        print_status SKIP
607
 
                        return 1;
608
 
                fi
609
 
        done
610
 
 
611
649
        echo -ne "`date -u '+%b %e %T'`: Building $* " >> $LOGFILE
612
650
 
613
 
        cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
614
 
                MESSAGE="$1\t " download  >> $LOGFILE 2>&1
615
 
        if [ $? -ne 0 ]; then
616
 
                exiterror "Download error in $1"
617
 
        fi
618
 
 
619
 
        cd $BASEDIR/lfs && make -s -f $* LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
620
 
                MESSAGE="$1\t b2sum" b2  >> $LOGFILE 2>&1
621
 
        if [ $? -ne 0 ]; then
622
 
                exiterror "BLAKE2 checksum error in $1, check file in cache or signature"
623
 
        fi
624
 
 
625
651
        return 0        # pass all!
626
652
}
627
653
 
 
654
execute() {
 
655
        # Check if we are running in our namespace
 
656
        if [ -z "${IN_NAMESPACE}" ]; then
 
657
                exiterror "Not running in namespace"
 
658
        fi
 
659
 
 
660
        local command=()
 
661
 
 
662
        local chroot="false"
 
663
        local interactive="false"
 
664
        local timer
 
665
 
 
666
        # Collect environment variables
 
667
        local -A environ=(
 
668
                [PATH]="${TOOLS_DIR}/ccache/bin:${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin:${PATH}"
 
669
                [HOME]="${HOME}"
 
670
                [PS1]="${PS1}"
 
671
                [TERM]="vt100"
 
672
 
 
673
                # Distro Information
 
674
                [NAME]="${NAME}"
 
675
                [SNAME]="${SNAME}"
 
676
                [VERSION]="${VERSION}"
 
677
                [CORE]="${CORE}"
 
678
                [SLOGAN]="${SLOGAN}"
 
679
                [SYSTEM_RELEASE]="${SYSTEM_RELEASE}"
 
680
                [PAKFIRE_TREE]="${PAKFIRE_TREE}"
 
681
                [CONFIG_ROOT]="${CONFIG_ROOT}"
 
682
 
 
683
                # Kernel Version
 
684
                [KVER]="${KVER}"
 
685
 
 
686
                # Compiler flags
 
687
                [CFLAGS]="${CFLAGS} ${HARDENING_CFLAGS}"
 
688
                [CXXFLAGS]="${CXXFLAGS} ${HARDENING_CFLAGS}"
 
689
                [RUSTFLAGS]="${RUSTFLAGS}"
 
690
 
 
691
                # ccache
 
692
                [CCACHE_DIR]="${CCACHE_DIR}"
 
693
                [CCACHE_TEMPDIR]="${CCACHE_TEMPDIR}"
 
694
                [CCACHE_COMPILERCHECK]="${CCACHE_COMPILERCHECK}"
 
695
 
 
696
                # System Properties
 
697
                [SYSTEM_PROCESSORS]="${SYSTEM_PROCESSORS}"
 
698
                [SYSTEM_MEMORY]="${SYSTEM_MEMORY}"
 
699
 
 
700
                # Parallelism
 
701
                [DEFAULT_PARALLELISM]="${DEFAULT_PARALLELISM}"
 
702
 
 
703
                # Compression Options
 
704
                [XZ_OPT]="${XZ_OPT}"
 
705
 
 
706
                # Build Architecture
 
707
                [BUILD_ARCH]="${BUILD_ARCH}"
 
708
                [BUILD_PLATFORM]="${BUILD_PLATFORM}"
 
709
 
 
710
                # Targets
 
711
                [CROSSTARGET]="${CROSSTARGET}"
 
712
                [BUILDTARGET]="${BUILDTARGET}"
 
713
 
 
714
                # Paths
 
715
                [LFS_BASEDIR]="${BASEDIR}"
 
716
                [IMAGES_DIR]="${IMAGES_DIR}"
 
717
                [TOOLS_DIR]="${TOOLS_DIR}"
 
718
        )
 
719
 
 
720
        # Configure a new namespace
 
721
        local unshare=(
 
722
                # Create a new cgroup namespace
 
723
                "--cgroup"
 
724
 
 
725
                # Create a new mount namespace
 
726
                "--mount"
 
727
                "--propagation=slave"
 
728
 
 
729
                # Create a new PID namespace and fork
 
730
                "--pid"
 
731
                "--fork"
 
732
 
 
733
                # Create a new time namespace
 
734
                "--time"
 
735
 
 
736
                # Create a new UTS namespace
 
737
                "--uts"
 
738
 
 
739
                # Mount /proc so that the build environment does not see
 
740
                # any foreign processes.
 
741
                "--mount-proc=${BUILD_DIR}/proc"
 
742
 
 
743
                # If unshare is asked to terminate, terminate all child processes
 
744
                "--kill-child"
 
745
        )
 
746
 
 
747
        while [ $# -gt 0 ]; do
 
748
                case "${1}" in
 
749
                        --chroot)
 
750
                                chroot="true"
 
751
 
 
752
                                # Update some variables
 
753
                                environ+=(
 
754
                                        [PATH]="${TOOLS_DIR}/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin"
 
755
                                        [HOME]="/root"
 
756
 
 
757
                                        # Paths
 
758
                                        [LFS_BASEDIR]="/usr/src"
 
759
                                        [IMAGES_DIR]="/usr/src/images"
 
760
 
 
761
                                        # Compiler Cache
 
762
                                        [CCACHE_DIR]="/usr/src/ccache"
 
763
 
 
764
                                        # Go Cache
 
765
                                        [GOCACHE]="/usr/src/ccache/go"
 
766
                                )
 
767
 
 
768
                                # Fake environment
 
769
                                if [ -e "${BUILD_DIR}${TOOLS_DIR}/lib/libpakfire_preload.so" ]; then
 
770
                                        environ+=(
 
771
                                                [LD_PRELOAD]="${TOOLS_DIR}/lib/libpakfire_preload.so"
 
772
 
 
773
                                                # Fake kernel version, because some of the packages do not
 
774
                                                # compile with kernel 3.0 and later
 
775
                                                [UTS_RELEASE]="${KVER}-${SNAME}"
 
776
 
 
777
                                                # Fake machine
 
778
                                                [UTS_MACHINE]="${BUILD_ARCH}"
 
779
                                        )
 
780
                                fi
 
781
                                ;;
 
782
 
 
783
                        --interactive)
 
784
                                interactive="true"
 
785
 
 
786
                                # Use the actual value of $TERM
 
787
                                environ+=(
 
788
                                        [TERM]="${TERM}"
 
789
                                )
 
790
                                ;;
 
791
 
 
792
                        --timer=*)
 
793
                                timer="${1#--timer=}"
 
794
                                ;;
 
795
 
 
796
                        -*)
 
797
                                echo "Unknown argument: ${1}" >&2
 
798
                                return 2
 
799
                                ;;
 
800
 
 
801
                        # Parse any custom environment variables
 
802
                        *=*)
 
803
                                environ["${1%=*}"]="${1#*=}"
 
804
                                ;;
 
805
 
 
806
                        # The rest is the command
 
807
                        *)
 
808
                                command+=( "$@" )
 
809
                                break
 
810
                                ;;
 
811
                esac
 
812
                shift
 
813
        done
 
814
 
 
815
        # Prepend any custom changes to PATH
 
816
        if [ -n "${CUSTOM_PATH}" ]; then
 
817
                environ[PATH]="${CUSTOM_PATH}:${environ[PATH]}"
 
818
        fi
 
819
 
 
820
        # Setup QEMU
 
821
        if qemu_is_required; then
 
822
                environ+=(
 
823
                        [QEMU_TARGET_HELPER]="${QEMU_TARGET_HELPER}"
 
824
 
 
825
                        # Enable QEMU strace
 
826
                        #[QEMU_STRACE]="1"
 
827
                )
 
828
 
 
829
                case "${BUILD_ARCH}" in
 
830
                        arm*)
 
831
                                environ+=(
 
832
                                        [QEMU_CPU]="${QEMU_CPU:-cortex-a9}"
 
833
                                )
 
834
                                ;;
 
835
 
 
836
                        riscv64)
 
837
                                environ+=(
 
838
                                        [QEMU_CPU]="${QEMU_CPU:-sifive-u54}"
 
839
 
 
840
                                        # Bug fix for QEMU locking up
 
841
                                        [G_SLICE]="always-malloc"
 
842
                                )
 
843
                                ;;
 
844
                esac
 
845
        fi
 
846
 
 
847
        local execute=()
 
848
        local env
 
849
 
 
850
        # Create new namespaces
 
851
        execute+=(
 
852
                "unshare" "${unshare[@]}"
 
853
        )
 
854
 
 
855
        # Run in chroot?
 
856
        if [ "${chroot}" = "true" ]; then
 
857
                execute+=( "chroot" "${BUILD_DIR}" )
 
858
        fi
 
859
 
 
860
        # Reset the environment
 
861
        execute+=(
 
862
                "env"
 
863
 
 
864
                # Clear the previous environment
 
865
                "--ignore-environment"
 
866
 
 
867
                # Change the working directory
 
868
                --chdir="${environ[LFS_BASEDIR]}/lfs"
 
869
        )
 
870
 
 
871
        # Export the environment
 
872
        for env in ${!environ[@]}; do
 
873
                execute+=( "${env}=${environ[${env}]}" )
 
874
        done
 
875
 
 
876
        # Append the command
 
877
        execute+=( "${command[@]}" )
 
878
 
 
879
        # Return code
 
880
        local r=0
 
881
 
 
882
        # Store the start time
 
883
        local t="${SECONDS}"
 
884
 
 
885
        # Run the command in the background and pipe all output to the logfile
 
886
        case "${interactive}" in
 
887
                true)
 
888
                        "${execute[@]}" || return $?
 
889
                        ;;
 
890
 
 
891
                false)
 
892
                        # Launch the timer if needed
 
893
                        if [ -n "${timer}" ]; then
 
894
                                launch_timer
 
895
                        fi
 
896
 
 
897
                        # Dispatch the command to the background
 
898
                        {
 
899
                                "${execute[@]}" >> "${LOGFILE}" 2>&1 </dev/null
 
900
                        } &
 
901
 
 
902
                        # Wait for the process to complete
 
903
                        while :; do
 
904
                                wait "$!"
 
905
 
 
906
                                # Store the return code
 
907
                                r="$?"
 
908
 
 
909
                                # If the return code is >= 128, wait has been interrupted by the timer
 
910
                                if [ "${r}" -ge 128 ]; then
 
911
                                        # Call the timer callback
 
912
                                        if [ -n "${timer}" ]; then
 
913
                                                "${timer}"
 
914
                                        fi
 
915
 
 
916
                                        # Go back and wait
 
917
                                        continue
 
918
                                fi
 
919
 
 
920
                                break
 
921
                        done
 
922
 
 
923
                        # Call the timer callback at least once
 
924
                        if [ -n "${timer}" ]; then
 
925
                                "${timer}"
 
926
                        fi
 
927
        esac
 
928
 
 
929
        return "${r}"
 
930
}
 
931
 
 
932
# Calls the makefile of a package
 
933
make_pkg() {
 
934
        local args=()
 
935
        local pkg
 
936
 
 
937
        while [ $# -gt 0 ]; do
 
938
                local arg="${1}"
 
939
                shift
 
940
 
 
941
                case "${arg}" in
 
942
                        --*)
 
943
                                args+=( "${arg}" )
 
944
                                ;;
 
945
 
 
946
                        *)
 
947
                                pkg="${arg}"
 
948
                                break
 
949
                                ;;
 
950
                esac
 
951
        done
 
952
 
 
953
        # Execute the make command in the environment
 
954
        execute "${args[@]}" make --file="${pkg}" "$@"
 
955
}
 
956
 
628
957
lfsmake1() {
629
 
        lfsmakecommoncheck $*
 
958
        local pkg="${1}"
 
959
        shift
 
960
 
 
961
        # Run the common check
 
962
        lfsmakecommoncheck "${pkg}" "$@"
630
963
        [ $? == 1 ] && return 0
631
964
 
632
 
        # Set PATH to use the toolchain tools first and then whatever the host has set
633
 
        local PATH="${TOOLS_DIR}/ccache/bin:${TOOLS_DIR}/sbin:${TOOLS_DIR}/bin:${PATH}"
634
 
 
635
 
        if [ -n "${CUSTOM_PATH}" ]; then
636
 
                PATH="${CUSTOM_PATH}:${PATH}"
 
965
        # Download source outside of the toolchain
 
966
        if ! make_pkg "${pkg}" download "$@"; then
 
967
                exiterror "Downloading ${pkg}"
637
968
        fi
638
969
 
639
 
        cd $BASEDIR/lfs && env -i \
640
 
                PATH="${PATH}" \
641
 
                CCACHE_DIR="${CCACHE_DIR}"/${BUILD_ARCH}/${TOOLCHAINVER} \
642
 
                CCACHE_TEMPDIR="${CCACHE_TEMPDIR}" \
643
 
                CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
644
 
                CFLAGS="${CFLAGS}" \
645
 
                CXXFLAGS="${CXXFLAGS}" \
646
 
                DEFAULT_PARALLELISM="${DEFAULT_PARALLELISM}" \
647
 
                SYSTEM_PROCESSORS="${SYSTEM_PROCESSORS}" \
648
 
                SYSTEM_MEMORY="${SYSTEM_MEMORY}" \
649
 
                make -f $* \
650
 
                        TOOLCHAIN=1 \
651
 
                        TOOLS_DIR="${TOOLS_DIR}" \
652
 
                        CROSSTARGET="${CROSSTARGET}" \
653
 
                        BUILDTARGET="${BUILDTARGET}" \
654
 
                        BUILD_ARCH="${BUILD_ARCH}" \
655
 
                        BUILD_PLATFORM="${BUILD_PLATFORM}" \
656
 
                        LFS_BASEDIR="${BASEDIR}" \
657
 
                        ROOT="${LFS}" \
658
 
                        KVER="${KVER}" \
659
 
                        install >> $LOGFILE 2>&1 &
660
 
 
661
 
        if ! wait_until_finished $!; then
 
970
        if ! make_pkg "${pkg}" TOOLCHAIN=1 ROOT="${BUILD_DIR}"; then
662
971
                print_status FAIL
663
 
                exiterror "Building $*"
 
972
 
 
973
                exiterror "Building ${pkg}"
664
974
        fi
665
975
 
666
976
        print_status DONE
667
977
}
668
978
 
669
979
lfsmake2() {
670
 
        lfsmakecommoncheck $*
 
980
        local pkg="${1}"
 
981
        shift
 
982
 
 
983
        # Run the common check
 
984
        lfsmakecommoncheck "${pkg}" "$@"
671
985
        [ $? == 1 ] && return 0
672
986
 
673
 
        local PS1='\u:\w$ '
674
 
 
675
 
        enterchroot \
676
 
                bash -x -c "cd /usr/src/lfs && \
677
 
                        make -f $* \
678
 
                        LFS_BASEDIR=/usr/src install" \
679
 
                >> ${LOGFILE} 2>&1 &
680
 
 
681
 
        if ! wait_until_finished $!; then
 
987
        # Download source outside of the toolchain
 
988
        if ! make_pkg "${pkg}" download "$@"; then
 
989
                exiterror "Downloading ${pkg}"
 
990
        fi
 
991
 
 
992
        # Run install on the package
 
993
        if ! make_pkg --chroot --timer="update_runtime" "${pkg}" install "$@"; then
682
994
                print_status FAIL
683
 
                exiterror "Building $*"
 
995
 
 
996
                exiterror "Building ${pkg}"
684
997
        fi
685
998
 
686
999
        print_status DONE
687
1000
}
688
1001
 
689
1002
ipfiredist() {
690
 
        lfsmakecommoncheck $*
 
1003
        local pkg="${1}"
 
1004
        shift
 
1005
 
 
1006
        # Run the common check
 
1007
        lfsmakecommoncheck "${pkg}" "$@"
691
1008
        [ $? == 1 ] && return 0
692
1009
 
693
 
        local PS1='\u:\w$ '
694
 
 
695
 
        enterchroot \
696
 
                bash -x -c "cd /usr/src/lfs && make -f $* LFS_BASEDIR=/usr/src dist" \
697
 
                >> ${LOGFILE} 2>&1 &
698
 
 
699
 
        if ! wait_until_finished $!; then
 
1010
        # Run dist on the package
 
1011
        if ! make_pkg --chroot --timer="update_runtime" "${pkg}" dist "$@"; then
700
1012
                print_status FAIL
701
 
                exiterror "Packaging $*"
 
1013
 
 
1014
                exiterror "Packaging ${pkg}"
702
1015
        fi
703
1016
 
704
1017
        print_status DONE
705
1018
}
706
1019
 
707
 
wait_until_finished() {
708
 
        local pid=${1}
709
 
 
710
 
        local start_time="${SECONDS}"
711
 
 
712
 
        # Show progress
713
 
        if ${INTERACTIVE}; then
714
 
                # Wait a little just in case the process
715
 
                # has finished very quickly.
716
 
                sleep 0.1
717
 
 
718
 
                local runtime
719
 
                while kill -0 ${pid} 2>/dev/null; do
720
 
                        print_runtime $(( SECONDS - start_time ))
721
 
 
722
 
                        # Wait a little
723
 
                        sleep 1
724
 
                done
725
 
        fi
726
 
 
727
 
        # Returns the exit code of the child process
728
 
        wait ${pid}
729
 
        local ret=$?
730
 
 
731
 
        if ! ${INTERACTIVE}; then
732
 
                print_runtime $(( SECONDS - start_time ))
733
 
        fi
734
 
 
735
 
        return ${ret}
736
 
}
737
 
 
738
 
fake_environ() {
739
 
        [ -e "${BASEDIR}/build${TOOLS_DIR}/lib/libpakfire_preload.so" ] || return
740
 
 
741
 
        local env="LD_PRELOAD=${TOOLS_DIR}/lib/libpakfire_preload.so"
742
 
 
743
 
        # Fake kernel version, because some of the packages do not compile
744
 
        # with kernel 3.0 and later.
745
 
        env="${env} UTS_RELEASE=${KVER}-ipfire"
746
 
 
747
 
        # Fake machine version.
748
 
        env="${env} UTS_MACHINE=${BUILD_ARCH}"
749
 
 
750
 
        echo "${env}"
751
 
}
752
 
 
753
 
qemu_environ() {
754
 
        local env="QEMU_TARGET_HELPER=${QEMU_TARGET_HELPER}"
755
 
 
756
 
        # Don't add anything if qemu is not used.
757
 
        if ! qemu_is_required; then
758
 
                return
759
 
        fi
760
 
 
761
 
        # Set default qemu options
762
 
        case "${BUILD_ARCH}" in
763
 
                arm*)
764
 
                        QEMU_CPU="${QEMU_CPU:-cortex-a9}"
765
 
 
766
 
                        env="${env} QEMU_CPU=${QEMU_CPU}"
767
 
                        ;;
768
 
                riscv64)
769
 
                        QEMU_CPU="${QEMU_CPU:-sifive-u54}"
770
 
                        G_SLICE="always-malloc"
771
 
                        env="${env} QEMU_CPU=${QEMU_CPU} G_SLICE=${G_SLICE}"
772
 
                        ;;
773
 
        esac
774
 
 
775
 
        # Enable QEMU strace
776
 
        #env="${env} QEMU_STRACE=1"
777
 
 
778
 
        echo "${env}"
 
1020
update_runtime() {
 
1021
        print_runtime "$(( SECONDS - t ))"
779
1022
}
780
1023
 
781
1024
qemu_is_required() {
815
1058
        fi
816
1059
 
817
1060
        # Check if the helper is already installed.
818
 
        if [ -x "${LFS}${QEMU_TARGET_HELPER}" ]; then
 
1061
        if [ -x "${BUILD_DIR}${QEMU_TARGET_HELPER}" ]; then
819
1062
                return 0
820
1063
        fi
821
1064
 
829
1072
                # Must be static.
830
1073
                file_is_static "${file}" || continue
831
1074
 
832
 
                local dirname="${LFS}$(dirname "${file}")"
 
1075
                local dirname="${BUILD_DIR}$(dirname "${file}")"
833
1076
                mkdir -p "${dirname}"
834
1077
 
835
 
                install -m 755 "${file}" "${LFS}${QEMU_TARGET_HELPER}"
 
1078
                # Create the mountpoint
 
1079
                touch "${BUILD_DIR}${QEMU_TARGET_HELPER}"
 
1080
 
 
1081
                mount --bind -o ro "${file}" "${BUILD_DIR}${QEMU_TARGET_HELPER}"
836
1082
                return 0
837
1083
        done
838
1084
 
923
1169
        return 0
924
1170
}
925
1171
 
926
 
# Default settings
927
 
CCACHE_CACHE_SIZE="4G"
928
 
ENABLE_RAMDISK="auto"
929
 
 
930
 
# Load configuration file
931
 
if [ -f .config ]; then
932
 
        . .config
933
 
fi
934
 
 
935
 
# TARGET_ARCH is BUILD_ARCH now
936
 
if [ -n "${TARGET_ARCH}" ]; then
937
 
        BUILD_ARCH="${TARGET_ARCH}"
938
 
        unset TARGET_ARCH
939
 
fi
940
 
 
941
 
# Get some information about the host system
942
 
SYSTEM_PROCESSORS="$(system_processors)"
943
 
SYSTEM_MEMORY="$(system_memory)"
944
 
 
945
 
if [ -n "${BUILD_ARCH}" ]; then
946
 
        configure_build "${BUILD_ARCH}"
947
 
else
948
 
        configure_build "default"
949
 
fi
950
 
 
951
 
# Automatically enable/disable ramdisk usage
952
 
if [ "${ENABLE_RAMDISK}" = "auto" ]; then
953
 
        # Enable only when the host system has 4GB of RAM or more
954
 
        if [ ${SYSTEM_MEMORY} -ge 3900 ]; then
955
 
                ENABLE_RAMDISK="on"
956
 
        fi
957
 
fi
958
 
 
959
 
buildtoolchain() {
 
1172
# Download sources
 
1173
download_sources() {
 
1174
        local file
 
1175
        local pkg
 
1176
 
 
1177
        local status=0
 
1178
 
 
1179
        # Walk through all files in LFS
 
1180
        for file in "${BASEDIR}/lfs/"*; do
 
1181
                pkg="${file##*/}"
 
1182
 
 
1183
                # Skip some packages
 
1184
                case "${pkg}" in
 
1185
                        Config)
 
1186
                                continue
 
1187
                                ;;
 
1188
                esac
 
1189
 
 
1190
                # Run the common check
 
1191
                lfsmakecommoncheck "${pkg}"
 
1192
                [ $? == 1 ] && continue
 
1193
 
 
1194
                # Download and check the package
 
1195
                if ! run_command "${pkg}" download b2; then
 
1196
                        status=1
 
1197
                fi
 
1198
        done
 
1199
 
 
1200
        return "${status}"
 
1201
}
 
1202
 
 
1203
# Download the toolchain
 
1204
download_toolchain() {
 
1205
        local toolchain="${1}"
 
1206
 
 
1207
        # Do nothing if the toolchain has already been downloaded
 
1208
        if [ -e "${TOOLCHAIN_DIR}/${toolchain}" ]; then
 
1209
                return 0
 
1210
        fi
 
1211
 
 
1212
        # Ensure the directory exists
 
1213
        mkdir -p "${TOOLCHAIN_DIR}"
 
1214
 
 
1215
        # Create a temporary directory
 
1216
        local tmp="$(mktemp -d)"
 
1217
 
 
1218
        # Make the name for the checksum file
 
1219
        local checksums="${toolchain/.tar.zst/.b2}"
 
1220
 
 
1221
        # Download the toolchain and checksum files
 
1222
        if ! wget --quiet --directory-prefix="${tmp}" \
 
1223
                        "${TOOLCHAIN_URL}/${toolchain}" \
 
1224
                        "${TOOLCHAIN_URL}/${checksums}"; then
 
1225
                # Cleanup
 
1226
                rm -rf "${tmp}"
 
1227
 
 
1228
                return 1
 
1229
        fi
 
1230
 
 
1231
        # Check integrity
 
1232
        if ! b2sum --quiet --check "${tmp}/${checksums}"; then
 
1233
                # Cleanup
 
1234
                rm -rf "${tmp}"
 
1235
 
 
1236
                return 1
 
1237
        fi
 
1238
 
 
1239
        # Everything is good, move the files to their destination
 
1240
        if ! mv \
 
1241
                        "${tmp}/${toolchain}" \
 
1242
                        "${tmp}/${checksums}" \
 
1243
                        "${TOOLCHAIN_DIR}"; then
 
1244
                # Cleanup
 
1245
                rm -rf "${tmp}"
 
1246
 
 
1247
                return 1
 
1248
        fi
 
1249
 
 
1250
        # Cleanup
 
1251
        rm -rf "${tmp}"
 
1252
 
 
1253
        return 0
 
1254
}
 
1255
 
 
1256
# Extracts the toolchain
 
1257
extract_toolchain() {
 
1258
        local toolchain="${1}"
 
1259
 
 
1260
        local build_dir="${BUILD_DIR#${BASEDIR}/}"
 
1261
        local log_dir="${LOG_DIR#${BASEDIR}/}"
 
1262
 
 
1263
        local args=(
 
1264
                # Extract
 
1265
                "ax"
 
1266
 
 
1267
                # The file to extract
 
1268
                "-f" "${TOOLCHAIN_DIR}/${toolchain}"
 
1269
 
 
1270
                # The destination
 
1271
                "-C" "${BASEDIR}"
 
1272
 
 
1273
                # Transform any older toolchains
 
1274
                "--transform" "s@^build/@${build_dir}/@"
 
1275
                "--transform" "s@^log/@${log_dir}/@"
 
1276
        )
 
1277
 
 
1278
        # Extract the toolchain
 
1279
        tar "${args[@]}" || return $?
 
1280
}
 
1281
 
 
1282
# Compresses the toolchain
 
1283
compress_toolchain() {
 
1284
        local toolchain="${1}"
 
1285
 
 
1286
        log "Creating toolchain image for ${BUILD_ARCH}"
 
1287
 
 
1288
        # Create a temporary directory
 
1289
        local tmp="$(mktemp -d)"
 
1290
 
 
1291
        # Make the name for the checksum file
 
1292
        local checksums="${toolchain/.tar.zst/.b2}"
 
1293
 
 
1294
        local build_dir="${BUILD_DIR#${BASEDIR}/}"
 
1295
        local log_dir="${LOG_DIR#${BASEDIR}/}"
 
1296
 
 
1297
        local args=(
 
1298
                "--create"
 
1299
 
 
1300
                # Filter through zstd with custom options
 
1301
                "-I" "zstd ${ZSTD_OPT}"
 
1302
 
 
1303
                # Write to the temporary directory
 
1304
                "-f" "${tmp}/${toolchain}"
 
1305
 
 
1306
                # Start in the base directory
 
1307
                "-C" "${BASEDIR}"
 
1308
 
 
1309
                # Exclude the build logs
 
1310
                "--exclude" "${log_dir}/_build.*.log"
 
1311
 
 
1312
                # Include /bin/sh
 
1313
                "${build_dir}/bin/sh"
 
1314
 
 
1315
                # Include the /tools_${BUILD_ARCH} directory
 
1316
                "${build_dir}/${TOOLS_DIR}"
 
1317
 
 
1318
                # Include the log directory
 
1319
                "${log_dir}"
 
1320
        )
 
1321
 
 
1322
        # Create the archive
 
1323
        if ! tar "${args[@]}"; then
 
1324
                # Cleanup
 
1325
                rm -rf "${tmp}"
 
1326
 
 
1327
                return 1
 
1328
        fi
 
1329
 
 
1330
        # Create the checksums
 
1331
        if ! b2sum "${tmp}/${toolchain}" > "${tmp}/${checksums}"; then
 
1332
                # Cleanup
 
1333
                rm -rf "${tmp}"
 
1334
 
 
1335
                return 1
 
1336
        fi
 
1337
 
 
1338
        # Everything is good, move the files to their destination
 
1339
        if ! mv \
 
1340
                        "${tmp}/${toolchain}" \
 
1341
                        "${tmp}/${checksums}" \
 
1342
                        "${TOOLCHAIN_DIR}"; then
 
1343
                # Cleanup
 
1344
                rm -rf "${tmp}"
 
1345
 
 
1346
                return 1
 
1347
        fi
 
1348
 
 
1349
        return 0
 
1350
}
 
1351
 
 
1352
build_toolchain() {
960
1353
        local gcc=$(type -p gcc)
961
1354
        if [ -z "${gcc}" ]; then
962
1355
                exiterror "Could not find GCC. You will need a working build enviroment in order to build the toolchain."
975
1368
                exiterror "Could not create ${TOOLS_DIR} symbolic link"
976
1369
        fi
977
1370
 
978
 
        LOGFILE="$BASEDIR/log/_build.toolchain.log"
979
 
        export LOGFILE
 
1371
        local LOGFILE="${LOG_DIR}/_build.toolchain.log"
980
1372
 
981
1373
        lfsmake1 stage1
982
1374
        lfsmake1 binutils                       PASS=1
1021
1413
        lfsmake1 cleanup-toolchain
1022
1414
}
1023
1415
 
1024
 
buildbase() {
1025
 
        LOGFILE="$BASEDIR/log/_build.base.log"
1026
 
        export LOGFILE
 
1416
build_system() {
 
1417
        local LOGFILE="${LOG_DIR}/_build.${SNAME}.log"
 
1418
 
1027
1419
        lfsmake2 stage2
1028
1420
        lfsmake2 linux                  KCFG="-headers"
1029
1421
        lfsmake2 man-pages
1093
1485
        lfsmake2 vim
1094
1486
        lfsmake2 e2fsprogs
1095
1487
        lfsmake2 jq
1096
 
}
1097
 
 
1098
 
buildipfire() {
1099
 
  LOGFILE="$BASEDIR/log/_build.ipfire.log"
1100
 
  export LOGFILE
1101
 
  lfsmake2 configroot
1102
 
  lfsmake2 initscripts
1103
 
  lfsmake2 backup
1104
 
  lfsmake2 rust
1105
 
  lfsmake2 openssl
1106
 
  lfsmake2 kmod
1107
 
  lfsmake2 udev
1108
 
  lfsmake2 popt
1109
 
  lfsmake2 libedit
1110
 
  lfsmake2 libusb
1111
 
  lfsmake2 libpcap
1112
 
  lfsmake2 ppp
1113
 
  lfsmake2 pptp
1114
 
  lfsmake2 unzip
1115
 
  lfsmake2 which
1116
 
  lfsmake2 bc
1117
 
  lfsmake2 u-boot MKIMAGE=1
1118
 
  lfsmake2 cpio
1119
 
  lfsmake2 mdadm
1120
 
  lfsmake2 dracut
1121
 
  lfsmake2 libaio
1122
 
  lfsmake2 lvm2
1123
 
  lfsmake2 multipath-tools
1124
 
  lfsmake2 freetype
1125
 
  lfsmake2 libmnl
1126
 
  lfsmake2 libnfnetlink
1127
 
  lfsmake2 libnetfilter_queue
1128
 
  lfsmake2 libnetfilter_conntrack
1129
 
  lfsmake2 libnetfilter_cthelper
1130
 
  lfsmake2 libnetfilter_cttimeout
1131
 
  lfsmake2 iptables
1132
 
  lfsmake2 iproute2
1133
 
  lfsmake2 screen
1134
 
  lfsmake2 elfutils
1135
 
  lfsmake2 expat
1136
 
  lfsmake2 libconfig
1137
 
  lfsmake2 curl
1138
 
  lfsmake2 libarchive
1139
 
  lfsmake2 cmake
1140
 
  lfsmake2 json-c
1141
 
  lfsmake2 tcl
1142
 
  lfsmake2 libffi
1143
 
  lfsmake2 gdbm
1144
 
  lfsmake2 sqlite
1145
 
  lfsmake2 python3
1146
 
  lfsmake2 python3-setuptools
1147
 
  lfsmake2 ninja
1148
 
  lfsmake2 meson
1149
 
  lfsmake2 glib
1150
 
  lfsmake2 libgudev
1151
 
  lfsmake2 libgpg-error
1152
 
  lfsmake2 libgcrypt
1153
 
  lfsmake2 libassuan
1154
 
  lfsmake2 nettle
1155
 
  lfsmake2 libsodium
1156
 
  lfsmake2 libevent2
1157
 
  lfsmake2 apr
1158
 
  lfsmake2 aprutil
1159
 
  lfsmake2 unbound
1160
 
  lfsmake2 gnutls
1161
 
  lfsmake2 libuv
1162
 
  lfsmake2 bind
1163
 
  lfsmake2 dhcp
1164
 
  lfsmake2 dhcpcd
1165
 
  lfsmake2 boost
1166
 
  lfsmake2 linux-atm
1167
 
  lfsmake2 libqmi
1168
 
  lfsmake2 pam
1169
 
  lfsmake2 c-ares
1170
 
  lfsmake2 rust-dissimilar
1171
 
  lfsmake2 rust-cfg-if
1172
 
  lfsmake2 rust-libc
1173
 
  lfsmake2 rust-getrandom
1174
 
  lfsmake2 rust-typenum
1175
 
  lfsmake2 rust-version-check
1176
 
  lfsmake2 rust-generic-array
1177
 
  lfsmake2 rust-crypto-common
1178
 
  lfsmake2 rust-cipher
1179
 
  lfsmake2 rust-hex
1180
 
  lfsmake2 rust-unicode-xid
1181
 
  lfsmake2 rust-proc-macro2
1182
 
  lfsmake2 rust-quote
1183
 
  lfsmake2 rust-syn
1184
 
  lfsmake2 rust-home
1185
 
  lfsmake2 rust-lazy-static
1186
 
  lfsmake2 rust-memchr
1187
 
  lfsmake2 rust-aho-corasick
1188
 
  lfsmake2 rust-regex-syntax
1189
 
  lfsmake2 rust-regex
1190
 
  lfsmake2 rust-ucd-trie
1191
 
  lfsmake2 rust-pest
1192
 
  lfsmake2 rust-semver-parser
1193
 
  lfsmake2 rust-semver
1194
 
  lfsmake2 rust-same-file
1195
 
  lfsmake2 rust-walkdir
1196
 
  lfsmake2 rust-dirs
1197
 
  lfsmake2 rust-toolchain_find
1198
 
  lfsmake2 rust-serde
1199
 
  lfsmake2 rust-itoa
1200
 
  lfsmake2 rust-ryu
1201
 
  lfsmake2 rust-serde_json
1202
 
  lfsmake2 rust-synstructure
1203
 
  lfsmake2 rust-block-buffer
1204
 
  lfsmake2 rust-digest
1205
 
  lfsmake2 rust-ppv-lite86
1206
 
  lfsmake2 rust-rand_core
1207
 
  lfsmake2 rust-rand_core-0.4.2
1208
 
  lfsmake2 rust-rand_core-0.3.1
1209
 
  lfsmake2 rust-rand_chacha
1210
 
  lfsmake2 rust-rand_hc
1211
 
  lfsmake2 rust-rand
1212
 
  lfsmake2 rust-rdrand
1213
 
  lfsmake2 rust-rand-0.4
1214
 
  lfsmake2 rust-log
1215
 
  lfsmake2 rust-num_cpus
1216
 
  lfsmake2 rust-crossbeam-utils
1217
 
  lfsmake2 rust-autocfg
1218
 
  lfsmake2 rust-memoffset
1219
 
  lfsmake2 rust-scopeguard
1220
 
  lfsmake2 rust-crossbeam-epoch
1221
 
  lfsmake2 rust-crossbeam-deque
1222
 
  lfsmake2 rust-either
1223
 
  lfsmake2 rust-crossbeam-channel
1224
 
  lfsmake2 rust-rayon-core
1225
 
  lfsmake2 rust-rayon
1226
 
  lfsmake2 rust-remove_dir_all
1227
 
  lfsmake2 rust-tempdir
1228
 
  lfsmake2 rust-glob
1229
 
  lfsmake2 rust-once_cell
1230
 
  lfsmake2 rust-termcolor
1231
 
  lfsmake2 rust-toml
1232
 
  lfsmake2 rust-serde_derive
1233
 
  lfsmake2 rust-trybuild
1234
 
  lfsmake2 rust-unindent
1235
 
  lfsmake2 rust-proc-macro-hack
1236
 
  lfsmake2 rust-indoc-impl
1237
 
  lfsmake2 rust-indoc
1238
 
  lfsmake2 rust-indoc-0.3.6
1239
 
  lfsmake2 rust-instant
1240
 
  lfsmake2 rust-lock_api
1241
 
  lfsmake2 rust-smallvec
1242
 
  lfsmake2 rust-parking_lot_core
1243
 
  lfsmake2 rust-parking_lot
1244
 
  lfsmake2 rust-paste-impl
1245
 
  lfsmake2 rust-paste
1246
 
  lfsmake2 rust-paste-0.1.18
1247
 
  lfsmake2 rust-ctor
1248
 
  lfsmake2 rust-ghost
1249
 
  lfsmake2 rust-inventory-impl
1250
 
  lfsmake2 rust-inventory
1251
 
  lfsmake2 rust-pyo3-build-config
1252
 
  lfsmake2 rust-pyo3-macros-backend
1253
 
  lfsmake2 rust-pyo3-macros
1254
 
  lfsmake2 rust-pyo3
1255
 
  lfsmake2 rust-num-traits
1256
 
  lfsmake2 rust-num-integer
1257
 
  lfsmake2 rust-num_threads
1258
 
  lfsmake2 rust-time
1259
 
  lfsmake2 rust-iana-time-zone
1260
 
  lfsmake2 rust-chrono
1261
 
  lfsmake2 rust-asn1_derive
1262
 
  lfsmake2 rust-asn1
1263
 
  lfsmake2 rust-proc-macro-error-attr
1264
 
  lfsmake2 rust-proc-macro-error
1265
 
  lfsmake2 rust-Inflector
1266
 
  lfsmake2 rust-ouroboros_macro
1267
 
  lfsmake2 rust-aliasable
1268
 
  lfsmake2 rust-stable_deref_trait
1269
 
  lfsmake2 rust-ouroboros
1270
 
  lfsmake2 rust-base64
1271
 
  lfsmake2 rust-pem
1272
 
  lfsmake2 gdb
1273
 
  lfsmake2 grub
1274
 
  lfsmake2 mandoc
1275
 
  lfsmake2 efivar
1276
 
  lfsmake2 efibootmgr
1277
 
  lfsmake2 libtasn1
1278
 
  lfsmake2 p11-kit
1279
 
  lfsmake2 ca-certificates
1280
 
  lfsmake2 fireinfo
1281
 
  lfsmake2 libnet
1282
 
  lfsmake2 libnl-3
1283
 
  lfsmake2 libidn
1284
 
  lfsmake2 nasm
1285
 
  lfsmake2 libjpeg
1286
 
  lfsmake2 openjpeg
1287
 
  lfsmake2 libexif
1288
 
  lfsmake2 libpng
1289
 
  lfsmake2 libtiff
1290
 
  lfsmake2 gd
1291
 
  lfsmake2 slang
1292
 
  lfsmake2 newt
1293
 
  lfsmake2 libsmooth
1294
 
  lfsmake2 libcap
1295
 
  lfsmake2 libcap-ng
1296
 
  lfsmake2 pciutils
1297
 
  lfsmake2 usbutils
1298
 
  lfsmake2 libxml2
1299
 
  lfsmake2 libxslt
1300
 
  lfsmake2 perl-BerkeleyDB
1301
 
  lfsmake2 cyrus-sasl
1302
 
  lfsmake2 openldap
1303
 
  lfsmake2 apache2
1304
 
  lfsmake2 web-user-interface
1305
 
  lfsmake2 flag-icons
1306
 
  lfsmake2 jquery
1307
 
  lfsmake2 bootstrap
1308
 
  lfsmake2 arping
1309
 
  lfsmake2 beep
1310
 
  lfsmake2 libssh
1311
 
  lfsmake2 libinih
1312
 
  lfsmake2 cdrkit
1313
 
  lfsmake2 dosfstools
1314
 
  lfsmake2 exfatprogs
1315
 
  lfsmake2 reiserfsprogs
1316
 
  lfsmake2 liburcu
1317
 
  lfsmake2 xfsprogs
1318
 
  lfsmake2 sysfsutils
1319
 
  lfsmake2 fuse
1320
 
  lfsmake2 ntfs-3g
1321
 
  lfsmake2 ethtool
1322
 
  lfsmake2 fcron
1323
 
  lfsmake2 perl-ExtUtils-PkgConfig
1324
 
  lfsmake2 perl-GD
1325
 
  lfsmake2 perl-GD-Graph
1326
 
  lfsmake2 perl-GD-TextUtil
1327
 
  lfsmake2 perl-Device-SerialPort
1328
 
  lfsmake2 perl-Device-Modem
1329
 
  lfsmake2 perl-Apache-Htpasswd
1330
 
  lfsmake2 perl-Parse-Yapp
1331
 
  lfsmake2 perl-Data-UUID
1332
 
  lfsmake2 perl-Try-Tiny
1333
 
  lfsmake2 perl-HTTP-Message
1334
 
  lfsmake2 perl-HTTP-Date
1335
 
  lfsmake2 gnupg
1336
 
  lfsmake2 hdparm
1337
 
  lfsmake2 whatmask
1338
 
  lfsmake2 libtirpc
1339
 
  lfsmake2 conntrack-tools
1340
 
  lfsmake2 iputils
1341
 
  lfsmake2 l7-protocols
1342
 
  lfsmake2 hwdata
1343
 
  lfsmake2 logrotate
1344
 
  lfsmake2 logwatch
1345
 
  lfsmake2 misc-progs
1346
 
  lfsmake2 nano
1347
 
  lfsmake2 perl-URI
1348
 
  lfsmake2 perl-CGI
1349
 
  lfsmake2 perl-Switch
1350
 
  lfsmake2 perl-HTML-Tagset
1351
 
  lfsmake2 perl-HTML-Parser
1352
 
  lfsmake2 perl-HTML-Template
1353
 
  lfsmake2 perl-Compress-Zlib
1354
 
  lfsmake2 perl-Digest
1355
 
  lfsmake2 perl-Digest-SHA1
1356
 
  lfsmake2 perl-Digest-HMAC
1357
 
  lfsmake2 perl-libwww
1358
 
  lfsmake2 perl-LWP-Protocol-https
1359
 
  lfsmake2 perl-Net-HTTP
1360
 
  lfsmake2 perl-Net-DNS
1361
 
  lfsmake2 perl-Net-IPv4Addr
1362
 
  lfsmake2 perl-Net_SSLeay
1363
 
  lfsmake2 perl-IO-Stringy
1364
 
  lfsmake2 perl-IO-Socket-SSL
1365
 
  lfsmake2 perl-Unix-Syslog
1366
 
  lfsmake2 perl-Mail-Tools
1367
 
  lfsmake2 perl-MIME-Tools
1368
 
  lfsmake2 perl-Net-Server
1369
 
  lfsmake2 perl-Canary-Stability
1370
 
  lfsmake2 perl-Convert-TNEF
1371
 
  lfsmake2 perl-Convert-UUlib
1372
 
  lfsmake2 perl-Archive-Tar
1373
 
  lfsmake2 perl-Archive-Zip
1374
 
  lfsmake2 perl-Text-Tabs+Wrap
1375
 
  lfsmake2 perl-XML-Parser
1376
 
  lfsmake2 perl-Crypt-PasswdMD5
1377
 
  lfsmake2 perl-Net-Telnet
1378
 
  lfsmake2 perl-JSON
1379
 
  lfsmake2 python3-inotify
1380
 
  lfsmake2 python3-docutils
1381
 
  lfsmake2 python3-daemon
1382
 
  lfsmake2 ntp
1383
 
  lfsmake2 openssh
1384
 
  lfsmake2 fontconfig
1385
 
  lfsmake2 dejavu-fonts-ttf
1386
 
  lfsmake2 ubuntu-font-family
1387
 
  lfsmake2 freefont
1388
 
  lfsmake2 pixman
1389
 
  lfsmake2 cairo
1390
 
  lfsmake2 harfbuzz
1391
 
  lfsmake2 fribidi
1392
 
  lfsmake2 pango
1393
 
  lfsmake2 rrdtool
1394
 
  lfsmake2 setup
1395
 
  lfsmake2 jansson
1396
 
  lfsmake2 yaml
1397
 
  lfsmake2 libhtp
1398
 
  lfsmake2 colm
1399
 
  lfsmake2 ragel
1400
 
  lfsmake2 hyperscan
1401
 
  lfsmake2 suricata
1402
 
  lfsmake2 ids-ruleset-sources
1403
 
  lfsmake2 ipblocklist-sources
1404
 
  lfsmake2 squid
1405
 
  lfsmake2 squidguard
1406
 
  lfsmake2 calamaris
1407
 
  lfsmake2 tcpdump
1408
 
  lfsmake2 traceroute
1409
 
  lfsmake2 vlan
1410
 
  lfsmake2 wireless
1411
 
  lfsmake2 pakfire
1412
 
  lfsmake2 lz4
1413
 
  lfsmake2 lzo
1414
 
  lfsmake2 openvpn
1415
 
  lfsmake2 mpage
1416
 
  lfsmake2 dbus
1417
 
  lfsmake2 intltool
1418
 
  lfsmake2 libdaemon
1419
 
  lfsmake2 avahi
1420
 
  lfsmake2 cups
1421
 
  lfsmake2 lcms2
1422
 
  lfsmake2 ghostscript
1423
 
  lfsmake2 qpdf
1424
 
  lfsmake2 poppler
1425
 
  lfsmake2 poppler-data
1426
 
  lfsmake2 cups-filters
1427
 
  lfsmake2 epson-inkjet-printer-escpr
1428
 
  lfsmake2 cups-pdf
1429
 
  lfsmake2 foomatic
1430
 
  lfsmake2 hplip
1431
 
  lfsmake2 cifs-utils
1432
 
  lfsmake2 krb5
1433
 
  lfsmake2 rpcsvc-proto
1434
 
  lfsmake2 samba
1435
 
  lfsmake2 netatalk
1436
 
  lfsmake2 sudo
1437
 
  lfsmake2 mc
1438
 
  lfsmake2 wget
1439
 
  lfsmake2 bridge-utils
1440
 
  lfsmake2 smartmontools
1441
 
  lfsmake2 htop
1442
 
  lfsmake2 chkconfig
1443
 
  lfsmake2 postfix
1444
 
  lfsmake2 fetchmail
1445
 
  lfsmake2 clamav
1446
 
  lfsmake2 perl-NetAddr-IP
1447
 
  lfsmake2 dma
1448
 
  lfsmake2 alsa
1449
 
  lfsmake2 mpfire
1450
 
  lfsmake2 guardian
1451
 
  lfsmake2 libid3tag
1452
 
  lfsmake2 libmad
1453
 
  lfsmake2 libogg
1454
 
  lfsmake2 libvorbis
1455
 
  lfsmake2 flac
1456
 
  lfsmake2 lame
1457
 
  lfsmake2 soxr
1458
 
  lfsmake2 libshout
1459
 
  lfsmake2 xvid
1460
 
  lfsmake2 libmpeg2
1461
 
  lfsmake2 gnump3d
1462
 
  lfsmake2 rsync
1463
 
  lfsmake2 rpcbind
1464
 
  lfsmake2 keyutils
1465
 
  lfsmake2 nfs
1466
 
  lfsmake2 ncat
1467
 
  lfsmake2 nmap
1468
 
  lfsmake2 etherwake
1469
 
  lfsmake2 bwm-ng
1470
 
  lfsmake2 sysstat
1471
 
  lfsmake2 strongswan
1472
 
  lfsmake2 rng-tools
1473
 
  lfsmake2 lsof
1474
 
  lfsmake2 br2684ctl
1475
 
  lfsmake2 lm_sensors
1476
 
  lfsmake2 libstatgrab
1477
 
  lfsmake2 liboping
1478
 
  lfsmake2 collectd
1479
 
  lfsmake2 git
1480
 
  lfsmake2 linux-firmware
1481
 
  lfsmake2 dvb-firmwares
1482
 
  lfsmake2 zd1211-firmware
1483
 
  lfsmake2 rpi-firmware
1484
 
  lfsmake2 intel-microcode
1485
 
  lfsmake2 pcengines-apu-firmware
1486
 
  lfsmake2 elinks
1487
 
  lfsmake2 igmpproxy
1488
 
  lfsmake2 opus
1489
 
  lfsmake2 python3-toml
1490
 
  lfsmake2 python3-pyproject2setuppy
1491
 
  lfsmake2 python3-pyparsing
1492
 
  lfsmake2 spice-protocol
1493
 
  lfsmake2 spice
1494
 
  lfsmake2 sdl2
1495
 
  lfsmake2 libusbredir
1496
 
  lfsmake2 libseccomp
1497
 
  lfsmake2 libslirp
1498
 
  lfsmake2 qemu
1499
 
  lfsmake2 netsnmpd
1500
 
  lfsmake2 nagios_nrpe
1501
 
  lfsmake2 nagios-plugins
1502
 
  lfsmake2 icinga
1503
 
  lfsmake2 observium-agent
1504
 
  lfsmake2 ebtables
1505
 
  lfsmake2 faad2
1506
 
  lfsmake2 alac
1507
 
  lfsmake2 ffmpeg
1508
 
  lfsmake2 vdr
1509
 
  lfsmake2 vdr_streamdev
1510
 
  lfsmake2 vdr_epgsearch
1511
 
  lfsmake2 vdr_dvbapi
1512
 
  lfsmake2 vdr_eepg
1513
 
  lfsmake2 w_scan
1514
 
  lfsmake2 fmt
1515
 
  lfsmake2 mpd
1516
 
  lfsmake2 libmpdclient
1517
 
  lfsmake2 mpc
1518
 
  lfsmake2 perl-Net-CIDR-Lite
1519
 
  lfsmake2 perl-Net-SMTP-SSL
1520
 
  lfsmake2 perl-MIME-Base64
1521
 
  lfsmake2 perl-Authen-SASL
1522
 
  lfsmake2 perl-MIME-Lite
1523
 
  lfsmake2 perl-Email-Date-Format
1524
 
  lfsmake2 vnstat
1525
 
  lfsmake2 iw
1526
 
  lfsmake2 wpa_supplicant
1527
 
  lfsmake2 hostapd
1528
 
  lfsmake2 syslinux
1529
 
  lfsmake2 tftpd
1530
 
  lfsmake2 cpufrequtils
1531
 
  lfsmake2 gutenprint
1532
 
  lfsmake2 apcupsd
1533
 
  lfsmake2 fireperf
1534
 
  lfsmake2 iperf
1535
 
  lfsmake2 iperf3
1536
 
  lfsmake2 7zip
1537
 
  lfsmake2 lynis
1538
 
  lfsmake2 sshfs
1539
 
  lfsmake2 taglib
1540
 
  lfsmake2 sslh
1541
 
  lfsmake2 perl-gettext
1542
 
  lfsmake2 perl-Sort-Naturally
1543
 
  lfsmake2 vdradmin
1544
 
  lfsmake2 perl-DBI
1545
 
  lfsmake2 perl-DBD-SQLite
1546
 
  lfsmake2 perl-File-ReadBackwards
1547
 
  lfsmake2 openvmtools
1548
 
  lfsmake2 joe
1549
 
  lfsmake2 monit
1550
 
  lfsmake2 nut
1551
 
  lfsmake2 watchdog
1552
 
  lfsmake2 usb_modeswitch
1553
 
  lfsmake2 usb_modeswitch_data
1554
 
  lfsmake2 zerofree
1555
 
  lfsmake2 minicom
1556
 
  lfsmake2 ddrescue
1557
 
  lfsmake2 parted
1558
 
  lfsmake2 swig
1559
 
  lfsmake2 dtc
1560
 
  lfsmake2 u-boot
1561
 
  lfsmake2 wireless-regdb
1562
 
  lfsmake2 ddns
1563
 
  lfsmake2 python3-pycparser
1564
 
  lfsmake2 python3-charset-normalizer
1565
 
  lfsmake2 python3-certifi
1566
 
  lfsmake2 python3-idna
1567
 
  lfsmake2 python3-requests
1568
 
  lfsmake2 python3-tomli
1569
 
  lfsmake2 python3-pep517
1570
 
  lfsmake2 python3-build
1571
 
  lfsmake2 python3-install
1572
 
  lfsmake2 python3-urllib3
1573
 
  lfsmake2 python3-flit
1574
 
  lfsmake2 python3-packaging
1575
 
  lfsmake2 python3-typing-extensions
1576
 
  lfsmake2 python3-semantic-version
1577
 
  lfsmake2 python3-setuptools-scm
1578
 
  lfsmake2 python3-setuptools-rust
1579
 
  lfsmake2 python3-six
1580
 
  lfsmake2 python3-dateutil
1581
 
  lfsmake2 python3-jmespath
1582
 
  lfsmake2 python3-colorama
1583
 
  lfsmake2 python3-yaml
1584
 
  lfsmake2 python3-s3transfer
1585
 
  lfsmake2 python3-rsa
1586
 
  lfsmake2 python3-pyasn1
1587
 
  lfsmake2 python3-botocore
1588
 
  lfsmake2 python3-cffi
1589
 
  lfsmake2 python3-cryptography
1590
 
  lfsmake2 python3-circuitbreaker
1591
 
  lfsmake2 python3-pytz
1592
 
  lfsmake2 python3-click
1593
 
  lfsmake2 python3-arrow
1594
 
  lfsmake2 python3-terminaltables
1595
 
  lfsmake2 python3-pkgconfig
1596
 
  lfsmake2 python3-msgpack
1597
 
  lfsmake2 python3-attrs
1598
 
  lfsmake2 python3-sniffio
1599
 
  lfsmake2 python3-sortedcontainers
1600
 
  lfsmake2 python3-outcome
1601
 
  lfsmake2 python3-async_generator
1602
 
  lfsmake2 python3-flit_scm
1603
 
  lfsmake2 python3-exceptiongroup
1604
 
  lfsmake2 python3-trio
1605
 
  lfsmake2 python3-pyfuse3
1606
 
  lfsmake2 aws-cli
1607
 
  lfsmake2 oci-python-sdk
1608
 
  lfsmake2 oci-cli
1609
 
  lfsmake2 transmission
1610
 
  lfsmake2 mtr
1611
 
  lfsmake2 minidlna
1612
 
  lfsmake2 acpid
1613
 
  lfsmake2 fping
1614
 
  lfsmake2 telnet
1615
 
  lfsmake2 xinetd
1616
 
  lfsmake2 stress
1617
 
  lfsmake2 sarg
1618
 
  lfsmake2 nginx
1619
 
  lfsmake2 sysbench
1620
 
  lfsmake2 strace
1621
 
  lfsmake2 ltrace
1622
 
  lfsmake2 ipfire-netboot
1623
 
  lfsmake2 lcdproc
1624
 
  lfsmake2 keepalived
1625
 
  lfsmake2 ipvsadm
1626
 
  lfsmake2 perl-Carp-Clan
1627
 
  lfsmake2 perl-Date-Calc
1628
 
  lfsmake2 perl-Date-Manip
1629
 
  lfsmake2 perl-File-Tail
1630
 
  lfsmake2 perl-TimeDate
1631
 
  lfsmake2 swatch
1632
 
  lfsmake2 tor
1633
 
  lfsmake2 wavemon
1634
 
  lfsmake2 iptraf-ng
1635
 
  lfsmake2 iotop
1636
 
  lfsmake2 stunnel
1637
 
  lfsmake2 bacula
1638
 
  lfsmake2 perl-Font-TTF
1639
 
  lfsmake2 perl-IO-String
1640
 
  lfsmake2 perl-PDF-API2
1641
 
  lfsmake2 proxy-accounting
1642
 
  lfsmake2 tmux
1643
 
  lfsmake2 perl-Text-CSV_XS
1644
 
  lfsmake2 lua
1645
 
  lfsmake2 haproxy
1646
 
  lfsmake2 ipset
1647
 
  lfsmake2 dnsdist
1648
 
  lfsmake2 bird
1649
 
  lfsmake2 libyang
1650
 
  lfsmake2 frr
1651
 
  lfsmake2 dmidecode
1652
 
  lfsmake2 mcelog
1653
 
  lfsmake2 libpciaccess
1654
 
  lfsmake2 libyajl
1655
 
  lfsmake2 libvirt
1656
 
  lfsmake2 libtalloc
1657
 
  lfsmake2 freeradius
1658
 
  lfsmake2 perl-common-sense
1659
 
  lfsmake2 perl-inotify2
1660
 
  lfsmake2 perl-Net-IP
1661
 
  lfsmake2 wio
1662
 
  lfsmake2 iftop
1663
 
  lfsmake2 mdns-repeater
1664
 
  lfsmake2 i2c-tools
1665
 
  lfsmake2 nss-myhostname
1666
 
  lfsmake2 dehydrated
1667
 
  lfsmake2 libplist
1668
 
  lfsmake2 nqptp
1669
 
  lfsmake2 shairport-sync
1670
 
  lfsmake2 borgbackup
1671
 
  lfsmake2 lmdb
1672
 
  lfsmake2 knot
1673
 
  lfsmake2 spectre-meltdown-checker
1674
 
  lfsmake2 zabbix_agentd
1675
 
  lfsmake2 flashrom
1676
 
  lfsmake2 firmware-update
1677
 
  lfsmake2 tshark
1678
 
  lfsmake2 speedtest-cli
1679
 
  lfsmake2 amazon-ssm-agent
1680
 
  lfsmake2 libloc
1681
 
  lfsmake2 ncdu
1682
 
  lfsmake2 lshw
1683
 
  lfsmake2 socat
1684
 
  lfsmake2 libcdada
1685
 
  lfsmake2 pmacct
1686
 
  lfsmake2 squid-asnbl
1687
 
  lfsmake2 qemu-ga
1688
 
  lfsmake2 gptfdisk
1689
 
  lfsmake2 oath-toolkit
1690
 
  lfsmake2 qrencode
1691
 
  lfsmake2 perl-File-Remove
1692
 
  lfsmake2 perl-Module-Build
1693
 
  lfsmake2 perl-Module-ScanDeps
1694
 
  lfsmake2 perl-YAML-Tiny
1695
 
  lfsmake2 perl-Module-Install
1696
 
  lfsmake2 perl-Imager
1697
 
  lfsmake2 perl-Imager-QRCode
1698
 
  lfsmake2 perl-MIME-Base32
1699
 
  lfsmake2 perl-URI-Encode
1700
 
  lfsmake2 rsnapshot
1701
 
 
1702
 
  # Kernelbuild ... current we have no platform that need
1703
 
  # multi kernel builds so KCFG is empty
1704
 
  lfsmake2 linux                KCFG=""
1705
 
  lfsmake2 rtl8189es            KCFG=""
1706
 
  lfsmake2 rtl8189fs            KCFG=""
1707
 
  lfsmake2 rtl8812au            KCFG=""
1708
 
  lfsmake2 rtl8822bu            KCFG=""
1709
 
  lfsmake2 rtl8821cu            KCFG=""
1710
 
  lfsmake2 linux-initrd         KCFG=""
1711
 
}
1712
 
 
1713
 
buildinstaller() {
1714
 
  # Run installer scripts one by one
1715
 
  LOGFILE="$BASEDIR/log/_build.installer.log"
1716
 
  export LOGFILE
1717
 
  lfsmake2 memtest
1718
 
  lfsmake2 installer
1719
 
  # use toolchain bash for chroot to strip
1720
 
  CUSTOM_PATH="${TOOLS_DIR}/bin" lfsmake2 strip
 
1488
        lfsmake2 configroot
 
1489
        lfsmake2 initscripts
 
1490
        lfsmake2 backup
 
1491
        lfsmake2 rust
 
1492
        lfsmake2 openssl
 
1493
        lfsmake2 popt
 
1494
        lfsmake2 libedit
 
1495
        lfsmake2 pam
 
1496
        lfsmake2 libcap
 
1497
        lfsmake2 libcap-ng
 
1498
        lfsmake2 libpcap
 
1499
        lfsmake2 ppp
 
1500
        lfsmake2 pptp
 
1501
        lfsmake2 unzip
 
1502
        lfsmake2 which
 
1503
        lfsmake2 bc
 
1504
        lfsmake2 cpio
 
1505
        lfsmake2 libaio
 
1506
        lfsmake2 freetype
 
1507
        lfsmake2 libmnl
 
1508
        lfsmake2 libnfnetlink
 
1509
        lfsmake2 libnetfilter_queue
 
1510
        lfsmake2 libnetfilter_conntrack
 
1511
        lfsmake2 libnetfilter_cthelper
 
1512
        lfsmake2 libnetfilter_cttimeout
 
1513
        lfsmake2 iptables
 
1514
        lfsmake2 iproute2
 
1515
        lfsmake2 screen
 
1516
        lfsmake2 elfutils
 
1517
        lfsmake2 expat
 
1518
        lfsmake2 libconfig
 
1519
        lfsmake2 curl
 
1520
        lfsmake2 libarchive
 
1521
        lfsmake2 cmake
 
1522
        lfsmake2 json-c
 
1523
        lfsmake2 tcl
 
1524
        lfsmake2 libffi
 
1525
        lfsmake2 gdbm
 
1526
        lfsmake2 sqlite
 
1527
        lfsmake2 python3
 
1528
        lfsmake2 python3-setuptools
 
1529
        lfsmake2 python3-MarkupSafe
 
1530
        lfsmake2 python3-Jinja2
 
1531
        lfsmake2 ninja
 
1532
        lfsmake2 meson
 
1533
        lfsmake2 kmod
 
1534
        lfsmake2 udev
 
1535
        lfsmake2 libusb
 
1536
        lfsmake2 mdadm
 
1537
        lfsmake2 dracut
 
1538
        lfsmake2 lvm2
 
1539
        lfsmake2 multipath-tools
 
1540
        lfsmake2 glib
 
1541
        lfsmake2 libgudev
 
1542
        lfsmake2 libgpg-error
 
1543
        lfsmake2 libgcrypt
 
1544
        lfsmake2 libassuan
 
1545
        lfsmake2 nettle
 
1546
        lfsmake2 libsodium
 
1547
        lfsmake2 libevent2
 
1548
        lfsmake2 apr
 
1549
        lfsmake2 aprutil
 
1550
        lfsmake2 unbound
 
1551
        lfsmake2 gnutls
 
1552
        lfsmake2 libuv
 
1553
        lfsmake2 bind
 
1554
        lfsmake2 dhcp
 
1555
        lfsmake2 dhcpcd
 
1556
        lfsmake2 boost
 
1557
        lfsmake2 linux-atm
 
1558
        lfsmake2 libqmi
 
1559
        lfsmake2 c-ares
 
1560
        lfsmake2 rust-dissimilar
 
1561
        lfsmake2 rust-cfg-if
 
1562
        lfsmake2 rust-libc
 
1563
        lfsmake2 rust-getrandom
 
1564
        lfsmake2 rust-typenum
 
1565
        lfsmake2 rust-version-check
 
1566
        lfsmake2 rust-generic-array
 
1567
        lfsmake2 rust-crypto-common
 
1568
        lfsmake2 rust-cipher
 
1569
        lfsmake2 rust-hex
 
1570
        lfsmake2 rust-unicode-xid
 
1571
        lfsmake2 rust-proc-macro2
 
1572
        lfsmake2 rust-quote
 
1573
        lfsmake2 rust-syn
 
1574
        lfsmake2 rust-home
 
1575
        lfsmake2 rust-lazy-static
 
1576
        lfsmake2 rust-memchr
 
1577
        lfsmake2 rust-aho-corasick
 
1578
        lfsmake2 rust-regex-syntax
 
1579
        lfsmake2 rust-regex
 
1580
        lfsmake2 rust-ucd-trie
 
1581
        lfsmake2 rust-pest
 
1582
        lfsmake2 rust-semver-parser
 
1583
        lfsmake2 rust-semver
 
1584
        lfsmake2 rust-same-file
 
1585
        lfsmake2 rust-walkdir
 
1586
        lfsmake2 rust-dirs
 
1587
        lfsmake2 rust-toolchain_find
 
1588
        lfsmake2 rust-serde
 
1589
        lfsmake2 rust-itoa
 
1590
        lfsmake2 rust-ryu
 
1591
        lfsmake2 rust-serde_json
 
1592
        lfsmake2 rust-synstructure
 
1593
        lfsmake2 rust-block-buffer
 
1594
        lfsmake2 rust-digest
 
1595
        lfsmake2 rust-ppv-lite86
 
1596
        lfsmake2 rust-rand_core
 
1597
        lfsmake2 rust-rand_core-0.4.2
 
1598
        lfsmake2 rust-rand_core-0.3.1
 
1599
        lfsmake2 rust-rand_chacha
 
1600
        lfsmake2 rust-rand_hc
 
1601
        lfsmake2 rust-rand
 
1602
        lfsmake2 rust-rdrand
 
1603
        lfsmake2 rust-rand-0.4
 
1604
        lfsmake2 rust-log
 
1605
        lfsmake2 rust-num_cpus
 
1606
        lfsmake2 rust-crossbeam-utils
 
1607
        lfsmake2 rust-autocfg
 
1608
        lfsmake2 rust-memoffset
 
1609
        lfsmake2 rust-scopeguard
 
1610
        lfsmake2 rust-crossbeam-epoch
 
1611
        lfsmake2 rust-crossbeam-deque
 
1612
        lfsmake2 rust-either
 
1613
        lfsmake2 rust-crossbeam-channel
 
1614
        lfsmake2 rust-rayon-core
 
1615
        lfsmake2 rust-rayon
 
1616
        lfsmake2 rust-remove_dir_all
 
1617
        lfsmake2 rust-tempdir
 
1618
        lfsmake2 rust-glob
 
1619
        lfsmake2 rust-once_cell
 
1620
        lfsmake2 rust-termcolor
 
1621
        lfsmake2 rust-toml
 
1622
        lfsmake2 rust-serde_derive
 
1623
        lfsmake2 rust-trybuild
 
1624
        lfsmake2 rust-unindent
 
1625
        lfsmake2 rust-proc-macro-hack
 
1626
        lfsmake2 rust-indoc-impl
 
1627
        lfsmake2 rust-indoc
 
1628
        lfsmake2 rust-indoc-0.3.6
 
1629
        lfsmake2 rust-instant
 
1630
        lfsmake2 rust-lock_api
 
1631
        lfsmake2 rust-smallvec
 
1632
        lfsmake2 rust-parking_lot_core
 
1633
        lfsmake2 rust-parking_lot
 
1634
        lfsmake2 rust-paste-impl
 
1635
        lfsmake2 rust-paste
 
1636
        lfsmake2 rust-paste-0.1.18
 
1637
        lfsmake2 rust-ctor
 
1638
        lfsmake2 rust-ghost
 
1639
        lfsmake2 rust-inventory-impl
 
1640
        lfsmake2 rust-inventory
 
1641
        lfsmake2 rust-pyo3-build-config
 
1642
        lfsmake2 rust-pyo3-macros-backend
 
1643
        lfsmake2 rust-pyo3-macros
 
1644
        lfsmake2 rust-pyo3
 
1645
        lfsmake2 rust-num-traits
 
1646
        lfsmake2 rust-num-integer
 
1647
        lfsmake2 rust-num_threads
 
1648
        lfsmake2 rust-time
 
1649
        lfsmake2 rust-iana-time-zone
 
1650
        lfsmake2 rust-chrono
 
1651
        lfsmake2 rust-asn1_derive
 
1652
        lfsmake2 rust-asn1
 
1653
        lfsmake2 rust-proc-macro-error-attr
 
1654
        lfsmake2 rust-proc-macro-error
 
1655
        lfsmake2 rust-Inflector
 
1656
        lfsmake2 rust-ouroboros_macro
 
1657
        lfsmake2 rust-aliasable
 
1658
        lfsmake2 rust-stable_deref_trait
 
1659
        lfsmake2 rust-ouroboros
 
1660
        lfsmake2 rust-base64
 
1661
        lfsmake2 rust-pem
 
1662
        lfsmake2 gdb
 
1663
        lfsmake2 grub
 
1664
        lfsmake2 mandoc
 
1665
        lfsmake2 efivar
 
1666
        lfsmake2 efibootmgr
 
1667
        lfsmake2 libtasn1
 
1668
        lfsmake2 p11-kit
 
1669
        lfsmake2 ca-certificates
 
1670
        lfsmake2 fireinfo
 
1671
        lfsmake2 libnet
 
1672
        lfsmake2 libnl-3
 
1673
        lfsmake2 libidn
 
1674
        lfsmake2 nasm
 
1675
        lfsmake2 libjpeg
 
1676
        lfsmake2 openjpeg
 
1677
        lfsmake2 libexif
 
1678
        lfsmake2 libpng
 
1679
        lfsmake2 libtiff
 
1680
        lfsmake2 gd
 
1681
        lfsmake2 slang
 
1682
        lfsmake2 newt
 
1683
        lfsmake2 libsmooth
 
1684
        lfsmake2 pciutils
 
1685
        lfsmake2 usbutils
 
1686
        lfsmake2 libxml2
 
1687
        lfsmake2 libxslt
 
1688
        lfsmake2 perl-BerkeleyDB
 
1689
        lfsmake2 cyrus-sasl
 
1690
        lfsmake2 openldap
 
1691
        lfsmake2 apache2
 
1692
        lfsmake2 web-user-interface
 
1693
        lfsmake2 flag-icons
 
1694
        lfsmake2 jquery
 
1695
        lfsmake2 bootstrap
 
1696
        lfsmake2 arping
 
1697
        lfsmake2 beep
 
1698
        lfsmake2 libssh
 
1699
        lfsmake2 libinih
 
1700
        lfsmake2 cdrkit
 
1701
        lfsmake2 dosfstools
 
1702
        lfsmake2 exfatprogs
 
1703
        lfsmake2 reiserfsprogs
 
1704
        lfsmake2 liburcu
 
1705
        lfsmake2 xfsprogs
 
1706
        lfsmake2 sysfsutils
 
1707
        lfsmake2 fuse
 
1708
        lfsmake2 ntfs-3g
 
1709
        lfsmake2 ethtool
 
1710
        lfsmake2 fcron
 
1711
        lfsmake2 perl-ExtUtils-PkgConfig
 
1712
        lfsmake2 perl-GD
 
1713
        lfsmake2 perl-GD-Graph
 
1714
        lfsmake2 perl-GD-TextUtil
 
1715
        lfsmake2 perl-Device-SerialPort
 
1716
        lfsmake2 perl-Device-Modem
 
1717
        lfsmake2 perl-Apache-Htpasswd
 
1718
        lfsmake2 perl-Parse-Yapp
 
1719
        lfsmake2 perl-Data-UUID
 
1720
        lfsmake2 perl-Try-Tiny
 
1721
        lfsmake2 perl-HTTP-Message
 
1722
        lfsmake2 perl-HTTP-Date
 
1723
        lfsmake2 gnupg
 
1724
        lfsmake2 hdparm
 
1725
        lfsmake2 whatmask
 
1726
        lfsmake2 libtirpc
 
1727
        lfsmake2 conntrack-tools
 
1728
        lfsmake2 iputils
 
1729
        lfsmake2 l7-protocols
 
1730
        lfsmake2 hwdata
 
1731
        lfsmake2 logrotate
 
1732
        lfsmake2 logwatch
 
1733
        lfsmake2 misc-progs
 
1734
        lfsmake2 nano
 
1735
        lfsmake2 perl-URI
 
1736
        lfsmake2 perl-CGI
 
1737
        lfsmake2 perl-Switch
 
1738
        lfsmake2 perl-HTML-Tagset
 
1739
        lfsmake2 perl-HTML-Parser
 
1740
        lfsmake2 perl-HTML-Template
 
1741
        lfsmake2 perl-Compress-Zlib
 
1742
        lfsmake2 perl-Digest
 
1743
        lfsmake2 perl-Digest-SHA1
 
1744
        lfsmake2 perl-Digest-HMAC
 
1745
        lfsmake2 perl-libwww
 
1746
        lfsmake2 perl-LWP-Protocol-https
 
1747
        lfsmake2 perl-Net-HTTP
 
1748
        lfsmake2 perl-Net-DNS
 
1749
        lfsmake2 perl-Net-IPv4Addr
 
1750
        lfsmake2 perl-Net_SSLeay
 
1751
        lfsmake2 perl-IO-Stringy
 
1752
        lfsmake2 perl-IO-Socket-SSL
 
1753
        lfsmake2 perl-Unix-Syslog
 
1754
        lfsmake2 perl-Mail-Tools
 
1755
        lfsmake2 perl-MIME-Tools
 
1756
        lfsmake2 perl-Net-Server
 
1757
        lfsmake2 perl-Canary-Stability
 
1758
        lfsmake2 perl-Convert-TNEF
 
1759
        lfsmake2 perl-Convert-UUlib
 
1760
        lfsmake2 perl-Archive-Tar
 
1761
        lfsmake2 perl-Archive-Zip
 
1762
        lfsmake2 perl-Text-Tabs+Wrap
 
1763
        lfsmake2 perl-XML-Parser
 
1764
        lfsmake2 perl-Crypt-PasswdMD5
 
1765
        lfsmake2 perl-Net-Telnet
 
1766
        lfsmake2 perl-JSON
 
1767
        lfsmake2 perl-Capture-Tiny
 
1768
        lfsmake2 perl-Config-AutoConf
 
1769
        lfsmake2 perl-Object-Tiny
 
1770
        lfsmake2 perl-Archive-Peek-Libarchive
 
1771
        lfsmake2 python3-inotify
 
1772
        lfsmake2 python3-docutils
 
1773
        lfsmake2 python3-daemon
 
1774
        lfsmake2 ntp
 
1775
        lfsmake2 openssh
 
1776
        lfsmake2 fontconfig
 
1777
        lfsmake2 dejavu-fonts-ttf
 
1778
        lfsmake2 ubuntu-font-family
 
1779
        lfsmake2 freefont
 
1780
        lfsmake2 pixman
 
1781
        lfsmake2 cairo
 
1782
        lfsmake2 harfbuzz
 
1783
        lfsmake2 fribidi
 
1784
        lfsmake2 pango
 
1785
        lfsmake2 rrdtool
 
1786
        lfsmake2 setup
 
1787
        lfsmake2 jansson
 
1788
        lfsmake2 yaml
 
1789
        lfsmake2 libhtp
 
1790
        lfsmake2 colm
 
1791
        lfsmake2 ragel
 
1792
        lfsmake2 vectorscan
 
1793
        lfsmake2 suricata
 
1794
        lfsmake2 ids-ruleset-sources
 
1795
        lfsmake2 ipblocklist-sources
 
1796
        lfsmake2 squid
 
1797
        lfsmake2 squidguard
 
1798
        lfsmake2 calamaris
 
1799
        lfsmake2 tcpdump
 
1800
        lfsmake2 traceroute
 
1801
        lfsmake2 vlan
 
1802
        lfsmake2 wireless
 
1803
        lfsmake2 pakfire
 
1804
        lfsmake2 lz4
 
1805
        lfsmake2 lzo
 
1806
        lfsmake2 openvpn
 
1807
        lfsmake2 mpage
 
1808
        lfsmake2 dbus
 
1809
        lfsmake2 intltool
 
1810
        lfsmake2 libdaemon
 
1811
        lfsmake2 avahi
 
1812
        lfsmake2 cups
 
1813
        lfsmake2 lcms2
 
1814
        lfsmake2 ghostscript
 
1815
        lfsmake2 qpdf
 
1816
        lfsmake2 poppler
 
1817
        lfsmake2 poppler-data
 
1818
        lfsmake2 cups-filters
 
1819
        lfsmake2 epson-inkjet-printer-escpr
 
1820
        lfsmake2 cups-pdf
 
1821
        lfsmake2 foomatic
 
1822
        lfsmake2 hplip
 
1823
        lfsmake2 cifs-utils
 
1824
        lfsmake2 krb5
 
1825
        lfsmake2 rpcsvc-proto
 
1826
        lfsmake2 samba
 
1827
        lfsmake2 netatalk
 
1828
        lfsmake2 sudo
 
1829
        lfsmake2 mc
 
1830
        lfsmake2 wget
 
1831
        lfsmake2 bridge-utils
 
1832
        lfsmake2 smartmontools
 
1833
        lfsmake2 htop
 
1834
        lfsmake2 chkconfig
 
1835
        lfsmake2 postfix
 
1836
        lfsmake2 fetchmail
 
1837
        lfsmake2 clamav
 
1838
        lfsmake2 perl-NetAddr-IP
 
1839
        lfsmake2 dma
 
1840
        lfsmake2 alsa
 
1841
        lfsmake2 mpfire
 
1842
        lfsmake2 guardian
 
1843
        lfsmake2 libid3tag
 
1844
        lfsmake2 libmad
 
1845
        lfsmake2 libogg
 
1846
        lfsmake2 libvorbis
 
1847
        lfsmake2 flac
 
1848
        lfsmake2 lame
 
1849
        lfsmake2 soxr
 
1850
        lfsmake2 libshout
 
1851
        lfsmake2 xvid
 
1852
        lfsmake2 libmpeg2
 
1853
        lfsmake2 gnump3d
 
1854
        lfsmake2 rsync
 
1855
        lfsmake2 rpcbind
 
1856
        lfsmake2 keyutils
 
1857
        lfsmake2 nfs
 
1858
        lfsmake2 ncat
 
1859
        lfsmake2 nmap
 
1860
        lfsmake2 etherwake
 
1861
        lfsmake2 bwm-ng
 
1862
        lfsmake2 sysstat
 
1863
        lfsmake2 strongswan
 
1864
        lfsmake2 rng-tools
 
1865
        lfsmake2 lsof
 
1866
        lfsmake2 br2684ctl
 
1867
        lfsmake2 lm_sensors
 
1868
        lfsmake2 libstatgrab
 
1869
        lfsmake2 liboping
 
1870
        lfsmake2 collectd
 
1871
        lfsmake2 git
 
1872
        lfsmake2 linux-firmware
 
1873
        lfsmake2 dvb-firmwares
 
1874
        lfsmake2 zd1211-firmware
 
1875
        lfsmake2 rpi-firmware
 
1876
        lfsmake2 intel-microcode
 
1877
        lfsmake2 pcengines-apu-firmware
 
1878
        lfsmake2 elinks
 
1879
        lfsmake2 igmpproxy
 
1880
        lfsmake2 opus
 
1881
        lfsmake2 python3-toml
 
1882
        lfsmake2 python3-pyproject2setuppy
 
1883
        lfsmake2 python3-pyparsing
 
1884
        lfsmake2 spice-protocol
 
1885
        lfsmake2 spice
 
1886
        lfsmake2 sdl2
 
1887
        lfsmake2 libusbredir
 
1888
        lfsmake2 libseccomp
 
1889
        lfsmake2 libslirp
 
1890
        lfsmake2 qemu
 
1891
        lfsmake2 netsnmpd
 
1892
        lfsmake2 nagios_nrpe
 
1893
        lfsmake2 nagios-plugins
 
1894
        lfsmake2 observium-agent
 
1895
        lfsmake2 ebtables
 
1896
        lfsmake2 faad2
 
1897
        lfsmake2 alac
 
1898
        lfsmake2 ffmpeg
 
1899
        lfsmake2 vdr
 
1900
        lfsmake2 vdr_streamdev
 
1901
        lfsmake2 vdr_epgsearch
 
1902
        lfsmake2 vdr_dvbapi
 
1903
        lfsmake2 vdr_eepg
 
1904
        lfsmake2 w_scan
 
1905
        lfsmake2 fmt
 
1906
        lfsmake2 mpd
 
1907
        lfsmake2 libmpdclient
 
1908
        lfsmake2 mpc
 
1909
        lfsmake2 perl-Net-CIDR-Lite
 
1910
        lfsmake2 perl-Net-SMTP-SSL
 
1911
        lfsmake2 perl-MIME-Base64
 
1912
        lfsmake2 perl-Authen-SASL
 
1913
        lfsmake2 perl-MIME-Lite
 
1914
        lfsmake2 perl-Email-Date-Format
 
1915
        lfsmake2 vnstat
 
1916
        lfsmake2 iw
 
1917
        lfsmake2 wpa_supplicant
 
1918
        lfsmake2 hostapd
 
1919
        lfsmake2 syslinux
 
1920
        lfsmake2 tftpd
 
1921
        lfsmake2 cpufrequtils
 
1922
        lfsmake2 gutenprint
 
1923
        lfsmake2 apcupsd
 
1924
        lfsmake2 fireperf
 
1925
        lfsmake2 iperf
 
1926
        lfsmake2 iperf3
 
1927
        lfsmake2 7zip
 
1928
        lfsmake2 lynis
 
1929
        lfsmake2 sshfs
 
1930
        lfsmake2 utfcpp
 
1931
        lfsmake2 taglib
 
1932
        lfsmake2 perl-gettext
 
1933
        lfsmake2 perl-Sort-Naturally
 
1934
        lfsmake2 vdradmin
 
1935
        lfsmake2 perl-DBI
 
1936
        lfsmake2 perl-DBD-SQLite
 
1937
        lfsmake2 perl-File-ReadBackwards
 
1938
        lfsmake2 openvmtools
 
1939
        lfsmake2 joe
 
1940
        lfsmake2 monit
 
1941
        lfsmake2 nut
 
1942
        lfsmake2 watchdog
 
1943
        lfsmake2 usb_modeswitch
 
1944
        lfsmake2 usb_modeswitch_data
 
1945
        lfsmake2 zerofree
 
1946
        lfsmake2 minicom
 
1947
        lfsmake2 ddrescue
 
1948
        lfsmake2 parted
 
1949
        lfsmake2 swig
 
1950
        lfsmake2 dtc
 
1951
        lfsmake2 u-boot
 
1952
        lfsmake2 wireless-regdb
 
1953
        lfsmake2 ddns
 
1954
        lfsmake2 python3-pycparser
 
1955
        lfsmake2 python3-charset-normalizer
 
1956
        lfsmake2 python3-certifi
 
1957
        lfsmake2 python3-idna
 
1958
        lfsmake2 python3-requests
 
1959
        lfsmake2 python3-tomli
 
1960
        lfsmake2 python3-pep517
 
1961
        lfsmake2 python3-build
 
1962
        lfsmake2 python3-install
 
1963
        lfsmake2 python3-urllib3
 
1964
        lfsmake2 python3-flit
 
1965
        lfsmake2 python3-packaging
 
1966
        lfsmake2 python3-typing-extensions
 
1967
        lfsmake2 python3-semantic-version
 
1968
        lfsmake2 python3-setuptools-scm
 
1969
        lfsmake2 python3-setuptools-rust
 
1970
        lfsmake2 python3-six
 
1971
        lfsmake2 python3-dateutil
 
1972
        lfsmake2 python3-jmespath
 
1973
        lfsmake2 python3-colorama
 
1974
        lfsmake2 python3-yaml
 
1975
        lfsmake2 python3-s3transfer
 
1976
        lfsmake2 python3-rsa
 
1977
        lfsmake2 python3-pyasn1
 
1978
        lfsmake2 python3-botocore
 
1979
        lfsmake2 python3-cffi
 
1980
        lfsmake2 python3-cryptography
 
1981
        lfsmake2 python3-circuitbreaker
 
1982
        lfsmake2 python3-pytz
 
1983
        lfsmake2 python3-click
 
1984
        lfsmake2 python3-arrow
 
1985
        lfsmake2 python3-terminaltables
 
1986
        lfsmake2 python3-pkgconfig
 
1987
        lfsmake2 python3-msgpack
 
1988
        lfsmake2 python3-editables
 
1989
        lfsmake2 python3-pathspec
 
1990
        lfsmake2 python3-pluggy
 
1991
        lfsmake2 python3-calver
 
1992
        lfsmake2 python3-trove-classifiers
 
1993
        lfsmake2 python3-hatchling
 
1994
        lfsmake2 python3-hatch-vcs
 
1995
        lfsmake2 python3-hatch-fancy-pypi-readme
 
1996
        lfsmake2 python3-attrs
 
1997
        lfsmake2 python3-sniffio
 
1998
        lfsmake2 python3-sortedcontainers
 
1999
        lfsmake2 python3-outcome
 
2000
        lfsmake2 python3-async_generator
 
2001
        lfsmake2 python3-flit_scm
 
2002
        lfsmake2 python3-exceptiongroup
 
2003
        lfsmake2 python3-trio
 
2004
        lfsmake2 python3-pyfuse3
 
2005
        lfsmake2 aws-cli
 
2006
        lfsmake2 oci-python-sdk
 
2007
        lfsmake2 oci-cli
 
2008
        lfsmake2 transmission
 
2009
        lfsmake2 mtr
 
2010
        lfsmake2 minidlna
 
2011
        lfsmake2 acpid
 
2012
        lfsmake2 fping
 
2013
        lfsmake2 telnet
 
2014
        lfsmake2 xinetd
 
2015
        lfsmake2 stress
 
2016
        lfsmake2 sarg
 
2017
        lfsmake2 nginx
 
2018
        lfsmake2 sysbench
 
2019
        lfsmake2 strace
 
2020
        lfsmake2 ltrace
 
2021
        lfsmake2 ipfire-netboot
 
2022
        lfsmake2 lcdproc
 
2023
        lfsmake2 keepalived
 
2024
        lfsmake2 ipvsadm
 
2025
        lfsmake2 perl-Carp-Clan
 
2026
        lfsmake2 perl-Date-Calc
 
2027
        lfsmake2 perl-Date-Manip
 
2028
        lfsmake2 perl-File-Tail
 
2029
        lfsmake2 perl-TimeDate
 
2030
        lfsmake2 swatch
 
2031
        lfsmake2 tor
 
2032
        lfsmake2 wavemon
 
2033
        lfsmake2 iptraf-ng
 
2034
        lfsmake2 iotop
 
2035
        lfsmake2 stunnel
 
2036
        lfsmake2 bacula
 
2037
        lfsmake2 perl-Font-TTF
 
2038
        lfsmake2 perl-IO-String
 
2039
        lfsmake2 perl-PDF-API2
 
2040
        lfsmake2 proxy-accounting
 
2041
        lfsmake2 tmux
 
2042
        lfsmake2 perl-Text-CSV_XS
 
2043
        lfsmake2 lua
 
2044
        lfsmake2 haproxy
 
2045
        lfsmake2 ipset
 
2046
        lfsmake2 dnsdist
 
2047
        lfsmake2 bird
 
2048
        lfsmake2 libyang
 
2049
        lfsmake2 abseil-cpp
 
2050
        lfsmake2 protobuf
 
2051
        lfsmake2 protobuf-c
 
2052
        lfsmake2 frr
 
2053
        lfsmake2 dmidecode
 
2054
        lfsmake2 mcelog
 
2055
        lfsmake2 libpciaccess
 
2056
        lfsmake2 libyajl
 
2057
        lfsmake2 libvirt
 
2058
        lfsmake2 libtalloc
 
2059
        lfsmake2 freeradius
 
2060
        lfsmake2 perl-common-sense
 
2061
        lfsmake2 perl-inotify2
 
2062
        lfsmake2 perl-Net-IP
 
2063
        lfsmake2 wio
 
2064
        lfsmake2 iftop
 
2065
        lfsmake2 mdns-repeater
 
2066
        lfsmake2 i2c-tools
 
2067
        lfsmake2 nss-myhostname
 
2068
        lfsmake2 dehydrated
 
2069
        lfsmake2 libplist
 
2070
        lfsmake2 nqptp
 
2071
        lfsmake2 shairport-sync
 
2072
        lfsmake2 borgbackup
 
2073
        lfsmake2 lmdb
 
2074
        lfsmake2 knot
 
2075
        lfsmake2 spectre-meltdown-checker
 
2076
        lfsmake2 zabbix_agentd
 
2077
        lfsmake2 flashrom
 
2078
        lfsmake2 firmware-update
 
2079
        lfsmake2 ruby
 
2080
        lfsmake2 asciidoctor
 
2081
        lfsmake2 speexdsp
 
2082
        lfsmake2 tshark
 
2083
        lfsmake2 speedtest-cli
 
2084
        lfsmake2 amazon-ssm-agent
 
2085
        lfsmake2 libloc
 
2086
        lfsmake2 ncdu
 
2087
        lfsmake2 lshw
 
2088
        lfsmake2 socat
 
2089
        lfsmake2 libcdada
 
2090
        lfsmake2 pmacct
 
2091
        lfsmake2 squid-asnbl
 
2092
        lfsmake2 qemu-ga
 
2093
        lfsmake2 gptfdisk
 
2094
        lfsmake2 oath-toolkit
 
2095
        lfsmake2 qrencode
 
2096
        lfsmake2 perl-File-Remove
 
2097
        lfsmake2 perl-Module-Build
 
2098
        lfsmake2 perl-Module-ScanDeps
 
2099
        lfsmake2 perl-YAML-Tiny
 
2100
        lfsmake2 perl-Module-Install
 
2101
        lfsmake2 perl-Imager
 
2102
        lfsmake2 perl-Imager-QRCode
 
2103
        lfsmake2 perl-MIME-Base32
 
2104
        lfsmake2 perl-URI-Encode
 
2105
        lfsmake2 rsnapshot
 
2106
        lfsmake2 mympd
 
2107
        lfsmake2 wsdd
 
2108
        lfsmake2 btrfs-progs
 
2109
        lfsmake2 inotify-tools
 
2110
        lfsmake2 grub-btrfs
 
2111
 
 
2112
        # Kernelbuild ... current we have no platform that need
 
2113
        # multi kernel builds so KCFG is empty
 
2114
        lfsmake2 linux          KCFG=""
 
2115
        lfsmake2 rtl8812au              KCFG=""
 
2116
        lfsmake2 linux-initrd           KCFG=""
 
2117
 
 
2118
        lfsmake2 memtest
 
2119
 
 
2120
        # Build the installer
 
2121
        lfsmake2 installer
 
2122
 
 
2123
        # use toolchain bash for chroot to strip
 
2124
        CUSTOM_PATH="${TOOLS_DIR}/bin" lfsmake2 strip
 
2125
 
 
2126
        # Build images
 
2127
        lfsmake2 cdrom
 
2128
        lfsmake2 flash-images
1721
2129
}
1722
2130
 
1723
2131
buildpackages() {
1724
 
  LOGFILE="$BASEDIR/log/_build.packages.log"
1725
 
  export LOGFILE
1726
 
  echo "... see detailed log in _build.*.log files" >> $LOGFILE
1727
 
 
1728
 
 
1729
 
  # Generating list of packages used
1730
 
  print_line "Generating packages list from logs"
1731
 
  rm -f $BASEDIR/doc/packages-list
1732
 
  for i in `ls -1tr $BASEDIR/log/[^_]*`; do
1733
 
        if [ "$i" != "$BASEDIR/log/FILES" -a -n $i ]; then
1734
 
                echo "* `basename $i`" >>$BASEDIR/doc/packages-list
1735
 
        fi
1736
 
  done
1737
 
  echo "== List of softwares used to build $NAME Version: $VERSION ==" > $BASEDIR/doc/packages-list.txt
1738
 
  grep -v 'configroot$\|img$\|initrd$\|initscripts$\|installer$\|install$\|setup$\|pakfire$\|stage2$\|smp$\|tools$\|tools1$\|tools2$\|.tgz$\|-config$\|_missing_rootfile$\|install1$\|install2$\|pass1$\|pass2$\|pass3$' \
1739
 
        $BASEDIR/doc/packages-list | sort >> $BASEDIR/doc/packages-list.txt
1740
 
  rm -f $BASEDIR/doc/packages-list
1741
 
  # packages-list.txt is ready to be displayed for wiki page
1742
 
  print_status DONE
1743
 
 
1744
 
  # Update changelog
1745
 
  cd $BASEDIR
1746
 
  [ -z $GIT_TAG ]  || LAST_TAG=$GIT_TAG
1747
 
  [ -z $LAST_TAG ] || EXT="$LAST_TAG..HEAD"
1748
 
  git log -n 500 --no-merges --pretty=medium --shortstat $EXT > $BASEDIR/doc/ChangeLog
1749
 
 
1750
 
  # Create images for install
1751
 
  lfsmake2 cdrom
1752
 
 
1753
 
  # Check if there is a loop device for building in virtual environments
1754
 
  modprobe loop 2>/dev/null
1755
 
  if [ $BUILD_IMAGES == 1 ] && ([ -e /dev/loop/0 ] || [ -e /dev/loop0 ] || [ -e "/dev/loop-control" ]); then
1756
 
        lfsmake2 flash-images
1757
 
  fi
1758
 
 
1759
 
  mv $LFS/install/images/{*.iso,*.img.xz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
 
2132
  local LOGFILE="${LOG_DIR}/_build.packages.log"
1760
2133
 
1761
2134
  ipfirepackages
1762
2135
 
1768
2141
  cd $PWD
1769
2142
 
1770
2143
  # Cleanup
1771
 
  stdumount
1772
2144
  rm -rf $BASEDIR/build/tmp/*
1773
2145
 
1774
2146
  cd $PWD
1788
2160
                fi
1789
2161
        done
1790
2162
  test -d $BASEDIR/packages || mkdir $BASEDIR/packages
1791
 
  mv -f $LFS/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1
 
2163
  mv -f ${BUILD_DIR}/install/packages/* $BASEDIR/packages >> $LOGFILE 2>&1
1792
2164
  rm -rf  $BASEDIR/build/install/packages/*
1793
2165
}
1794
2166
 
 
2167
# This function will re-execute a command in a new namespace
 
2168
exec_in_namespace() {
 
2169
        # Nothing to do if we are already in a new namespace
 
2170
        if [ -n "${IN_NAMESPACE}" ]; then
 
2171
                return 0
 
2172
        fi
 
2173
 
 
2174
        # Forward any configuration
 
2175
        local args=(
 
2176
                "--target=${BUILD_ARCH}"
 
2177
        )
 
2178
 
 
2179
        IN_NAMESPACE=1 \
 
2180
        exec unshare \
 
2181
                --mount \
 
2182
                --propagation=private \
 
2183
                "${0}" "${args[@]}" "$@"
 
2184
}
 
2185
 
 
2186
# Set BASEDIR
 
2187
readonly BASEDIR="$(find_base)"
 
2188
 
 
2189
# Get some information about the host system
 
2190
SYSTEM_PROCESSORS="$(system_processors)"
 
2191
SYSTEM_MEMORY="$(system_memory)"
 
2192
 
 
2193
# Default settings
 
2194
BUILD_ARCH="default"
 
2195
CCACHE_CACHE_SIZE="4G"
 
2196
 
 
2197
# Load configuration file
 
2198
if [ -f .config ]; then
 
2199
        source .config
 
2200
fi
 
2201
 
 
2202
# Parse any command line options (not commands)
1795
2203
while [ $# -gt 0 ]; do
1796
2204
        case "${1}" in
1797
2205
                --target=*)
1798
 
                        configure_build "${1#--target=}"
 
2206
                        BUILD_ARCH="${1#--target=}"
1799
2207
                        ;;
 
2208
 
1800
2209
                -*)
1801
2210
                        exiterror "Unknown configuration option: ${1}"
1802
2211
                        ;;
 
2212
 
 
2213
                # Found a command, so exit options parsing
1803
2214
                *)
1804
 
                        # Found a command, so exit options parsing.
1805
2215
                        break
1806
2216
                        ;;
1807
2217
        esac
1808
2218
        shift
1809
2219
done
1810
2220
 
 
2221
# Configure the build
 
2222
configure_build "${BUILD_ARCH}"
 
2223
 
 
2224
# Set directories
 
2225
readonly CACHE_DIR="${BASEDIR}/cache"
 
2226
readonly TOOLCHAIN_DIR="${CACHE_DIR}/toolchains"
 
2227
readonly CCACHE_DIR="${BASEDIR}/ccache/${BUILD_ARCH}/${TOOLCHAINVER}"
 
2228
readonly BUILD_DIR="${BASEDIR}/build_${BUILD_ARCH}"
 
2229
readonly IMAGES_DIR="${BASEDIR}/images_${BUILD_ARCH}"
 
2230
readonly LOG_DIR="${BASEDIR}/log_${BUILD_ARCH}"
 
2231
readonly TOOLS_DIR="/tools_${BUILD_ARCH}"
 
2232
 
 
2233
# Set URLs
 
2234
readonly SOURCE_URL="https://source.ipfire.org/ipfire-2.x"
 
2235
readonly TOOLCHAIN_URL="https://source.ipfire.org/toolchains"
 
2236
 
 
2237
# Set the LOGFILE
 
2238
LOGFILE="${LOG_DIR}/_build.preparation.log"
 
2239
 
 
2240
# Ensure that some basic directories exist
 
2241
mkdir -p "${CACHE_DIR}" "${LOG_DIR}"
 
2242
 
 
2243
# Toolchain Archive
 
2244
readonly TOOLCHAIN="${SNAME}-${VERSION}-toolchain-${TOOLCHAINVER}-${BUILD_ARCH}.tar.zst"
 
2245
 
1811
2246
# See what we're supposed to do
1812
2247
case "$1" in
1813
2248
build)
1814
2249
        START_TIME="${SECONDS}"
1815
2250
 
1816
 
        PACKAGE="$BASEDIR/cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.zst"
1817
 
        #only restore on a clean disk
1818
 
        if [ ! -e "${BASEDIR}/build${TOOLS_DIR}/.toolchain-successful" ]; then
1819
 
                if [ ! -n "$PACKAGE" ]; then
 
2251
        # Launch in a new namespace
 
2252
        exec_in_namespace "$@"
 
2253
 
 
2254
        # Prepare the environment
 
2255
        prepareenv --required-space=2048
 
2256
 
 
2257
        # Check if the toolchain is available
 
2258
        if [ ! -e "${BUILD_DIR}${TOOLS_DIR}/.toolchain-successful" ]; then
 
2259
                # If we have the toolchain available, we extract it into the build environment
 
2260
                if [ -r "${TOOLCHAIN_DIR}/${TOOLCHAIN}" ]; then
 
2261
                        print_build_stage "Packaged toolchain compilation"
 
2262
 
 
2263
                        # Extract the toolchain
 
2264
                        if ! extract_toolchain "${TOOLCHAIN}"; then
 
2265
                                exiterror "Failed extracting the toolchain"
 
2266
                        fi
 
2267
 
 
2268
                # Otherwise perform a full toolchain compilation
 
2269
                else
1820
2270
                        print_build_stage "Full toolchain compilation"
1821
 
                        prepareenv
1822
 
                        buildtoolchain
1823
 
                else
1824
 
                        PACKAGENAME=${PACKAGE%.tar.zst}
1825
 
                        print_build_stage "Packaged toolchain compilation"
1826
 
                        if [ `b2sum $PACKAGE | awk '{print $1}'` == `cat $PACKAGENAME.b2 | awk '{print $1}'` ]; then
1827
 
                                zstd -d < "${PACKAGE}" | tar x
1828
 
                                prepareenv
1829
 
                        else
1830
 
                                exiterror "$PACKAGENAME BLAKE2 checksum did not match, check downloaded package"
1831
 
                        fi
 
2271
                        build_toolchain
1832
2272
                fi
1833
 
        else
1834
 
                prepareenv
1835
2273
        fi
1836
2274
 
1837
 
        print_build_stage "Building LFS"
1838
 
        buildbase
1839
 
 
1840
 
        print_build_stage "Building IPFire"
1841
 
        buildipfire
1842
 
 
1843
 
        print_build_stage "Building installer"
1844
 
        buildinstaller
1845
 
 
1846
 
        print_build_stage "Building packages"
 
2275
        print_build_stage "Building ${NAME}"
 
2276
        build_system
 
2277
 
 
2278
        print_build_stage "Building Packages"
1847
2279
        buildpackages
1848
2280
 
1849
2281
        print_build_stage "Checking Logfiles for new Files"
1855
2287
 
1856
2288
        print_build_summary $(( SECONDS - START_TIME ))
1857
2289
        ;;
 
2290
tail)
 
2291
        tail -F \
 
2292
                "${LOG_DIR}/_build.toolchain.log" \
 
2293
                "${LOG_DIR}/_build.${SNAME}.log" \
 
2294
                "${LOG_DIR}/_build.packages.log" 2>/dev/null
 
2295
        ;;
1858
2296
shell)
 
2297
        # Launch in a new namespace
 
2298
        exec_in_namespace "$@"
 
2299
 
1859
2300
        # enter a shell inside LFS chroot
1860
2301
        # may be used to changed kernel settings
1861
2302
        prepareenv
1864
2305
clean)
1865
2306
        print_line "Cleaning build directory..."
1866
2307
 
1867
 
        for i in `mount | grep $BASEDIR | sed 's/^.*loop=\(.*\))/\1/'`; do
1868
 
                $LOSETUP -d $i 2>/dev/null
1869
 
        done
1870
 
        #for i in `mount | grep $BASEDIR | cut -d " " -f 1`; do
1871
 
        #       umount $i
1872
 
        #done
1873
 
        stdumount
1874
 
        for i in `seq 0 7`; do
1875
 
                if ( losetup /dev/loop${i} 2>/dev/null | grep -q "/install/images" ); then
1876
 
                umount /dev/loop${i}     2>/dev/null;
1877
 
                losetup -d /dev/loop${i} 2>/dev/null;
1878
 
                fi;
1879
 
        done
1880
 
        rm -rf $BASEDIR/build
1881
 
        rm -rf $BASEDIR/cdrom
1882
 
        rm -rf $BASEDIR/packages
1883
 
        rm -rf $BASEDIR/log
 
2308
        # Cleanup build files
 
2309
        rm -rf \
 
2310
                "${BUILD_DIR}" \
 
2311
                "${BASEDIR}/cdrom" \
 
2312
                "${BASEDIR}/packages" \
 
2313
                "${LOG_DIR}"
 
2314
 
 
2315
        # Remove the /tools symlink
1884
2316
        if [ -h "${TOOLS_DIR}" ]; then
1885
2317
                rm -f "${TOOLS_DIR}"
1886
2318
        fi
1887
 
        rm -f $BASEDIR/ipfire-*
 
2319
 
1888
2320
        print_status DONE
1889
2321
        ;;
1890
 
docker)
1891
 
        # Build the docker image if it does not exist, yet
1892
 
        if ! docker images -a | grep -q ^ipfire-builder; then
1893
 
                if docker build -t ipfire-builder ${BASEDIR}/tools/docker; then
1894
 
                        print_status DONE
1895
 
                else
1896
 
                        print_status FAIL
1897
 
                        exit 1
1898
 
                fi
1899
 
        fi
1900
 
 
1901
 
        # Run the container and enter a shell
1902
 
        docker run -it --privileged -v "${BASEDIR}:/build" -w "/build" ipfire-builder bash -l
1903
 
        ;;
1904
2322
downloadsrc)
1905
 
        if [ ! -d $BASEDIR/cache ]; then
1906
 
                mkdir $BASEDIR/cache
1907
 
        fi
1908
 
        mkdir -p $BASEDIR/log
1909
 
        echo -e "${BOLD}Preload all source files${NORMAL}" | tee -a $LOGFILE
1910
 
        FINISHED=0
1911
 
        cd $BASEDIR/lfs
1912
 
        for c in `seq $MAX_RETRIES`; do
1913
 
                if (( FINISHED==1 )); then
1914
 
                        break
1915
 
                fi
1916
 
                FINISHED=1
1917
 
                cd $BASEDIR/lfs
1918
 
                for i in *; do
1919
 
                        if [ -f "$i" -a "$i" != "Config" ]; then
1920
 
                                lfsmakecommoncheck ${i} || continue
 
2323
        # Tell the user what we are about to do
 
2324
        print_headline "Pre-loading all source files"
1921
2325
 
1922
 
                                make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
1923
 
                                        MESSAGE="$i\t ($c/$MAX_RETRIES)" download >> $LOGFILE 2>&1
1924
 
                                if [ $? -ne 0 ]; then
1925
 
                                        print_status FAIL
1926
 
                                        FINISHED=0
1927
 
                                else
1928
 
                                        if [ $c -eq 1 ]; then
1929
 
                                        print_status DONE
1930
 
                                        fi
1931
 
                                fi
1932
 
                        fi
1933
 
                done
1934
 
        done
1935
 
        echo -e "${BOLD}***Verifying BLAKE2 checksum${NORMAL}"
1936
 
        ERROR=0
1937
 
        for i in *; do
1938
 
                if [ -f "$i" -a "$i" != "Config" ]; then
1939
 
                        lfsmakecommoncheck ${i} > /dev/null || continue
1940
 
                        make -s -f $i LFS_BASEDIR=$BASEDIR BUILD_ARCH="${BUILD_ARCH}" \
1941
 
                                MESSAGE="$i\t " b2 >> $LOGFILE 2>&1
1942
 
                        if [ $? -ne 0 ]; then
1943
 
                                echo -ne "BLAKE2 checksum difference in lfs/$i"
1944
 
                                print_status FAIL
1945
 
                                ERROR=1
1946
 
                        fi
1947
 
                fi
1948
 
        done
1949
 
        if [ $ERROR -eq 0 ]; then
1950
 
                echo -ne "${BOLD}all files BLAKE2 checksum match${NORMAL}"
1951
 
                print_status DONE
1952
 
        else
1953
 
                echo -ne "${BOLD}not all files were correctly download${NORMAL}"
1954
 
                print_status FAIL
 
2326
        # Download all sources
 
2327
        if ! download_sources; then
 
2328
                exiterror "Failed to download sources"
1955
2329
        fi
1956
 
        cd - >/dev/null 2>&1
1957
2330
        ;;
1958
2331
toolchain)
 
2332
        # Launch in a new namespace
 
2333
        exec_in_namespace "$@"
 
2334
 
 
2335
        # Prepare the environment
1959
2336
        prepareenv
 
2337
 
1960
2338
        print_build_stage "Toolchain compilation (${BUILD_ARCH})"
1961
 
        buildtoolchain
1962
 
        echo "`date -u '+%b %e %T'`: Create toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
1963
 
        test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
1964
 
        cd $BASEDIR && tar -cf- --exclude='log/_build.*.log' build/${TOOLS_DIR} build/bin/sh log \
1965
 
                | zstd ${ZSTD_OPT} > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.zst
1966
 
        b2sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.zst \
1967
 
                > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.b2
1968
 
        stdumount
 
2339
 
 
2340
        # Build the toolchain
 
2341
        build_toolchain
 
2342
 
 
2343
        # Ensure the toolchain directory exists
 
2344
        mkdir -p "${TOOLCHAIN_DIR}"
 
2345
 
 
2346
        # Compress the toolchain
 
2347
        if ! compress_toolchain "${TOOLCHAIN}"; then
 
2348
                exiterror "Could not compress toolchain"
 
2349
        fi
1969
2350
        ;;
 
2351
 
1970
2352
gettoolchain)
1971
 
        # arbitrary name to be updated in case of new toolchain package upload
1972
 
        PACKAGE=$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}
1973
 
        if [ ! -f $BASEDIR/cache/toolchains/$PACKAGE.tar.zst ]; then
1974
 
                URL_TOOLCHAIN=`grep URL_TOOLCHAIN lfs/Config | awk '{ print $3 }'`
1975
 
                test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
1976
 
                echo "`date -u '+%b %e %T'`: Load toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
1977
 
                cd $BASEDIR/cache/toolchains
1978
 
                wget -U "IPFireSourceGrabber/2.x" $URL_TOOLCHAIN/$PACKAGE.tar.zst $URL_TOOLCHAIN/$PACKAGE.b2 >& /dev/null
1979
 
                if [ $? -ne 0 ]; then
1980
 
                        echo "`date -u '+%b %e %T'`: error downloading $PACKAGE toolchain for ${BUILD_ARCH} machine" | tee -a $LOGFILE
1981
 
                else
1982
 
                        if [ "`b2sum $PACKAGE.tar.zst | awk '{print $1}'`" = "`cat $PACKAGE.b2 | awk '{print $1}'`" ]; then
1983
 
                                echo "`date -u '+%b %e %T'`: toolchain BLAKE2 checksum ok" | tee -a $LOGFILE
1984
 
                        else
1985
 
                                exiterror "$PACKAGE BLAKE2 checksum did not match, check downloaded package"
1986
 
                        fi
1987
 
                fi
1988
 
        else
1989
 
                echo "Toolchain is already downloaded. Exiting..."
1990
 
        fi
 
2353
        download_toolchain "${TOOLCHAIN}"
1991
2354
        ;;
1992
2355
uploadsrc)
1993
 
        if [ -z $IPFIRE_USER ]; then
1994
 
                echo -n "You have to setup IPFIRE_USER first. See .config for details."
1995
 
                print_status FAIL
1996
 
                exit 1
 
2356
        # Check if IPFIRE_USER is set
 
2357
        if [ -z "${IPFIRE_USER}" ]; then
 
2358
                exiterror "You have to setup IPFIRE_USER first. See .config for details."
1997
2359
        fi
1998
2360
 
1999
 
        URL_SOURCE="$(awk '/^URL_SOURCE/ { print $3 }' lfs/Config)"
2000
 
 
 
2361
        # Sync with upstream
2001
2362
        rsync \
2002
2363
                --recursive \
2003
2364
                --update \
2005
2366
                --progress \
2006
2367
                --human-readable \
2007
2368
                --exclude="toolchains/" \
2008
 
                "${BASEDIR}/cache/" \
2009
 
                "${IPFIRE_USER}@${URL_SOURCE}"
 
2369
                "${CACHE_DIR}/" \
 
2370
                "${IPFIRE_USER}@people.ipfire.org:/pub/sources/source-2.x"
2010
2371
 
2011
2372
        exit 0
2012
2373
        ;;
2056
2417
                print_status FAIL
2057
2418
        fi
2058
2419
        ;;
 
2420
__timer)
 
2421
        __timer "${2}" || exit $?
 
2422
        ;;
2059
2423
*)
2060
 
        echo "Usage: $0 [OPTIONS] {build|check-manualpages|clean|docker|downloadsrc|find-dependencies|gettoolchain|lang|shell|toolchain|update-contributors|uploadsrc}"
 
2424
        echo "Usage: $0 [OPTIONS] {build|check-manualpages|clean|downloadsrc|find-dependencies|gettoolchain|lang|shell|tail|toolchain|update-contributors|uploadsrc}"
2061
2425
        cat doc/make.sh-usage
2062
2426
        ;;
2063
2427
esac