You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.3 KiB
37 lines
1.3 KiB
#!/bin/sh
|
|
set -e
|
|
|
|
# Use qemu if necessary
|
|
#qemu=qemu-i386
|
|
qemu=
|
|
|
|
rm -rf system
|
|
mkdir -p builds
|
|
|
|
# Stage 1: Build matching mes and busybox binaries
|
|
./build_binaries.sh
|
|
mv system/binaries.tar.gz builds/ # Will be regenerated later, to match.
|
|
|
|
# Stage 2: Bootstrap system from these
|
|
mkdir -p system/sources/
|
|
cp -av sources/* system/sources/
|
|
cp build_bootstrap.sh system/sources/
|
|
mkdir system/dev system/tmp
|
|
mknod system/dev/null c 1 3
|
|
mknod system/dev/tty c 5 0
|
|
$qemu system/bin/busybox chroot system /bin/busybox env -i NPROC="$(nproc)" /bin/busybox sh /sources/build_bootstrap.sh
|
|
mv system/bootstrap.tar.gz builds/
|
|
|
|
# Stage 2.5 (optional): Rebuild bootstrap binaries to have a "clean" archive
|
|
if [ "$1" = double_bootstrap ]; then
|
|
cp build_binaries.sh binaries.sha1 busybox-config system/
|
|
$qemu system/bootstrap/bin/chroot system /bootstrap/bin/env -i NPROC="$(nproc)" PATH=/bootstrap/bin /bootstrap/bin/sh /build_binaries.sh
|
|
mv system/system/binaries.tar.gz builds/
|
|
rm system/build_binaries.sh system/binaries.sha1 system/busybox-config
|
|
rm -rf system/system/
|
|
fi
|
|
|
|
# Stage 3: Cross-compile system for x86_64
|
|
cp build_cross.sh system/sources
|
|
$qemu system/bootstrap/bin/chroot system /bootstrap/bin/env -i NPROC="$(nproc)" /bootstrap/bin/sh /sources/build_cross.sh
|
|
mv system/system/cross.tar.gz builds/
|
|
|