From 892206dcaae487109730c2f7dd8dbd7d03f70db2 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 25 Aug 2023 13:51:44 +0100 Subject: [PATCH] 80 char limit, indentation missing, added limited liability on downloads --- SFFS/debian_bootstrap.mdwn | 116 ++++++++++++++++++++++++++----------- 1 file changed, 83 insertions(+), 33 deletions(-) diff --git a/SFFS/debian_bootstrap.mdwn b/SFFS/debian_bootstrap.mdwn index 60f22bca3..c7b046f9e 100644 --- a/SFFS/debian_bootstrap.mdwn +++ b/SFFS/debian_bootstrap.mdwn @@ -5,7 +5,8 @@ Useful Links (External): * [Read about sbuild and understand how it works](https://wiki.debian.org/sbuild) * [dpkg-buildflags man page](https://manpages.debian.org/bookworm/dpkg-dev/dpkg-buildflags.1.en.html) (optional, in case some flags need to be changed) * [apt-ftparchive man page](https://manpages.debian.org/bookworm/apt-utils/apt-ftparchive.1.en.html) (optional, in case you want to customize the repo) -* [debootstrap wiki page](https://wiki.debian.org/Debootstrap) (optional, in case you want to customize your chroot) +* [debootstrap wiki page](https://wiki.debian.org/Debootstrap) (optional, +in case you want to customize your chroot) Useful links (Libre-SOC): @@ -19,30 +20,42 @@ Useful links (Libre-SOC): ## Reasoning: -Libre-SOC builds upon the OpenPOWER ISA v3.0 but does not include many parts of the architecture typically found on production silicon, like AltiVec, VSX, and 128-bit hardware floating point. Because of this, we need (at this time, might change in the future when glibc supports detecting VSX vs SVP64 etc) to rebuild the full software repository to not include any of those instructions, making it compliant with [sffs (slides 5 & 6)](https://ics2020.bsc.es/sites/default/files/uploaded/brian_thompto_ICS2020_SLIDES.pdf). +Libre-SOC builds upon the OpenPOWER ISA v3.0 but does not include +many parts of the architecture typically found on production +silicon, like AltiVec, VSX, and 128-bit hardware floating +point. Because of this, we need (at this time, might change +in the future when glibc supports detecting VSX vs SVP64 etc) +to rebuild the full software repository to not include any of +those instructions, making it compliant with [sffs (slides 5 & +6)](https://ics2020.bsc.es/sites/default/files/uploaded/brian_thompto_ICS2020_SLIDES.pdf). -You can approach this in two ways: either build the full base Debian chroot packages yourself using Debian's build tools, optionally automated with our [scripts](https://git.libre-soc.org/?p=dev-env-setup.git;a=tree), or use the [prebuilt rootfs] in a compressed tar archive. +You can approach this in two ways: either build the full base Debian +chroot packages yourself using Debian's build tools, optionally automated +with our [scripts](https://git.libre-soc.org/?p=dev-env-setup.git;a=tree), +or use the [prebuilt rootfs] in a compressed tar archive. ## System requirements - A POWER system that can run Debian Bookworm (meaning POWER8 and newer) - At least 80GB of hard disk space -Cross compiling will make this process much more complicated and is generally not recommended. +Cross compiling will make this process much more complicated and is +generally not recommended. ## Development Setup Scripts -If you haven't already, clone Libre-SOC's development environment setup scripts. -These are bash scripts, and greatly simplify the time it takes to create a: +If you haven't already, clone Libre-SOC's development environment setup +scripts. These are bash scripts, and greatly simplify the time it takes +to create a: - Stable environment - With all software and libraries at specific versions (which are known to work). -These attributes are absolutely critical, and no support will be -provided, unless you use these scripts to setup a development environment. This -helps us fix any bugs in the scripts, and make sure everyone runs on the same -page. +These attributes are absolutely critical, and no support will be provided, +unless you use these scripts to setup a development environment. This +helps us fix any bugs in the scripts, and make sure everyone runs on +the same page. $ git clone https://git.libre-soc.org/git/dev-env-setup.git @@ -53,17 +66,24 @@ This is your own legal responsibility (to not run arbitrary code off of the internet) and we take no responsibility or accept any liability whatsoever for your use or misuse of them. -It is expected for you to use Debian for the host OS (anything else is unsupported: many contributors have repeatedly gotten into trouble by not following this advice), while all the chroots - which are developed very specifically for "reproducible builds" - run Debian 10 (Buster). +It is expected for you to use Debian for the host OS (anything else is +unsupported: many contributors have repeatedly gotten into trouble by +not following this advice), while all the chroots - which are developed +very specifically for "reproducible builds" - run Debian 10 (Buster). ## Setting up the build schroot Scripts we will be using for the setup are: -* `install-sbuild-apt-reqs` for installing sbuild and configuring it to Debian's defaults -* `mk-schroot-bookworm` for creating the bookworm schroot used by sbuild and adding our dpkg-buildflags to build for sffs -* `build-bookworm-sffs` to build the packages needed for a debootstrap chroot directory +* `install-sbuild-apt-reqs` for installing sbuild and configuring it to + Debian's defaults +* `mk-schroot-bookworm` for creating the bookworm schroot used by sbuild + and adding our dpkg-buildflags to build for sffs +* `build-bookworm-sffs` to build the packages needed for a debootstrap + chroot directory * `create-deb-repo` to create a local dpkg repository of the built packages -* `mk-sffs-chroot` to finally create the chroot using the repository of built packages +* `mk-sffs-chroot` to finally create the chroot using the repository of + built packages Commands to run in terminal to rebuild Debian 12 with sffs compliance: @@ -78,7 +98,11 @@ Commands to run in terminal to rebuild Debian 12 with sffs compliance: ## Using prebuilt tarball -If you prefer to use the prebuilt tarball (which will save days of your time), you could simply download and extract the tarball to a convenient location and chroot into it. +If you prefer to use the prebuilt tarball (which will save days of your +time), you could simply download and extract the tarball to a convenient +location and chroot into it. Bear in mind though that it is entirely your +responsibility when downloading arbitrary binaries, and we accept no +liability whatsoever for anything arising by you downloading them. $ curl -O [link to be added] $ mkdir bookworm-sffs && cd bookworm-sffs @@ -88,37 +112,63 @@ If you prefer to use the prebuilt tarball (which will save days of your time), y # Testing for VSX in object files -To verify that our buildflags were applied by the build tools and respected by the build scripts of packages, we need to check for the inclusion of VSX as well as any other instructions not available in SFFS. +To verify that our buildflags were applied by the build tools and +respected by the build scripts of packages, we need to check for the +inclusion of VSX as well as any other instructions not available in SFFS. This is not a perfect solution and the proper way would be either to: -- Simulate an SFFS compliant chip running this code such as [Microwatt](https://libre-soc.org/HDL_workflow/microwatt/) (very time consuming) -- Use a softcore FPGA core or ASIC of Microwatt / LibreSOC to run this code (doable, FPGA softcore [in progress](https://bugs.libre-soc.org/show_bug.cgi?id=1037)) +- Simulate an SFFS compliant chip running this code such as + [Microwatt](https://libre-soc.org/HDL_workflow/microwatt/) + (very time consuming) +- Use a softcore FPGA core or ASIC of Microwatt / + LibreSOC to run this code (doable, FPGA softcore + [in progress](https://bugs.libre-soc.org/show_bug.cgi?id=1037)) - Use the finalized Libre-SOC chip (doable once it is ready) -Also note that this only tests for a subset of VSX instructions at the moment, more will be added in the future, this is simply a quick test to run before attempting to run on simulation and/or a softcore as both can be somewhat time consuming. In other words, if this test gives any VSX instructions, don't attempt to run the code in simulation or a softcore to avoid wasting precious time. +Also note that this only tests for a subset of VSX instructions at the +moment, more will be added in the future, this is simply a quick test to +run before attempting to run on simulation and/or a softcore as both can +be somewhat time consuming. In other words, if this test gives any VSX +instructions, don't attempt to run the code in simulation or a softcore +to avoid wasting precious time. -To attempt this test, you will need the scripts from our `dev-env-setup` repository +To attempt this test, you will need the scripts from our `dev-env-setup` +repository -$ git clone https://git.libre-soc.org/git/dev-env-setup.git + $ git clone https://git.libre-soc.org/git/dev-env-setup.git -Again, previous notes about running the scripts apply here, do make sure to read whatever you run, they are short and human-readable. +Again, previous notes about running the scripts apply here, do make sure +to read whatever you run, they are short and human-readable. -Edit the `test-vsx` script to point the `CHROOT` variable to your respective chroot of Debian, read through the script thoroughly, and run +Edit the `test-vsx` script to point the `CHROOT` variable to your +respective chroot of Debian, read through the script thoroughly, and run -$ ./test-vsx + $ ./test-vsx -If you see any number of instructions in certain binary files, those files do contain VSX and work needs to be done (patching the build scripts and/or source code) for these packages. If not, great! Try to run this in a proper SFFS environment to fully test the code you have. +If you see any number of instructions in certain binary files, those +files do contain VSX and work needs to be done (patching the build +scripts and/or source code) for these packages. If not, great! Try to +run this in a proper SFFS environment to fully test the code you have. -You can also test specific binaries at any time by running this part of the script +You can also test specific binaries at any time by running this part of +the script -$ objdump -d $OBJ_FILE | fgrep -of VSX_INSNS.txt | sort | uniq -c | awk '{print $2 " " $1}' + $ objdump -d $OBJ_FILE | fgrep -of VSX_INSNS.txt | sort | uniq -c \ + | awk '{print $2 " " $1}' -Where $OBJ_FILE is the binary you need to check. +Where `$OBJ_FILE` is the binary you need to check. ## Notes and issues -* Some packages will refuse to build with sffs compliant build flags and need workarounds, this will be handled in the future. -* The Linux kernel cannot boot without AltiVec and VSX, even though they are build-time options. The solution for now is to use [microwatt's 5.7 kernel](https://lore.kernel.org/all/CAPweEDw710zFK8KLZY5gsQxEkQKrDiFkNRgABY9HJZ1rxpeVCg@mail.gmail.com/T/) and to incorporate the needed patches upstream in the future. -* Previous note also means this is purely a chroot environment, this page will be updated once it becomes possible to boot a full VM of this build. -* glibc *may* have some issues on sffs, the only way to test this is to run on microwatt which will be done soon. +* Some packages will refuse to build with sffs compliant build flags + and need workarounds, this will be handled in the future. +* The Linux kernel cannot boot without AltiVec and VSX, even though they + are build-time options. The solution for now is to use [microwatt's 5.7 + kernel](https://lore.kernel.org/all/CAPweEDw710zFK8KLZY5gsQxEkQKrDiFkNRgABY9HJZ1rxpeVCg@mail.gmail.com/T/) + and to incorporate the needed patches upstream in the future. +* Previous note also means this is purely a chroot environment, this page + will be updated once it becomes possible to boot a full VM of this build. +* glibc *may* have some issues on sffs, the only way to test this is to + run on microwatt which will be done soon. + -- 2.30.2