Run QEmu #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Yocto Build | |
on: | |
push: | |
branches: | |
- '**' # Matches all branches | |
jobs: | |
build: | |
runs-on: self-hosted | |
steps: | |
- name: Install Dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install -y gawk wget git diffstat unzip texinfo gcc build-essential \ | |
chrpath socat cpio python3 python3-pip python3-pexpect xz-utils debianutils \ | |
iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \ | |
python3-subunit mesa-common-dev zstd liblz4-tool file locales libacl1 \ | |
curl python-is-python3 bmap-tools qemu-system-arm | |
sudo locale-gen en_US.UTF-8 | |
- name: Install repo tool | |
run: | | |
mkdir -p ~/bin | |
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo | |
chmod a+x ~/bin/repo | |
echo "${HOME}/bin" >> $GITHUB_PATH | |
- name: Initialize Yocto Environment | |
run: | | |
mkdir -p yocto-astrial | |
cd yocto-astrial | |
repo init -u https://github.com/nxp-imx/imx-manifest -b imx-linux-kirkstone -m imx-5.15.71-2.2.0.xml | |
mkdir -p .repo/local_manifests | |
wget --directory-prefix .repo/local_manifests https://raw.githubusercontent.com/System-Electronics/meta-sysele-nxp-5.15.71/main/manifest/astrial-5.15.71.xml | |
repo sync | |
- name: Generate Build Signature | |
run: | | |
if [ "${{ secrets.BUILD_SIGNING_KEY }}" != "" ]; then | |
SIGNATURE_INPUT="${GITHUB_SHA}|${GITHUB_REPOSITORY}|${GITHUB_RUN_ID}|${{ secrets.BUILD_SIGNING_KEY }}" | |
BUILD_SIGNATURE=$(echo -n "$SIGNATURE_INPUT" | openssl dgst -sha256 -hmac "${{ secrets.BUILD_SIGNING_KEY }}" -hex | cut -d' ' -f2) | |
else | |
BUILD_SIGNATURE="unofficial" | |
fi | |
echo "BUILD_SIGNATURE=${BUILD_SIGNATURE}" >> $GITHUB_ENV | |
- name: Build Image | |
run: | | |
cd yocto-astrial | |
source astrial-setup-env -b build | |
export BB_ENV_PASSTHROUGH_ADDITIONS="GITHUB_SHA GITHUB_REPOSITORY GITHUB_RUN_ID BUILD_SIGNATURE" | |
bitbake system-astrial-image | |
- name: Run QEMU | |
run: | | |
cd yocto-astrial/build | |
# Estraiamo l'immagine wic.zst | |
zstd -d tmp/deploy/images/astrial-imx8mp/system-astrial-image-astrial-imx8mp-*.rootfs.wic.zst | |
# Avviamo QEMU con l'immagine | |
qemu-system-aarch64 \ | |
-machine virt \ | |
-cpu cortex-a53 \ | |
-nographic \ | |
-smp 4 \ | |
-m 2048 \ | |
-kernel tmp/deploy/images/astrial-imx8mp/Image \ | |
-append "root=/dev/vda console=ttyAMA0" \ | |
-drive file=tmp/deploy/images/astrial-imx8mp/system-astrial-image-astrial-imx8mp-*.rootfs.wic,format=raw,if=virtio \ | |
-netdev user,id=eth0 \ | |
-device virtio-net-device,netdev=eth0 \ | |
-no-reboot \ | |
-monitor none \ | |
& | |
# Aspettiamo che il sistema si avvii e catturiamo l'output | |
sleep 300 | |
# Terminiamo QEMU | |
pkill qemu-system-aarch64 | |
- name: Archive Build Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yocto-build | |
path: | | |
yocto-astrial/build/tmp/deploy/images/astrial-imx8mp/imx-boot-astrial-imx8mp-sd.bin-flash_evk | |
yocto-astrial/build/tmp/deploy/images/astrial-imx8mp/system-astrial-image-astrial-imx8mp-*.rootfs.wic.zst |