1 # SPDX-License-Identifier: GPL-3.0+
2 # Originally Copyright Roger Meier <r.meier@siemens.com>
3 # Adapted for GRUB by Alexander Graf <agraf@suse.de>
5 # Build GRUB on Travis CI - https://www.travis-ci.org/
24 # Include all cross toolchain paths, so we can just call them later down.
25 - PATH=/tmp/qemu-install/bin:/tmp/grub/bin:/usr/bin:/bin:/tmp/cross/gcc-8.1.0-nolibc/aarch64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/arm-linux-gnueabi/bin:/tmp/cross/gcc-8.1.0-nolibc/ia64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/mips64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/powerpc64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv32-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/riscv64-linux/bin:/tmp/cross/gcc-8.1.0-nolibc/sparc64-linux/bin
28 # Install necessary toolchains based on $CROSS_TARGETS variable.
30 # These give us binaries like /tmp/cross/gcc-8.1.0-nolibc/ia64-linux/bin/ia64-linux-gcc
31 - for i in $CROSS_TARGETS; do
32 ( cd /tmp/cross; wget -t 3 -O - https://mirrors.kernel.org/pub/tools/crosstool/files/bin/x86_64/8.1.0/x86_64-gcc-8.1.0-nolibc-$i.tar.xz | tar xJ );
36 # Comments must be outside the command strings below, or the Travis parser
40 # Build all selected GRUB targets.
41 - for target in $GRUB_TARGETS; do
44 [ "$arch" = "arm64" ] && arch=aarch64-linux;
45 [ "$arch" = "arm" ] && arch=arm-linux-gnueabi;
46 [ "$arch" = "ia64" ] && arch=ia64-linux;
47 [ "$arch" = "mipsel" ] && arch=mips64-linux;
48 [ "$arch" = "powerpc" ] && arch=powerpc64-linux;
49 [ "$arch" = "riscv32" ] && arch=riscv32-linux;
50 [ "$arch" = "riscv64" ] && arch=riscv64-linux;
51 [ "$arch" = "sparc64" ] && arch=sparc64-linux;
52 echo "Building $target";
54 JOBS=`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 1`;
55 [ "$JOBS" == 1 ] || JOBS=$(($JOBS + 1));
56 ( cd obj-$target && ../configure --target=$arch --with-platform=$plat --prefix=/tmp/grub && make -j$JOBS && make -j$JOBS install ) &> log || ( cat log; false );
60 - echo -e "insmod echo\\ninsmod reboot\\necho hello world\\nreboot" > grub.cfg
62 # Assemble images and possibly run them.
63 - for target in $GRUB_TARGETS; do grub-mkimage -c grub.cfg -p / -O $target -o grub-$target echo reboot normal; done
65 # Run images we know how to run.
66 - if [[ "$GRUB_TARGETS" == *"x86_64-efi"* ]]; then qemu-system-x86_64 -bios /usr/share/ovmf/OVMF.fd -m 512 -no-reboot -nographic -net nic -net user,tftp=.,bootfile=grub-x86_64-efi | tee grub.log && grep "hello world" grub.log; fi
70 # Each env setting here is a dedicated build.
73 - GRUB_TARGETS="x86_64-efi x86_64-xen"
76 - GRUB_TARGETS="i386-coreboot i386-efi i386-ieee1275 i386-multiboot i386-pc i386-qemu i386-xen i386-xen_pvh"
79 - GRUB_TARGETS="powerpc-ieee1275"
80 - CROSS_TARGETS="powerpc64-linux"
83 - GRUB_TARGETS="sparc64-ieee1275"
84 - CROSS_TARGETS="sparc64-linux"
87 - GRUB_TARGETS="ia64-efi"
88 - CROSS_TARGETS="ia64-linux"
91 - GRUB_TARGETS="mips-arc mipsel-arc mipsel-qemu_mips mips-qemu_mips"
92 - CROSS_TARGETS="mips64-linux"
95 - GRUB_TARGETS="arm-coreboot arm-efi arm-uboot"
96 - CROSS_TARGETS="arm-linux-gnueabi"
99 - GRUB_TARGETS="arm64-efi"
100 - CROSS_TARGETS="aarch64-linux"
103 - GRUB_TARGETS="riscv32-efi"
104 - CROSS_TARGETS="riscv32-linux"
107 - GRUB_TARGETS="riscv64-efi"
108 - CROSS_TARGETS="riscv64-linux"