logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://anongit.hacktivis.me/git/bootstrap-initrd.git/

qbe.sh (738B)


  1. #!/bin/sh
  2. set -ex
  3. die() {
  4. echo "die: $@"
  5. exit 1
  6. }
  7. command -v xzdec || die "Run /extras/muxzcat.sh"
  8. # somehow oksh doesn't do `… < /distfiles/qbe-*.tar.xz | …` in scripts
  9. qbe_path=$(echo /distfiles/qbe-*.tar.xz)
  10. xzdec < "${qbe_path}" | tar xof -
  11. cd qbe-*/
  12. # https://c9x.me/git/qbe.git/commit/?id=c8220b638b17cb9eb583cca15d1b02c36a28ed2f
  13. for i in */emit.c; do
  14. ed "$i" <<EOF
  15. g/asm/s/asm/fmt/
  16. w
  17. q
  18. EOF
  19. done
  20. # pdpmake-2.0.3 fails to grasp config.h target so reproducing it here manually
  21. case `uname -m` in
  22. *aarch64*|*arm64*)
  23. echo "#define Deftgt T_arm64"
  24. ;;
  25. *riscv64*)
  26. echo "#define Deftgt T_rv64"
  27. ;;
  28. *)
  29. echo "#define Deftgt T_amd64_sysv"
  30. ;;
  31. esac > ./config.h
  32. pdpmake CC=$CC
  33. pdpmake PREFIX=/usr install
  34. cd ..
  35. rm -fr qbe-*/