Skip to content

Instantly share code, notes, and snippets.

@xobs
Created November 10, 2022 02:35
Show Gist options
  • Save xobs/2ae7231284a58df6600b2c0d758ed5f0 to your computer and use it in GitHub Desktop.
Save xobs/2ae7231284a58df6600b2c0d758ed5f0 to your computer and use it in GitHub Desktop.
Testing rustc crashes with GAM
#!/bin/bash
set -e
set > /opt/Xous/environment
export PATH=/opt/gcc/xpack-riscv-none-elf-gcc-12.1.0-2/bin/:$PATH
echo "Building rust..."
cd /opt/Xous/rust-next
rm -rf target-*
rustup override set $RUSTUP_TOOLCHAIN
rm -rf $(rustc --print sysroot)/lib/rustlib/riscv32imac-unknown-xous-elf/
rustc_version=$(rustc --version | cut -d'(' -f2 | cut -d' ' -f1)
if [ -e CONTINUE_BUILD ]
then
echo "Removing build continuation"
rm -f CONTINUE_BUILD
else
echo "Applying patches"
# Try to apply one of 3 patchsets to this repo. There
# were three incompatible changes during this period,
# so one of them should work.
git checkout --force $rustc_version
rm -rf src/tools
git submodule update --init --recursive
git checkout .
echo "Trying p2 patches..."
if ! git am p2/*.patch
then
git am --abort
echo "Trying p1 patches..."
if ! git am p1/*.patch
then
git am --abort
echo "Trying p3 patches"
if ! git am p3/*.patch
then
git am --abort
echo "All patches failed"
exit 1
fi
fi
fi
fi
bash ./rebuild.sh
rustup override unset
echo "Rust should be built. Building gam-crash..."
cd /opt/Xous/gam-crash
rm -rf target-*
cargo +$RUSTUP_TOOLCHAIN build --release --target riscv32imac-unknown-xous-elf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment