]>
Commit | Line | Data |
---|---|---|
7f6cfc5f AG |
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> | |
4 | # | |
5 | # Build GRUB on Travis CI - https://www.travis-ci.org/ | |
6 | # | |
7 | ||
8 | dist: xenial | |
9 | ||
10 | language: c | |
11 | ||
12 | addons: | |
13 | apt: | |
14 | packages: | |
c55480da | 15 | - autopoint |
7f6cfc5f AG |
16 | - libsdl1.2-dev |
17 | - lzop | |
18 | - ovmf | |
19 | - python | |
20 | - qemu-system | |
21 | - unifont | |
22 | ||
23 | env: | |
24 | global: | |
25 | # Include all cross toolchain paths, so we can just call them later down. | |
26 | - 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 | |
27 | ||
28 | before_script: | |
29 | # Install necessary toolchains based on $CROSS_TARGETS variable. | |
30 | - mkdir /tmp/cross | |
31 | # These give us binaries like /tmp/cross/gcc-8.1.0-nolibc/ia64-linux/bin/ia64-linux-gcc | |
32 | - for i in $CROSS_TARGETS; do | |
33 | ( 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 ); | |
34 | done | |
35 | ||
36 | script: | |
37 | # Comments must be outside the command strings below, or the Travis parser | |
38 | # will get confused. | |
c55480da | 39 | - ./bootstrap |
7f6cfc5f AG |
40 | |
41 | # Build all selected GRUB targets. | |
42 | - for target in $GRUB_TARGETS; do | |
43 | plat=${target#*-}; | |
44 | arch=${target%-*}; | |
45 | [ "$arch" = "arm64" ] && arch=aarch64-linux; | |
46 | [ "$arch" = "arm" ] && arch=arm-linux-gnueabi; | |
47 | [ "$arch" = "ia64" ] && arch=ia64-linux; | |
48 | [ "$arch" = "mipsel" ] && arch=mips64-linux; | |
49 | [ "$arch" = "powerpc" ] && arch=powerpc64-linux; | |
50 | [ "$arch" = "riscv32" ] && arch=riscv32-linux; | |
51 | [ "$arch" = "riscv64" ] && arch=riscv64-linux; | |
52 | [ "$arch" = "sparc64" ] && arch=sparc64-linux; | |
53 | echo "Building $target"; | |
54 | mkdir obj-$target; | |
55 | JOBS=`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 1`; | |
56 | [ "$JOBS" == 1 ] || JOBS=$(($JOBS + 1)); | |
57 | ( cd obj-$target && ../configure --target=$arch --with-platform=$plat --prefix=/tmp/grub && make -j$JOBS && make -j$JOBS install ) &> log || ( cat log; false ); | |
58 | done | |
59 | ||
60 | # Our test canary. | |
61 | - echo -e "insmod echo\\ninsmod reboot\\necho hello world\\nreboot" > grub.cfg | |
62 | ||
63 | # Assemble images and possibly run them. | |
64 | - for target in $GRUB_TARGETS; do grub-mkimage -c grub.cfg -p / -O $target -o grub-$target echo reboot normal; done | |
65 | ||
66 | # Run images we know how to run. | |
67 | - 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 | |
68 | ||
69 | matrix: | |
70 | include: | |
71 | # Each env setting here is a dedicated build. | |
72 | - name: "x86_64" | |
73 | env: | |
74 | - GRUB_TARGETS="x86_64-efi x86_64-xen" | |
75 | - name: "i386" | |
76 | env: | |
77 | - GRUB_TARGETS="i386-coreboot i386-efi i386-ieee1275 i386-multiboot i386-pc i386-qemu i386-xen i386-xen_pvh" | |
78 | - name: "powerpc" | |
79 | env: | |
80 | - GRUB_TARGETS="powerpc-ieee1275" | |
81 | - CROSS_TARGETS="powerpc64-linux" | |
82 | - name: "sparc64" | |
83 | env: | |
84 | - GRUB_TARGETS="sparc64-ieee1275" | |
85 | - CROSS_TARGETS="sparc64-linux" | |
86 | - name: "ia64" | |
87 | env: | |
88 | - GRUB_TARGETS="ia64-efi" | |
89 | - CROSS_TARGETS="ia64-linux" | |
90 | - name: "mips" | |
91 | env: | |
92 | - GRUB_TARGETS="mips-arc mipsel-arc mipsel-qemu_mips mips-qemu_mips" | |
93 | - CROSS_TARGETS="mips64-linux" | |
94 | - name: "arm" | |
95 | env: | |
96 | - GRUB_TARGETS="arm-coreboot arm-efi arm-uboot" | |
97 | - CROSS_TARGETS="arm-linux-gnueabi" | |
98 | - name: "arm64" | |
99 | env: | |
100 | - GRUB_TARGETS="arm64-efi" | |
101 | - CROSS_TARGETS="aarch64-linux" | |
102 | - name: "riscv32" | |
103 | env: | |
104 | - GRUB_TARGETS="riscv32-efi" | |
105 | - CROSS_TARGETS="riscv32-linux" | |
106 | - name: "riscv64" | |
107 | env: | |
108 | - GRUB_TARGETS="riscv64-efi" | |
109 | - CROSS_TARGETS="riscv64-linux" |