Skip to content

Instantly share code, notes, and snippets.

@sorear
Created December 11, 2016 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sorear/42c6fa19123c1be1ac806af5411c4fae to your computer and use it in GitHub Desktop.
Save sorear/42c6fa19123c1be1ac806af5411c4fae to your computer and use it in GitHub Desktop.
Early draft of Fedora bootstrap procedure

The facts

  1. Most software is not designed for cross-compilation. ~All spec files are not designed for cross-compilation. The procedure must appear to be native compilation as much as possible.

  2. Most software which is used during build procedures is not actually a compiler and does not need detailed knowledge of the current arch.

  3. Breaking build-dep cycles is very labor intensive. We would like to not do it.

  4. riscv64 and x86_64 are both little endian 64-bit ASCII with IEEE floating point. They cannot share solibs but can share nearly everything else.

  5. We want to verify that the final system can build itself without hacks. Scaffolding until we have the final system is A-OK.

The worlds

  1. Final RPMs are built in system emulation using unmodified (or all modifications upstreamed) spec files and only riscv64 RPMs. Nonfinal RPMs may be built in user emulation with a mix of riscv64 and x86_64 RPMs, but we would still prefer to not modify the spec files.

  2. Build environments for nonfinal RPMs are divided into an "old world" and a "new world". The old world contains x86_64 RPMs; the new world contains riscv64 RPMs (which may be final or nonfinal); the whole thing is run under user emulation x86_64 (reverse user emulation would be possible if we had fast RV64G hardware).

  3. Old world and new world are defined by ABI/ISA and which shared libraries are visible. /old and /new are visible globally, each process has bind mounts to make the correct libraries visible. A statically linked program can live in either world regardless of ABI/ISA.

  4. If a binary is installed in the old world or the new world, a statically linked shadow is installed in the other world which switches the mount namespace. (This requires setuid root)

  5. A LD_PRELOAD shim is installed in the old world to ensure uname(2) consistency. Other hacks will be added as needed.

  6. Toolchain must live in the new world because it must see the new-architecture libraries. It could be statically linked or cross-compiled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment