diff --git a/.github/workflows/qemu.yml b/.github/workflows/qemu.yml new file mode 100644 index 00000000..b595a955 --- /dev/null +++ b/.github/workflows/qemu.yml @@ -0,0 +1,63 @@ +# SPDX-FileCopyrightText: 2023 fosslinux +# +# SPDX-License-Identifier: GPL-3.0-or-later + +name: Run under QEMU + +on: + workflow_dispatch: + pull_request: + push: + branches: + - master + +jobs: + build: + name: Run under bubblewrap + runs-on: ubuntu-22.04 + steps: + - name: Install qemu + run: sudo apt-get install qemu-system-x86 + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: recursive + # There is a strange bug(?) in nongnu, when you clone a git repository + # against a commit != HEAD with depth=1, it errors out. + fetch-depth: 0 + - name: Query cache for sources + id: cache + uses: actions/cache/restore@v4 + with: + path: | + mirror + mirror-state + key: cache-${{ hashFiles('steps/*/sources') }} + restore-keys: | + cache- + - name: Get sources + if: steps.cache.outputs.cache-hit != 'true' + run: mkdir -p mirror mirror-state && ./mirror.sh mirror mirror-state + - name: Cache sources + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + mirror + mirror-state + key: cache-${{ hashFiles('steps/*/sources') }} + - name: Run bootstrap + run: sudo ./rootfs.py --qemu --update-checksums --external-sources --cores 2 --mirror file://${PWD}/mirror; cat output + - name: Remount package disk + if: always() + run: > + DEV=$(sudo losetup -f --show target/external.img) && + sudo partprobe ${DEV} && + mkdir -p mnt && + sudo mount ${DEV}p1 mnt + - name: Archive created packages + if: always() # archive both failed and successful builds + uses: actions/upload-artifact@v4 + with: + name: packages + path: mnt/repo/** diff --git a/lib/utils.py b/lib/utils.py index c1eca8cd..de015dd4 100755 --- a/lib/utils.py +++ b/lib/utils.py @@ -19,6 +19,9 @@ def run(*args, cleanup=None, **kwargs): if kwargs.pop('verbose', False): print(arguments) + sys.stdout.flush() + sys.stderr.flush() + try: return subprocess.run(arguments, check=True, **kwargs) except subprocess.CalledProcessError: diff --git a/rootfs.py b/rootfs.py index 7cbb4bc9..109e1ec5 100755 --- a/rootfs.py +++ b/rootfs.py @@ -17,6 +17,7 @@ import argparse import os import signal +import sys import threading from lib.generator import Generator, stage0_arch_map @@ -335,7 +336,7 @@ def bootstrap(args, generator, target, size, cleanup): '-nic', 'user,ipv6=off,model=e1000' ] if not args.interactive: - arg_list += ['-no-reboot', '-nographic'] + arg_list += ['-no-reboot', '-nographic', '-serial', 'file:output'] run(args.qemu_cmd, *arg_list, cleanup=cleanup) if __name__ == "__main__": diff --git a/steps/jump/fiwix.sh b/steps/jump/fiwix.sh index 549da56a..9b7d234c 100755 --- a/steps/jump/fiwix.sh +++ b/steps/jump/fiwix.sh @@ -16,5 +16,5 @@ make_fiwix_initrd -s 1381376 /boot/fiwix.ext2 if match x${BARE_METAL} xTrue; then kexec-fiwix /boot/fiwix -i /boot/fiwix.ext2 -m /e820 -c "fiwix console=/dev/tty1 root=/dev/ram0 initrd=fiwix.ext2 kexec_proto=linux kexec_size=199680 kexec_cmdline=\"init=/init consoleblank=0\"" else - kexec-fiwix /boot/fiwix -i /boot/fiwix.ext2 -m /e820 -c "fiwix console=/dev/ttyS0 root=/dev/ram0 initrd=fiwix.ext2 kexec_proto=linux kexec_size=199680 kexec_cmdline=\"init=/init console=ttyS0\"" + kexec-fiwix /boot/fiwix -i /boot/fiwix.ext2 -m /e820 -c "fiwix console=/dev/ttyS0 root=/dev/ram0 initrd=fiwix.ext2 kexec_proto=linux kexec_size=199680 kexec_cmdline=\"init=/init console=ttyS0,115200\"" fi