<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title> - s390x</title>
    <subtitle>bl0v3&#x27;s blog</subtitle>
    <link rel="self" type="application/atom+xml" href="https://bl0v3.com/tags/s390x/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://bl0v3.com"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2025-01-01T00:00:00+00:00</updated>
    <id>https://bl0v3.com/tags/s390x/atom.xml</id>
    <entry xml:lang="en">
        <title>Porting NixOS to IBM mainframes</title>
        <published>2025-01-01T00:00:00+00:00</published>
        <updated>2025-01-01T00:00:00+00:00</updated>
        
        <author>
          <name>
            bl0v3
          </name>
        </author>
        
        <link rel="alternate" type="text/html" href="https://bl0v3.com/Blog/porting-nixos-to-an-ibm-mainframe/"/>
        <id>https://bl0v3.com/Blog/porting-nixos-to-an-ibm-mainframe/</id>
        
        <content type="html" xml:base="https://bl0v3.com/Blog/porting-nixos-to-an-ibm-mainframe/">&lt;img class=&quot;no-hover&quot;alt=&quot;todo_mainframe_and_nix_logo.jpg&quot;src=&quot;TODO.jpg&quot;&#x2F;&gt;
&lt;p&gt;&lt;strong&gt;TODOS:&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;link to neofetch software about.txt or sth&lt;&#x2F;li&gt;
&lt;li&gt;maybe include a picture of the neofetch&lt;&#x2F;li&gt;
&lt;li&gt;show how to make containers&#x2F;tarballs without kernel&lt;&#x2F;li&gt;
&lt;li&gt;show how to run nixos-install&lt;&#x2F;li&gt;
&lt;li&gt;show how the iso thing works&lt;&#x2F;li&gt;
&lt;li&gt;at some point mention that “lol emulators cool but you will see
that they aint the same shit” (dasd ccwgroup)&lt;&#x2F;li&gt;
&lt;li&gt;show like an abstract from real mainframe configuration (the one on paper)
and how to write them in hercules&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h1 id=&quot;what-does-this-article-address&quot;&gt;What does this article address?&lt;&#x2F;h1&gt;
&lt;p&gt;Like said previously this article documents part of the process I underwent
to get NixOS running on IBM’s mainframe architecture.&lt;&#x2F;p&gt;
&lt;p&gt;While it obviously is somewhat focused on the s390x&#x2F;Z architecture. A few
concepts&#x2F;technologies&#x2F;tricks found here can of course be either partially
or fully applied to the process on other architectures. These roughly are the
points covered:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO clean up, order correctly, give enough insight up here to let
people wishing to only look at a specific section find it&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;-all&lt;&#x2F;p&gt;
&lt;p&gt;-the&lt;&#x2F;p&gt;
&lt;p&gt;-bootstrap&lt;&#x2F;p&gt;
&lt;p&gt;-shit&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO sum divider&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;kernel&#x2F;os&#x2F;boot … etc … shit:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;cross compiling a nixos rootfs tarball and booting this up &lt;strong&gt;TODO maybe also test binfmt&lt;&#x2F;strong&gt;&lt;&#x2F;li&gt;
&lt;li&gt;alpine kexec&lt;&#x2F;li&gt;
&lt;li&gt;building iso&lt;&#x2F;li&gt;
&lt;li&gt;zipl (usage , packaging and linker section fun)&lt;&#x2F;li&gt;
&lt;li&gt;qemu ( focus on differences in hw)&lt;&#x2F;li&gt;
&lt;li&gt;getting nix to run on alpine&lt;&#x2F;li&gt;
&lt;li&gt;installing nixos without nixos&lt;&#x2F;li&gt;
&lt;li&gt;bootstrap process&lt;&#x2F;li&gt;
&lt;li&gt;various obscure package fixes&lt;&#x2F;li&gt;
&lt;li&gt;cross compilation of nixos systems&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;This article may be perceived as rather long. Keep in mind that it does
cover quite a few things not all of these are essential.&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;important&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Important&lt;&#x2F;p&gt;
	&lt;p&gt;Some sections are specific to problems I faced due to the setup
I was doing this in and other than &lt;em&gt;oh hey I didn’t know that&lt;&#x2F;em&gt; may
not really provide you with a lot of actually relevant information.&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;h1 id=&quot;the-situation&quot;&gt;The situation:&lt;&#x2F;h1&gt;
&lt;p&gt;Well where do I start … I’m not even quite sure anymore what motivated me to give this a shot but it more or less boils down to
these 3 points:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;a mainframe somehow managed to appear in front of me … &lt;small&gt;(I guess that doesn’t happen too often)&lt;&#x2F;small&gt;
&lt;img class=&quot;no-hover&quot;alt=&quot;me with a mainframe&quot;src=&quot;https:&amp;#x2F;&amp;#x2F;files.catbox.moe&amp;#x2F;7qze3s.jpg&quot;&#x2F;&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;I wanted to add a platform to Nix(OS) and see how things work &lt;em&gt;“from the ground up”&lt;&#x2F;em&gt; &lt;small&gt;(but nearly everything was already added even risc-v)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;I thought it would be funny to use it to post in in some sort of desktop thread with this &lt;small&gt;but lying ain’t cool
and it actually running there may make it even more funny (or at least I thought so)&lt;&#x2F;small&gt;
&lt;img class=&quot;no-hover&quot;alt=&quot;first_neofetch_s390x_showcase_screencap&quot;src=&quot;https:&amp;#x2F;&amp;#x2F;files.catbox.moe&amp;#x2F;v08l22.jpg&quot;&#x2F;&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I quickly came to the realisation that unlike initially assumed “just running NixOS” (and consequently neofetch) wasn’t as simple as I thought it would be as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;there are no premade s390x isos&#x2F;containers&#x2F;…&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;not even the bootstrap tools were available &lt;em&gt;(thus no &lt;code&gt;pkgs.stdenv {}&lt;&#x2F;code&gt;)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;IBM_System&#x2F;390&quot;&gt;s390(x)&lt;&#x2F;a&gt;&#x2F;&lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Z&#x2F;Architecture&quot;&gt;z&#x2F;Architecture&lt;&#x2F;a&gt; is an &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Endianness&quot;&gt;big endian&lt;&#x2F;a&gt; architecture&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;emulators(&lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Binfmt_misc&quot;&gt;binfmt&lt;&#x2F;a&gt;) are not only broken
but also insanely slow and don’t scale too well across multiple threads&#x2F;cores&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;cross compilation is a pain but you somehow need to build some sort of bootstrap&#x2F;dev system before you can actually run&#x2F;build
things on s390x itself. &lt;small&gt;(as nobody bothered to build them before)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Though with the help of various people (folks working at IBM , friends and a bunch of people involved with NixOS). A little patience and
having spend your teenage years running linux on various cursed platforms ….. these challenges were overcome :D&lt;&#x2F;p&gt;
&lt;h2 id=&quot;where-to-start&quot;&gt;where to start?&lt;&#x2F;h2&gt;
&lt;p&gt;In order to get things running on an s390x host you obviously need to compile your software for the
s390x architecture&#x2F;target. So you either:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;run your compiler&#x2F;buildenv natively
&lt;small&gt;(this assumes that you have these already for the s390x architecture)&lt;&#x2F;small&gt; but as we don’t have
these we can’t.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;you cross-compile from another architecture such as x86 &lt;small&gt;(this did partially work but
is known to cause issues in general)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;TODO: include a small showcase on how to cross compile things on nix&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;One of the things that makes cross compiling rather hard is that you can’t really
execute the binaries you just build. This usually is not a problem and to some degree
nix even accounts for this.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO explain how nix differenciates various buildInputs =        specifications&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Sadly at times there is software that &lt;strong&gt;(often even independently of nix!)&lt;&#x2F;strong&gt; is either very hard to cross compile
OR upright not designed to &lt;small&gt;( … like &lt;code&gt;zipl&lt;&#x2F;code&gt; the bootloader we gonna have to use eventually)&lt;&#x2F;small&gt;.
Thus unless we get native compilation working we can use “&lt;em&gt;the next best thing&lt;&#x2F;em&gt;”:&lt;&#x2F;p&gt;
&lt;h4 id=&quot;getting-a-non-s390x-nixos-host-to-run-s390x-binaries&quot;&gt;getting a non s390x NixOS host to run s390x binaries:&lt;&#x2F;h4&gt;
&lt;p&gt;I expected this to work out of the box but it didn’t, luckily the issue was easy to overcome
and this ended up being a rather quick fix: &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;327665&quot;&gt;added s390x option type via magic attributes #327665&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;As all that had to be done was more or less
adding the &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;qemu&#x2F;qemu&#x2F;blob&#x2F;b69801dd6b1eb4d107f7c2f643adf0a4e3ec9124&#x2F;scripts&#x2F;qemu-binfmt-conf.sh#L95&quot;&gt;magic extension sequence&lt;&#x2F;a&gt; to get the kernel to forward execution via &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Binfmt_misc&quot;&gt;binfmt&lt;&#x2F;a&gt; of all s390x binaries in question to qemu-s390x.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(TODO short showcase of how to enable binfmt with this fix. How to make a nixos system
“belive” it supports this arch. And show like a binaries headers of idk gnu hello and how we
run it on sth that &lt;code&gt;&#x2F;proc&#x2F;cpuinfo&lt;&#x2F;code&gt; denotes as lets say x86)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;moving-beyond-binfmt&quot;&gt;moving beyond binfmt&lt;&#x2F;h2&gt;
&lt;p&gt;After a bunch of crude hacks, overlays and disabled tests I managed to cross-compile the first nixos-s390x rootfs tarball.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO: share it here + share the drvs needed to do so&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO show neofetch and explain how one would build and export a nix system in tarball format&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;While on first glance this looked promising. As expected when running an operation such as &lt;code&gt;nix-shell -p&lt;&#x2F;code&gt; or whatever deals with .drv’s that aren’t already known by hash to nix would fail.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO show the actual error maybe&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Since I guess nobody before me bothered giving this a try &lt;small&gt;(maybe for a good reason)&lt;&#x2F;small&gt; nix wasn’t
properly aware of how to actually build “literally anything” on s390x for s390x. This is due to the bootstrap package
missing and consequently not being able to build &lt;code&gt;stdenv&lt;&#x2F;code&gt;&#x2F;&lt;code&gt;pkgs.stdenv&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;Commands like &lt;code&gt;nixos-rebuild&lt;&#x2F;code&gt; or &lt;code&gt;nixos-install&lt;&#x2F;code&gt; won’t work
without the means (&lt;code&gt;stdenv&lt;&#x2F;code&gt;) to compile stuff locally either.&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;So either one has to accept being unable to build pretty much anything on s390x
itself and stick to cross compilation.&lt;&#x2F;p&gt;
&lt;p&gt;Or alternatively we &lt;strong&gt;get stdenv working!&lt;&#x2F;strong&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;bootstrap-tools-and-overcoming-infinite-regression&quot;&gt;“bootstrap tools” and overcoming infinite regression&lt;&#x2F;h3&gt;
&lt;p&gt;When building a system from the ground up &lt;strong&gt;(independently of nix)&lt;&#x2F;strong&gt; it usually goes something like &lt;q&gt;you need a compiler to build a compiler to build a libc to build a compiler that builds a compiler ….&lt;&#x2F;q&gt;. But where would
that &lt;em&gt;“first compiler”&lt;&#x2F;em&gt; come from?&lt;&#x2F;p&gt;
&lt;p&gt;The problem presents itself a little bit similar to the chicken and egg
problem as in both cases at the core its &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Infinite_regress&quot;&gt;infinite regress&lt;&#x2F;a&gt;
that we need to overcome. Luckily in our case it can be solved but first we should establish some terminology:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-exactly-are-bootstrap-tools&quot;&gt;what exactly are “bootstrap tools”?&lt;&#x2F;h3&gt;
&lt;p&gt;With nix we don’t exactly start with just a compiler, we actually ship multiple executables.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO actually build the thing and just show an abstract raw from the terminal&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO give https:&#x2F;&#x2F;trofi.github.io&#x2F;posts&#x2F;240-nixpkgs-bootstrap-intro.html some credit&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO look at the most current drv as well at https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;blob&#x2F;master&#x2F;pkgs&#x2F;stdenv&#x2F;linux&#x2F;make-bootstrap-tools.nix&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;These roughly look like:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO do we want to talk about how its linked esp when trofi already did it?&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;busybox (statically linked against musl)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;gcc (this package and below are dynamically linked against glibc)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;glibc binutils coreutils tar bash findutils diffutils sed grep awk
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;gzip bzip patch patchelf gmp mpfr mpc zlib isl libelf
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;The collection of these utilities is what one refers to in this context when talking about “bootstrap tools”.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO talk about how on nix its very important that this is pure and why shipping lets say busybox makes
a lot of sense instead of using the system coreutils or pretty much anything from the system&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;how-to-obtain-bootstrap-tools&quot;&gt;how to obtain “bootstrap tools”&lt;&#x2F;h3&gt;
&lt;p&gt;While there are actually 2 ways to go on about obtaining&#x2F;building these “bootstrap tools”, I will focus on the
approach which cross compiles them like seen with risc-v for example.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;For good reasons its very uncommon to build these “bootstrap tools” and
unless the architecture lacks support there is no need to do so.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO: maybe show the error nix throws if the bootstrap tools don’t exist yet&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO fact check: I think unless you run the maintainer script nix will not build
them and just give up upon finding out that they aren’t hosted anywhere as at some point
we declare them with “=” for the arch so It should trigger some sort of attribute not found
error or sth instead of attempting to build or complaining the drv lacks&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;To get nix to build these bootstrap tools a few things need to be done before we can proceed:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;describe the target in &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;blob&#x2F;master&#x2F;lib&#x2F;systems&#x2F;examples.nix&quot;&gt;lib&#x2F;systems&#x2F;examples.nix&lt;&#x2F;a&gt; …
&lt;small&gt;this was actually the only thing already done and only requires like one line&lt;&#x2F;small&gt;
Taking a look at the entries here for lets say m68k , s390 as well as s390x&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# ...&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;m68k&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;config&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;m68k-unknown-linux-gnu&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;s390&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;config&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;s390-unknown-linux-gnu&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;s390x&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;config&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;s390x-unknown-linux-gnu&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# ...&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;one sort of gets the point. Some “systems” are more involved though providing variables for libc&#x2F;gcc(fpu+arch)&#x2F;rustc&#x2F;xcode&#x2F;…
luckily we don’t need to do that here.
&lt;small&gt;there are still some platform specific things to take care of as you will see later&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;
&lt;p&gt;with &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;blob&#x2F;master&#x2F;lib&#x2F;systems&#x2F;examples.nix&quot;&gt;lib&#x2F;systems&#x2F;examples.nix&lt;&#x2F;a&gt; from above now providing us with &lt;code&gt;pkgsCross.s390x&lt;&#x2F;code&gt; we can make the adequate change to &lt;code&gt;pkgs&#x2F;stdenv&#x2F;linux&#x2F;make-bootstrap-tools-cross.nix&lt;&#x2F;code&gt; via &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;327715&quot;&gt;bootstrap-tools-cross: add s390x to make-bootstrap-tools-cross.nix #327715&lt;&#x2F;a&gt; which should get NixOS’s CI “hydra” actually attempt to build this&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;Modifying &lt;code&gt;CROSS_TARGETS&lt;&#x2F;code&gt; in &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;commit&#x2F;313fc26d22d34e0dfb9c0922b3a687d03452199f&quot;&gt;maintainers&#x2F;scripts&#x2F;bootstrap-files&#x2F;refresh-tarballs.bash&lt;&#x2F;a&gt; to include &lt;code&gt;&quot;s390x-unknown-linux-gnu&quot;&lt;&#x2F;code&gt;. As running this script will provide us with the urls&#x2F;hashes and some metadata about these bootstrap files. This relies on 1) &amp;amp; 2) of course. The end result looks something like this:&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# Autogenerated by maintainers&#x2F;scripts&#x2F;bootstrap-files&#x2F;refresh-tarballs.bash as:&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# $ .&#x2F;refresh-tarballs.bash --targets=s390x-unknown-linux-gnu&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;#&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# Metadata:&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# - nixpkgs revision: 8ba481d65eb21a4f9e6b1e812de3f83079eb8016&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# - hydra build: https:&#x2F;&#x2F;hydra.nixos.org&#x2F;job&#x2F;nixpkgs&#x2F;cross-trunk&#x2F;bootstrapTools.s390x-unknown-linux-gnu.build&#x2F;latest&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# - resolved hydra build: https:&#x2F;&#x2F;hydra.nixos.org&#x2F;build&#x2F;267960435&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# - instantiated derivation: &#x2F;nix&#x2F;store&#x2F;hqmllvbilxslp393ci4lkj66psh5iv6a-stdenv-bootstrap-tools-s390x-unknown-linux-gnu.drv&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# - output directory: &#x2F;nix&#x2F;store&#x2F;wnr3zf16ci8ajxnv0v6w3dn8lm93gp5z-stdenv-bootstrap-tools-s390x-unknown-linux-gnu&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# - build time: Sun, 28 Jul 2024 14:47:36 +0000&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;bootstrapTools&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-support z-function z-nix&quot;&gt;import&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-unquoted z-spath z-nix&quot;&gt;&amp;lt;nix&#x2F;fetchurl.nix&amp;gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;url&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;http:&#x2F;&#x2F;tarballs.nixos.org&#x2F;stdenv&#x2F;s390x-unknown-linux-gnu&#x2F;8ba481d65eb21a4f9e6b1e812de3f83079eb8016&#x2F;bootstrap-tools.tar.xz&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;hash&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;sha256-fuKIRXznA8hU8uGpxldAUNvuJBZ&#x2F;xiyJUByNbpBCaH8=&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;busybox&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-support z-function z-nix&quot;&gt;import&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-unquoted z-spath z-nix&quot;&gt;&amp;lt;nix&#x2F;fetchurl.nix&amp;gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;url&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;http:&#x2F;&#x2F;tarballs.nixos.org&#x2F;stdenv&#x2F;s390x-unknown-linux-gnu&#x2F;8ba481d65eb21a4f9e6b1e812de3f83079eb8016&#x2F;busybox&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;hash&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;sha256-R6nAiaIOgShKiu+qcOP9apVpnuJgTAGAsJxWSHsH4&#x2F;A=&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;executable&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-constant z-language z-nix&quot;&gt;true&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;and located at &lt;code&gt;pkgs&#x2F;stdenv&#x2F;linux&#x2F;bootstrap-files&#x2F;s390x-unknown-linux-gnu.nix&lt;&#x2F;code&gt;. We then need to source this in &lt;code&gt;pkgs&#x2F;stdenv&#x2F;linux&#x2F;default.nix&lt;&#x2F;code&gt;. You can see the commits achiving this here: &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;332462&#x2F;commits&#x2F;398058603f13a57ca0ed891e81dcf6d39b9a9e05&quot;&gt;stdenv: add bootstrap files for s390x&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;the hydra builds get flushed within 2 weeks or something so don’t let too much time pass when having the tarballs uploaded. This is done manually
still.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;em&gt;As you can see below this mixed with another problem actually ended up in me having to push the bootstrapTools
urls&#x2F;hash file twice …&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;332462&#x2F;commits&#x2F;bdb500ace1fdc02ab754c58302583e9c4f8ec17f&quot;&gt;bintools-wrapper: add dynamicLinker for s390x&lt;&#x2F;a&gt; is also needed as otherwise while we got the bare bootstrap files working we can’t properly link at further stages as the shared library loader would be wrong.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;unforseen-consequences-of-forgetting-a-commit-message&quot;&gt;unforseen consequences of forgetting a commit message&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;TODO mention that technially seen it wasn’t required to put the pasta&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I wasn’t sure if I should mention this as its quite unlikely that this will happen again. But I think its
interesting enough to still mention it &lt;strong&gt;whomever reads this probably really won’t
have to care about this again though&lt;&#x2F;strong&gt;. So here we go:&lt;&#x2F;p&gt;
&lt;p&gt;I did make a tiny mistake with consequences a little bigger than anyone up until then expected. &lt;a href=&quot;https:&#x2F;&#x2F;discourse.nixos.org&#x2F;t&#x2F;bootstrap-files-updates-amplifiy-exploit-of-any-package-into-exploit-of-every-package&#x2F;50534&quot;&gt;Bootstrap-files updates amplifiy exploit of &lt;em&gt;any&lt;&#x2F;em&gt; package into exploit of &lt;em&gt;every&lt;&#x2F;em&gt; package&lt;&#x2F;a&gt; was the result of that mistake. I won’t attempt to explain the issue here once more since its already touched upon in discourse.nixos.org but its still funny to note that essentially the only thing that lead to the discovery of this was:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;332462&quot;&gt;Bootstrap tools cross add s390x #332462&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;not including the copypasta like seen in:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;334334&quot;&gt;pkgs&#x2F;stdenv&#x2F;linux: update s390x-unknown-linux-gnu bootstrap-files #334334&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;(Despite the commits being functionally the same)&lt;&#x2F;em&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO maybe actually explain it showcasing the issue more in detail&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ol start=&quot;4&quot;&gt;
&lt;li&gt;Won’t really be carried out by you anymore unless well you have access to &lt;code&gt;tarballs.nixos.org&lt;&#x2F;code&gt;, it may still be interesting to see what would roughly take place though&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;nix-store&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;realize&lt;&#x2F;span&gt; &#x2F;nix&#x2F;store&#x2F;ijkl5anf7mx1p3whdkxv4qs5crf6ic35-stdenv-bootstrap-tools-s390x-unknown-linux-gnu&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;aws&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; s3 cp&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;recursive&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;acl&lt;&#x2F;span&gt; public-read &#x2F;nix&#x2F;store&#x2F;ijkl5anf7mx1p3whdkxv4qs5crf6ic35-stdenv-bootstrap-tools-s390x-unknown-linux-gnu&#x2F;on-server&#x2F; s3:&#x2F;&#x2F;nixpkgs-tarballs&#x2F;stdenv&#x2F;s390x-unknown-linux-gnu&#x2F;0a7eaa55ccaa5103f44a9a4e3e0b06e5314a6401&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;aws&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; s3 cp&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; --&lt;&#x2F;span&gt;recursive&lt;&#x2F;span&gt; s3:&#x2F;&#x2F;nixpkgs-tarballs&#x2F;stdenv&#x2F;s390x-unknown-linux-gnu&#x2F;0a7eaa55ccaa5103f44a9a4e3e0b06e5314a6401 .&#x2F;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;sha256sum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; bootstrap-tools.tar.xz busybox&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;sha256sum&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &#x2F;nix&#x2F;store&#x2F;ijkl5anf7mx1p3whdkxv4qs5crf6ic35-stdenv-bootstrap-tools-s390x-unknown-linux-gnu&#x2F;on-server&#x2F;&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;The previously mentioned security concerns resulted in
commands listed above now automatically being included in that pasta
like seen at &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;334334&quot;&gt;pkgs&#x2F;stdenv&#x2F;linux: update s390x-unknown-linux-gnu bootstrap-files #334334&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO I very very much feel like this but on second thought I may have put them there myself
but im weirdly confident about
them already being there as I remember asking myself (is this a some github feature i don’t know of?!)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;All of these changes should provide us with an stdenv sufficient to build some basic packages.
But of course a few more things require bootstrapping especially for languages that require
more involved forms of bootstrapping.&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;TODO find a way to not make the term waste space
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;when using ` ticks and language highlihting there
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; TODO show how now:&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;nix&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; build .#hello&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;.&#x2F;result&#x2F;bin&#x2F;hello&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; appears to be working&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;h3 id=&quot;bootstrapping-rust&quot;&gt;bootstrapping rust&lt;&#x2F;h3&gt;
&lt;p&gt;Its 2024, rust is growing more and more popular and in fact
in no time you get stuck when building NixOS systems that aren’t
extremely minimal. As &lt;em&gt;“something”&lt;&#x2F;em&gt; will end up depending on it
in some way. &lt;small&gt;(originally I wanted to add it much later on but
it kept showing up as a dependency … luckily its rather trivial to add)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO: factcheck I think this even happens with the default profiles (rust being a dep)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;337908&quot;&gt;rust: S390x add native support (bootstrap files) #337908&lt;&#x2F;a&gt; and  &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;pull&#x2F;337907&quot;&gt;openblas: Enable s390x-linux #337907&lt;&#x2F;a&gt; take care of that.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;Assuming we forget about haskell since they refuse to offer bootstrap packages for s390x or riscv or some other cpus and cross compiling these is a pain and there are issues specifically on s390x (riscv sorta works).
&lt;strong&gt;TODO maybe link the issues&lt;&#x2F;strong&gt;&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;gcc-arch-march-matters&quot;&gt;gcc.arch (march) matters …&lt;&#x2F;h3&gt;
&lt;p&gt;While for now most work focussed on bootstrapping things
and it should be &lt;em&gt;“enough”&lt;&#x2F;em&gt; to build most pkgs and even
a basic nixos system natively. This is with the assumption
that &lt;code&gt;gcc.march&lt;&#x2F;code&gt; is set adequately.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO: show the actual errors&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;Honestly as I don’t feel like touching llvm for now and it
may not be trivial to fix this there is a way to prevent
running in various &lt;code&gt;gcc.arch&lt;&#x2F;code&gt; related issues during various builds:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;caution&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Caution&lt;&#x2F;p&gt;
	&lt;p&gt;&lt;strong&gt;NOT specifying &lt;code&gt;gcc.arch = &quot;z10&quot;;&lt;&#x2F;code&gt; OR NEWER
WILL LIKELY CAUSE BUILD FAILURES&lt;&#x2F;strong&gt;&lt;small&gt;(working on it though)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;It should be possible to avoid these issues by
essentially just setting &lt;code&gt;gcc.arch=z10;&lt;&#x2F;code&gt; or &lt;code&gt;gcc.arch=TODO_FURTHER_ARCHES_NAMES&lt;&#x2F;code&gt; like seen below.&lt;&#x2F;p&gt;
&lt;p&gt;Until the decision is made on whether to set this within nixpkgs to &lt;code&gt;&quot;z10&quot;&lt;&#x2F;code&gt; or newer, you can
use something like this in your configuration.nix &#x2F; flake.nix&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;nixpkgs&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;hostPlatform&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;system&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;s390x-linux&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# linux-kernel = { ... };&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# ... other settings&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;gcc&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;arch&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;z10&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;small&gt;Personally I think there is little point to
supporting anything older than the Z10 (2008)
because it seems to cause significantly more issues
and there is another problem:
&lt;del&gt;even IBM’s bootloader appears to assume
that the march is no older than Z10&lt;&#x2F;del&gt;
&lt;strong&gt;(TODO start of 2025 IBM fixed this
after I pointed it out to them)!!!!&lt;&#x2F;strong&gt;
&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;obscure-errors-during-testphase&quot;&gt;obscure errors during &lt;code&gt;testPhase&lt;&#x2F;code&gt;?&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;small&gt;&lt;strong&gt;TODO talk about failing tests
and stuff while they should be mostly fixed by
now mention that at times esp to move forward
its ok to temporarily ignore some tests maybe
for the sake of getting things to build. Crude
but I wanted a PoC ASAP&lt;&#x2F;strong&gt;
&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;&lt;small&gt;getting bored? Don’t worry
now that we have established the required
basis to build a proper nixos sytem
…
&lt;strong&gt;things may get more interesting now&lt;&#x2F;strong&gt;
&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h1 id=&quot;making-our-system-bootable&quot;&gt;making our system bootable&lt;&#x2F;h1&gt;
&lt;p&gt;With the fixes&#x2F;commits&#x2F;settings previously mentioned applied,
the only NixOS systems &lt;small&gt;(as build in via: &lt;code&gt;nixpkgs.nixosSystem {}&lt;&#x2F;code&gt;)&lt;&#x2F;small&gt;
are essentially everything that does not require:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;the bootloader (zipl)&lt;&#x2F;li&gt;
&lt;li&gt;the kernel image&lt;&#x2F;li&gt;
&lt;li&gt;the initrd&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;that effectively means:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;using a tarball (without kernel&#x2F;initrd&#x2F;bootloader) as the output format&lt;&#x2F;li&gt;
&lt;li&gt;using container images &lt;small&gt;(essentially a system rootfs tarball + metadata)&lt;&#x2F;small&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;a little bit further down we take care of the absence of these 3 things. Though
for those interested this is how to construct such container&#x2F;tarballs:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;(TODO maybe show how build a tarball &#x2F; container)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;enable-nixos-to-build-kernels-initrds&quot;&gt;enable NixOS to build kernels &#x2F; initrds&lt;&#x2F;h2&gt;
&lt;p&gt;Like implied previously boot methods such as:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;ISO_9660&quot;&gt;ISO 966&lt;&#x2F;a&gt;&lt;small&gt;(also known as simply “.iso” files)&lt;&#x2F;small&gt;&lt;&#x2F;li&gt;
&lt;li&gt;kexec&lt;&#x2F;li&gt;
&lt;li&gt;zipl&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;all require some sort of kernel image + initrd. This part describes how enable NixOS to build these:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;building-the-kernel&quot;&gt;building the kernel&lt;&#x2F;h3&gt;
&lt;p&gt;To get NixOS to attempt to build a kernel we first
need to give it some details it will use when attempting to build the kernel.&lt;&#x2F;p&gt;
&lt;p&gt;In this case telling it that the &lt;code&gt;baseConfig&lt;&#x2F;code&gt; shall be taken from the platform (s390x)
specific &lt;small&gt;(kernel)&lt;&#x2F;small&gt; defconfig. And that the target to be expected is &lt;code&gt;&quot;bzImage&quot;&lt;&#x2F;code&gt; is enough.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;nixpkgs&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;hostPlatform&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;system&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;s390x-linux&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;linux-kernel&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;target&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;bzImage&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;name&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;s390x-defconfig&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;autoModules&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-constant z-language z-nix&quot;&gt;true&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;baseConfig&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;defconfig&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;tip&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Tip&lt;&#x2F;p&gt;
	&lt;p&gt;While if you actually end up building this
specifically for some (IBM Z) mainframe
the linux kernel does in fact have varoius arch&#x2F;target
specific specifc optimisation flags. Feel free to use
them or even better see what they do first.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO link the options I’m talking about here&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;small&gt; This will probably make it into nixpkgs platform
specifications (there are still things that need to be discussed).
In that case you wouldn’t need to do this anymore but until then
or just as a general &lt;em&gt;“method”&lt;&#x2F;em&gt; thats how it can be done &lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO: give some insight in how nix actually builds the kernel
and how these variables make it there&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;building-the-initrd&quot;&gt;building the initrd&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;strong&gt;TODO reword this part&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;By default the &lt;code&gt;linuxArch&lt;&#x2F;code&gt; is set to &lt;code&gt;&quot;s390&quot;&lt;&#x2F;code&gt;
not &lt;code&gt;&quot;s390x&quot;&lt;&#x2F;code&gt; &lt;small&gt;(just like it would select &lt;code&gt;x86&lt;&#x2F;code&gt; instead of &lt;code&gt;x86_64&lt;&#x2F;code&gt;)&lt;&#x2F;small&gt;. As that compiles just fine one may expect it to
work just fine as well but sadly thats actually not the case as for &lt;code&gt;&quot;s390&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO link where this happens&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;For example the &lt;code&gt;ifconfig&lt;&#x2F;code&gt; utility found within the initrd
which is invoked when passing &lt;code&gt;&quot;ip=&quot;&lt;&#x2F;code&gt; type parameters trough the kernel commandline
will actually thorw an obscure &lt;strong&gt;“parsing error”&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;TODO &amp;lt;paste the actual error here&amp;gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;For some reason this doesen’t happen on the 64bit 390x counterpart.&lt;&#x2F;p&gt;
&lt;p&gt;While klibc does actually claim to support s390 I couldn’t get this properly runnig with
ifconfig.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;can-we-just-use-64bit&quot;&gt;can we just use 64bit?&lt;&#x2F;h3&gt;
&lt;p&gt;sort of … and honestly if using 64bit works without these
obscure issues. I belive that &lt;small&gt;(at least for now)&lt;&#x2F;small&gt; it should be fine.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;The reasoning to use an &lt;code&gt;linuxArch&lt;&#x2F;code&gt; with a smaller bitsize &lt;strong&gt;TODO or how do you call this&lt;&#x2F;strong&gt;
exclusively within the initrd is for size binary reasons. Shorter Pointers and opcodes
naturally produce smaller executables than if the bitsize &lt;strong&gt;TODO how to call this&lt;&#x2F;strong&gt; was for example 2x as big&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;to be honest I think that the size argument is much less relevant on mainframes when
booting via zipl. As the files are actually commonly found on the systems “&#x2F;” partition
which shouldn’t lack storage like mainframes in general.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;warning&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Warning&lt;&#x2F;p&gt;
	&lt;p&gt;&lt;strong&gt;TODO find it again: there was this one case (was it cdrom?) where either both combined
or maybe individuallly kernel and initrd had to be below a certain size&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;In such cases maybe one actually benefits from a smaller &lt;code&gt;linuxArch&lt;&#x2F;code&gt;. I think this shouldn’t
matter though as long as one doesn’t build initrds with a lot of &lt;em&gt;“extra utilities”&lt;&#x2F;em&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;In such cases though thats usually due to more involved crypto key
retrival operations. (ipsec&#x2F;wg&#x2F;tor&#x2F;…) and in such cases I think using 32bit
may actually be a security concern.&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;This may be a little more relevant if it was common to use some form
of a dedicated &lt;code&gt;&quot;&#x2F;boot&#x2F;&quot;&lt;&#x2F;code&gt; partition instead &lt;small&gt;(like see with EFI vfat32 based
boot partitions)&lt;&#x2F;small&gt;. But I guess as long as the zipl bootloader is used its fine to just boot from &lt;code&gt;&quot;&#x2F;&quot;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO include notice of&lt;&#x2F;strong&gt;: sth like: ( This of course assumes that your filesystem allows these old style bootloaders, ext4 does) &amp;lt; name how these sort of bootloaders that just sorta
remember the location of a file on the filesystem are called&amp;gt; blockdevice and load that … as afaik zipl only works with this kind of filesystem &amp;gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO: talk more about how the bootloader works in detail maybe&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;p&gt;so … are we finally good to go?&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;first-boots-and-debugging-them-with-limited-tools&quot;&gt;first boots (AND debugging them with limited tools)&lt;&#x2F;h2&gt;
&lt;p&gt;I guess before things get a little ugly. I should point out that
of course a few more settings need to be done and of course
you need an actual nixos system configuration to build. Instead
of going trough every snippet especially as a lot of them
may change in the future I will just link &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bolives-hax&#x2F;nixos-s390x-images&#x2F;blob&#x2F;master&#x2F;flake.nix&quot;&gt;my confgigs&lt;&#x2F;a&gt;.
As for now I’m more or less using &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bolives-hax&#x2F;nixos-s390x-images&#x2F;commit&#x2F;cade49a7dfbd4bb48145f48456a38faa84550c9b&quot;&gt;this commit&lt;&#x2F;a&gt;
which despite being a little crude does at least produce working&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;lxc compatible images&lt;&#x2F;li&gt;
&lt;li&gt;kexec bundles (live systems)&lt;&#x2F;li&gt;
&lt;li&gt;rootfs tarballs&lt;&#x2F;li&gt;
&lt;li&gt;cdrom images &lt;small&gt;(will touch on that later on)&lt;&#x2F;small&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;Getting whatever I produced to actually boot up succesfully isn’t quite as straightforward
as I hoped it would be. Thats why the next section first points out the limitations I faced
and how I worked around them.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;the-restrictions&quot;&gt;The restrictions&lt;&#x2F;h3&gt;
&lt;p&gt;Well honestly the biggest issue is the &lt;strong&gt;complete absence&lt;&#x2F;strong&gt; of a serial interface on the Z15 mainframe provided to me by IBM&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;I did contact IBM regarding the absence of a serial out of bounds console
and while they sadly couldn’t provide me with this please
keep in mind that this is not an issue people using the comercial platforms
would face.&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;So since I brought it up before and even included a picture. You may wonder:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;q&gt;hey what about the Z10 why don’t you just use that?!&lt;&#x2F;q&gt;&lt;&#x2F;p&gt;
&lt;aside&gt; pic related: &lt;img class=&quot;no-hover&quot;alt=&quot;power_plug_used_pic&quot;src=&quot;https:&amp;#x2F;&amp;#x2F;files.catbox.moe&amp;#x2F;t3611w.jpg&quot;&#x2F;&gt;&lt;&#x2F;aside&gt;
&lt;p&gt;Well as you can probably tell by the picture, just using the closest ordinary poweroutlet
won’t really cut it. In fact there is 2 problems&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;(&lt;strong&gt;TODO say a little about the connector, where its found, how it differs from ordinary
one and well trough this point out why we essentially need this) (and say the outlet for “this” is far away and the cable had to be made bla bla)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;&lt;blockquote class=&quot;important&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Important&lt;&#x2F;p&gt;
	&lt;p&gt;&lt;strong&gt;TODO explain the FI trip mechanism as well) Additionally turns out the (TODO translate FI schutzschalter) would actually trip with the default (TODO FI term). (TODO list what strengths were used I believe it was 30mA and eventually 300mA TODO confirm this).&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;((As an interesting sidenote up until the Z &lt;strong&gt;TODO which Z-series&lt;&#x2F;strong&gt; mainframe, having a relatively high leakage current apparently was the norm as it could be attributed to the way IBM
designed the &lt;strong&gt;?power distribution circuts TODO or how to call this?&lt;&#x2F;strong&gt;. So
actually having a &lt;strong&gt;TODO english term for FI&lt;&#x2F;strong&gt; trip is the expected behavior eventhough one may be
under the assumption that this is not the intended behavior.))&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;

&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;other-reasons&quot;&gt;other reasons:&lt;&#x2F;h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;While being able to play around with a IBM Z15 mainframe is definitively something. Nobody
except me would really benefit from me getting to run NixOS on it. But in all honesty this
would be a waste of resources. IBM is paying the power either way and the idea after all
is to use this for developping&#x2F;building open source community projects.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;As IBM already agreed to provide me with additional resources on the Z15 to make it
part of the offcial NixOS CI. I decided to talk with some folks from the NixOS infra team who
gave their OK and the current plan is to use this server to offer
cached packages&#x2F;drv builds for nixos on s390x stemming from an officially trusted source&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;The Z15 is also obviously much newer and performs better in quite a few scenarios&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;so all in all it makes sense to use what they provided me with and the most desirable
outcome would be that its being used for hydra &#x2F; cache.nixos.org&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-are-the-implications-of-using-ibm-s-z15-instead-of-the-z10&quot;&gt;what are the implications of using IBM’s Z15 instead of the Z10?&lt;&#x2F;h3&gt;
&lt;p&gt;Concretely this means: I am &lt;strong&gt;completely “blind”&lt;&#x2F;strong&gt; until … well … “something” boots up and responds to me&lt;&#x2F;p&gt;
&lt;p&gt;Of course I knew that this would cause me a lot of pain &lt;del&gt;but then I seem to get lucky at times&lt;&#x2F;del&gt;.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;what-about-using-emulators&quot;&gt;What about using emulators?&lt;&#x2F;h3&gt;
&lt;p&gt;Luckily emulators while slow
(especially &lt;a href=&quot;https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Hercules_(emulator)&quot;&gt;Hercules&lt;&#x2F;a&gt;)
are still a viable choice.
Qemu in fact is fast enough for me to not really be bothered especially
when running &lt;em&gt;“minimal linux kernels&#x2F;userland applications”&lt;&#x2F;em&gt;. As unlike the Z15 hosted by IBM
qemu does provide me with a serial console. The idea of using that until I confirmed that my initrd
was somewhat behaving like expected made sense to me at that time&lt;&#x2F;p&gt;
&lt;p&gt;&lt;mark&gt;I must already give you a heads up here, things weren’t as simple
&lt;br&gt;…&lt;br&gt;
(I could have expected that)&lt;&#x2F;mark&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Just like with kexec to boot this in qemu we need a kernel+initrd image
to pass over the commandline.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;(unless were ok with using iso images. But as of
&lt;strong&gt;numours issues&lt;&#x2F;strong&gt; usually of the &lt;em&gt;“I wish someone would have told me”&lt;&#x2F;em&gt;-kind
I didn’t manage to produce these yet at that time&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;h4 id=&quot;building-the-nixos-system-components&quot;&gt;building the NixOS-system components&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;TODO either modify the snippets below to use qemu or mention
that I was just copying the paths from the kexec script as its
functionally almost the same&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Well while you can of course look at the config it does go somewhat like:&lt;&#x2F;p&gt;
&lt;ol&gt;
&lt;li&gt;import the &lt;code&gt;&amp;lt;nixos&#x2F;modules&#x2F;installer&#x2F;netboot&#x2F;netboot-minimal.nix&amp;gt;&lt;&#x2F;code&gt; module&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;blockquote&gt;
&lt;p&gt;while we aren’t going to netboot we still don’t want to split initrd
and whatever holds the root system. &lt;small&gt;You will see later why simplicity is key&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;ol start=&quot;2&quot;&gt;
&lt;li&gt;using some form of Mic92s &lt;a href=&quot;https:&#x2F;&#x2F;gist.github.com&#x2F;Mic92&#x2F;4fdf9a55131a7452f97003f445294f97&quot;&gt;kexec script&lt;&#x2F;a&gt;
&lt;small&gt;(while I don’t use it the concept is pretty much the same)&lt;&#x2F;small&gt;.
The attribute set spit out by &lt;code&gt;nixpkgs.lib.nixosSystem {}&lt;&#x2F;code&gt;
has the &lt;code&gt;config&lt;&#x2F;code&gt; attribute from which specifically &lt;code&gt;config.system.build&lt;&#x2F;code&gt; is of interest to us. Thus&lt;&#x2F;li&gt;
&lt;&#x2F;ol&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;x&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;nixpkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;lib&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;nixosSystem&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;        &lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# ... the config&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;would make &lt;code&gt;x&lt;&#x2F;code&gt; expose &lt;code&gt;x.config.system.build&lt;&#x2F;code&gt; and consequently:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;x.config.system.build.toplevel&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;x.config.system.build.netbootRamdisk&lt;&#x2F;code&gt; (comes from the &lt;code&gt;netboot-minimal.nix&lt;&#x2F;code&gt; module we loaded before)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;x.config.system.build.kernel&lt;&#x2F;code&gt;&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;As these are all derivations we can also build them individually using
nix build or use the &lt;code&gt;${}&lt;&#x2F;code&gt; operator on them. As all derivations
produce an &lt;code&gt;.outPath&lt;&#x2F;code&gt; &lt;small&gt;(&#x2F;nix&#x2F;store&#x2F;&lt;code&gt;&amp;lt;hash&amp;gt;&lt;&#x2F;code&gt;-name)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;.toplevel&lt;&#x2F;code&gt; Is the store path to something that qualifies as an
nixos system. Of particular interest here would be &lt;code&gt;${system.build.toplevel}&#x2F;init&lt;&#x2F;code&gt; as we
need to pass that via the kernel commandline &lt;small&gt;(&lt;code&gt;init=&lt;&#x2F;code&gt;)&lt;&#x2F;small&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;.netbootRamdisk&lt;&#x2F;code&gt; is essentially a &lt;em&gt;“fat initrd”&lt;&#x2F;em&gt;. As initrds usually just
contain a very minimal linux environment to mount the actual root drive.
We need to specifically build one that actually houses our entire system&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;.kernel&lt;&#x2F;code&gt; I believe needs no explaination. Though keep in mind that the
location may differ. Here it should be bzImage &lt;strong&gt;TODO confirm this&lt;&#x2F;strong&gt;
&lt;strong&gt;TODO maybe explain how nix chooses the kernel image format and
how to retrive it&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;while not a derivation &lt;code&gt;.config.boot.kernelParams&lt;&#x2F;code&gt; is also integral
as it contains effectively our kernel commandline that we either
pass to kexec via &lt;code&gt;--commandline&lt;&#x2F;code&gt; or qemu via &lt;code&gt;--append&lt;&#x2F;code&gt;. Retriving
this can simply be done trough calling &lt;code&gt;toString&lt;&#x2F;code&gt; on it like
&lt;code&gt;${x.config.boot.kernelParams}&lt;&#x2F;code&gt; or using &lt;code&gt;nix eval&lt;&#x2F;code&gt; &lt;strong&gt;(TODO show an example for eval)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO check if this simplified snippet actually works like mine&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;If we wanted to output this as a kexec script it would look something like this:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;kexecScript&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;writeScriptBin&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;kexec-boot&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-other z-start z-nix&quot;&gt;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;      .&#x2F;kexec --load &lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;system&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;kernel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;bzImage \
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;      --initrd=&lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;system&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;netbootRamdisk&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;initrd \
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;      --command-line &amp;quot;init=&lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;system&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;toplevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;init &lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-function z-nix&quot;&gt;toString&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;boot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;kernelParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;    &lt;span class=&quot;z-punctuation z-definition z-string z-other z-end z-nix&quot;&gt;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;TODO test the qemu one and put it on git as well and maybe make it
a little smarter than hardcoding mem like via nix run and accepting
dunno additionall params or sth like -m or -net instead of hardcoding them&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;qemuScript&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;writeScriptBin&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;qemu-boot&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-other z-start z-nix&quot;&gt;&amp;#39;&amp;#39;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;    &lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;qemu&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;bin&#x2F;qemu-system-s390x -M s390-ccw-virtio \
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;        -m 2048 -smp 4 -nographic  \
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;        -net nic -net user \
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;        -kernel &lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;system&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;kernel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;bzImage \
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;        -initrd &lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;system&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;netbootRamdisk&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;initrd \
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;        -append &amp;quot;init=&lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;system&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;build&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;toplevel&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;init &lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-support z-function z-nix&quot;&gt;toString&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;x&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;boot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;kernelParams&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&amp;quot;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-string z-quoted z-other z-nix&quot;&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;TODO mention how to use nix repl to elegantly retrive
these&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO talk about the limited set of drivers, that dasd’s can’t be emulated here (TODO are you 1000% sure)
and youd need hercules (maybe also show how to do that)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;booting-nixos-qemu&quot;&gt;booting NixOS (qemu)&lt;&#x2F;h2&gt;
&lt;p&gt;if we either extract the variables from above or use the kexec script we build we will end up
with&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;qemu-system-s390x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;M&lt;&#x2F;span&gt; s390-ccw-virtio &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    -&lt;&#x2F;span&gt;m&lt;&#x2F;span&gt; 2048&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;smp&lt;&#x2F;span&gt; 4&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;nographic&lt;&#x2F;span&gt;  &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    -&lt;&#x2F;span&gt;net&lt;&#x2F;span&gt; nic&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;net&lt;&#x2F;span&gt; user &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    -&lt;&#x2F;span&gt;kernel&lt;&#x2F;span&gt; &#x2F;TODO&#x2F;NIX&#x2F;STORE&#x2F;aaaaaaaaaaaaaaaaaa&#x2F;bzImage &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    -&lt;&#x2F;span&gt;initrd&lt;&#x2F;span&gt; &#x2F;TODO&#x2F;NIX&#x2F;STORE&#x2F;aaaaaaaaaaaaaaaaaa&#x2F;initrd &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    -&lt;&#x2F;span&gt;append&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;init=&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;x.config.system.build.toplevel&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;init &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;toString x.config.boot.kernelParams&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;tip&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Tip&lt;&#x2F;p&gt;
	&lt;p&gt;For a variety of reasons when doing these sort of things its &lt;mark&gt;very useful&lt;&#x2F;mark&gt; to
be able to drop a shell in the early initrd stages upon failure. Like when
adding &lt;code&gt;boot.shell_on_fail&lt;&#x2F;code&gt; to the kernel commandline. But also deliberately dropping it.
It is quite likely that you will
need to drop it specifically during various stages of the initrd. There are a few
kernel commandline parameters that can be used (besides just patching the init template scripts of course):&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;boot.debug1&lt;&#x2F;code&gt; &lt;strong&gt;TODO im not sure anymore if the serial console
provided by qemu is already usable&#x2F;configured in this stage of the init&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;boot.debug1devices&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;boot.debug1mounts&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;boot.trace&lt;&#x2F;code&gt; (I almost kept this on until the very end. &lt;small&gt;May slow down the boot process slightly though&lt;&#x2F;small&gt;)&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;

&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;important&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Important&lt;&#x2F;p&gt;
	&lt;p&gt;&lt;strong&gt;serial console ignoring keystrokes?!&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Keep in mind that &lt;strong&gt;(if present)&lt;&#x2F;strong&gt; on s390&#x2F;s390x the native
console type is SCLP. Linux thus assigns the console a name
such as: &lt;code&gt;&#x2F;dev&#x2F;ttysclp0&lt;&#x2F;code&gt; &lt;strong&gt;(in my case as the first serial console)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;As of the way the NixOS’s init scripts are designed you can only configure one
terminal interface to function in a bidirectional fashion. This is the first terminal
specified over the kernel commandline. If left unspecified &lt;strong&gt;(in qemu but maybe also
in other places)&lt;&#x2F;strong&gt; the console chosen may not actually be exposed to you
in a way where you can actual issue any inputs. Which makes dropping a shell
impossible.&lt;&#x2F;p&gt;
&lt;p&gt;When systemd takes over later on into the bootprocess and launches
actual services to set up the various consoles for the second time it shouldn’t matter. But
if for any reason you require a functional console earlier on. Be it to
provide your disk unlocking mechanism or to provide you with
a functional debug+rescue shell environment. You have to set this correctly
or you simply won’t be able to interface with your host&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO mention that -cdrom isn’t actually scsi or whatever but virtio
and the implications of that in terms of cdrom boot not working
https:&#x2F;&#x2F;www.ibm.com&#x2F;docs&#x2F;en&#x2F;linux-on-systems?topic=virtio-ccw-device-specifications
essentially SCSI Host Bus Adapter (virtio-scsi) and Block (virtio-block) aint the same&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO terminal abstract of this actually sort of working&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;booting-alpine-linux&quot;&gt;booting Alpine Linux ?!&lt;&#x2F;h3&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;wasn’t this an article about NixOS why would one talk about alpine linux now?!&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;While my build would actually come up &lt;strong&gt;“when directly booting into the kernel&#x2F;initrd”&lt;&#x2F;strong&gt; . There
were still some things that would not work. (most importantly networking).&lt;&#x2F;p&gt;
&lt;p&gt;As alpine was tested to at least run in qemu
I settled with attempting to actually boot
something thats known to work as well. Having a working setup to use as a reference
or just to query certain hardware information proved quite useful. Also quite a few tools are pre-packaged
so I’d not have to bother as much fixing NixOS package builds(drv’s) before I got a host natively running NixOS&lt;&#x2F;p&gt;
&lt;p&gt;Alpine linux ended up being my distro of choice as it provided
the most straightforward way to boot into a linux system
by just offering kernel&#x2F;initrd&#x2F;etc images at:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.19&#x2F;releases&#x2F;s390x&#x2F;netboot&#x2F;&quot;&gt;https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.19&#x2F;releases&#x2F;s390x&#x2F;netboot&#x2F;&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Having direct access to the files making up the kernel + initrd does not only mean
I can run this in qemu. But also that I could make use of kexec later on like on the Z15.&lt;&#x2F;p&gt;
&lt;p&gt;Which is quite neat as opposed to
having to bake an .iso image or such things which tends to involve much more things
that can go wrong. &lt;small&gt;(Sometimes netboot is an option as well but I didn’t look into that)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Thus after downloading the files in question from there one could attempt something like:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;qemu-system-s390x&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;M&lt;&#x2F;span&gt; s390-ccw-virtio &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;        -&lt;&#x2F;span&gt;m&lt;&#x2F;span&gt; 2048&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;smp&lt;&#x2F;span&gt; 4&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;nographic&lt;&#x2F;span&gt;  &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;        -&lt;&#x2F;span&gt;net&lt;&#x2F;span&gt; nic&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;net&lt;&#x2F;span&gt; user &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;        -&lt;&#x2F;span&gt;kernel&lt;&#x2F;span&gt; vmlinuz-lts  &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;        -&lt;&#x2F;span&gt;initrd&lt;&#x2F;span&gt; initramfs-lts &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;        -&lt;&#x2F;span&gt;append&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;ip=dhcp alpine_repo=https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.19&#x2F;main modloop=https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.19&#x2F;releases&#x2F;s390x&#x2F;netboot&#x2F;modloop-lts&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;important&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Important&lt;&#x2F;p&gt;
	&lt;p&gt;(make sure that the files provided via the “-kernel” and “-initrd” flags match the version
of whats specified  via alpine_repo AND modloop!&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;this relies on a properly working WAN internet connection (including dns ofc).
It also takes quite a while when using emulation (instead of kvm accel) and most
importantly if emulation is VEEERY slow or if your network is unstable this may fail
and drop you off into an emergency shell.&lt;&#x2F;p&gt;
&lt;p&gt;Definitively suboptimal but as long as you
are aware of these things it shouldn’t be a huge issue. If you get errors suggesting some remote
resources can’t be found (&lt;strong&gt;TODO example&lt;&#x2F;strong&gt;) you may have a version mismatch.
&lt;mark&gt; Please make sure all the files come from the same release.
You can also use the emergency shell to debug the network configuration if you suspect something
is off. &lt;&#x2F;mark&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;After running the command above pretty much instantly im presented with
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;ASLR disabled: CPU has no PRNG
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;KASLR disabled: CPU has no PRNG
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[    0.539393] Linux version 6.6.32-0-lts (buildozer@build-edge-s390x) (gcc (Alpine 13.2.1_git20240309) 13.2.1 20240309, GNU ld (GNU Binutils) 2.42) #1-Alpine SMP Fri, 24 May 2024 08:38:05 +0000
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[    0.541762] setup: Linux is running under KVM in 64-bit mode
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;

indicating that its about to boot, further down I saw:&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Mounting boot media: [   13.341232] Mounting boot media: ok.
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;ok.
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[   13.604847] Obtaining IP via DHCP (eth0)...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Obtaining IP via DHCP (eth0): udhcpc: started, v1.36.1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[   13.900690] NET: Registered PF_PACKET protocol family
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;udhcpc: broadcasting discover
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;udhcpc: broadcasting select for 10.0.2.15, server 10.0.2.2
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;udhcpc: lease of 10.0.2.15 obtained from 10.0.2.2, lease time 86400
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[   14.903964] Obtaining IP via DHCP (eth0): ok.
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;ok.
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[   16.258689] Installing packages to root filesystem...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Installing packages to root filesystem: fetch https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.19&#x2F;main&#x2F;s390x&#x2F;APKINDEX.tar.gz
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;(1&#x2F;26) Installing alpine-baselayout-data (3.4.3-r2)
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;and then finally&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; OpenRC 0.52.1 is starting up Linux 6.6.32-0-lts (s390x)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * &#x2F;proc is already mounted
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Mounting &#x2F;run ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * &#x2F;run&#x2F;openrc: creating directory
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * &#x2F;run&#x2F;lock: creating directory
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * &#x2F;run&#x2F;lock: correcting owner
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Caching service dependencies ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Remounting devtmpfs on &#x2F;dev ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Mounting &#x2F;dev&#x2F;mqueue ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Connecting to dl-cdn.alpinelinux.org (151.101.130.132:443)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;saving to &amp;#39;&#x2F;lib&#x2F;modloop-lts&amp;#39;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;modloop-lts          100% |********************************| 17.5M  0:00:00 ETA
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;&amp;#39;&#x2F;lib&#x2F;modloop-lts&amp;#39; saved
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Mounting modloop &#x2F;lib&#x2F;modloop-lts ... * Verifying modloop
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Failed to verify signature of !
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Mounting security filesystem ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Mounting debug filesystem ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Starting busybox mdev ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Scanning hardware for mdev ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Loading hardware drivers ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Loading modules ...modprobe: can&amp;#39;t change directory to &amp;#39;6.6.32-0-lts&amp;#39;: No such file or directory
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;modprobe: can&amp;#39;t change directory to &amp;#39;6.6.32-0-lts&amp;#39;: No such file or directory
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Not setting clock for s390 system
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Checking local filesystems  ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Remounting filesystems ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Mounting local filesystems ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Configuring kernel parameters ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Migrating &#x2F;var&#x2F;lock to &#x2F;run&#x2F;lock ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Creating user login records ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Cleaning &#x2F;tmp directory ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Setting hostname ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Starting busybox syslog ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Starting firstboot ... [ ok ]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Welcome to Alpine Linux 3.19
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;Kernel 6.6.32-0-lts on an s390x (&#x2F;dev&#x2F;ttysclp0)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;localhost login:
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;&lt;strong&gt;TODO there seems to be a can’t change directory issue here … fix it&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;tip&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Tip&lt;&#x2F;p&gt;
	&lt;p&gt;logging in as root requires no password and drops a shell&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;While emulated now we at least have some solid ground under our feet to
test our initrd or pretty much all software on. I extensively made use of this
to test out things before I could get them to run on real hardware from executables
to kexec-ing into other things to just checking network connectivity. &lt;small&gt;(of course packages
can be installed via &lt;code&gt;apk add&lt;&#x2F;code&gt; as for example kexec is not present by default)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;Please keep in mind that the virtio hardware thats being emulated
is &lt;strong&gt;quite different&lt;&#x2F;strong&gt; from what you may find when trying to pull of any of these things
on an actual s390x host. Interface names may be different, the drivers used are most
definitively different and as you will see later setting up disk&#x2F;network appears to be
much more involved than loading the kernel module …&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO explain how I tested nix before testing NixOS by essentially putting &#x2F;nix into the alpine and starting the daemon manually …&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h2 id=&quot;booting-nixos-ibm-z15&quot;&gt;booting NixOS (IBM Z15)&lt;&#x2F;h2&gt;
&lt;p&gt;By the point everything seemed fine in qemu. I decided to run it natively
on the Z15 I mentioned earlier. The initial idea was quite simple:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO compare this with the actual command this is simplified&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO make sure to mention that no root disk is needed
in this case as it uses a modified version of Mic92s kexec thingy&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;kexec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; .&#x2F;bl0v3s-s390x-nixos-kernel &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    --&lt;&#x2F;span&gt;initrd&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;.&#x2F;bl0v3s-s390x-nixos-initrd &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    -&lt;&#x2F;span&gt;append&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;ip=dhcp&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;l&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;kexec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;e &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; to execute the loaded os&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;running the command above or any kexec call won’t give you
any feedback unless it fails before jumping to the new
kernel. This means that until whatever you booted manages
to notify you in some way &lt;small&gt;like trough the serial console
which isn’t present in my case …&lt;&#x2F;small&gt; you have no
way of knowing if its still loading. Crashed or came up
but failed to notify you &lt;small&gt;(for example if you rely on
ssh&#x2F;icmp like I do)&lt;&#x2F;small&gt;. Turning you essentially blind&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;Well, while this is specific to the network environment IBM uses on the
machine given to me. There already is an issue: &lt;code&gt;ip=dhcp&lt;&#x2F;code&gt; won’t cut it
because they actually don’t offer dhcp. &lt;mark&gt;which is perfect fine as
under normal conditions you’d never have or rather want to interface
with the network in that way but just sort of let them administer the
system for you&lt;&#x2F;mark&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO show how I modified stage 1 to drop me an ssh shell (if it would have worked)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Which meant changing the append parameter found in the kexec call above to something like:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;--append=&quot;ip=148.100.85.113::148.100.84.1:255.255.254.0:nixos:eth0::9.9.9.9:8.8.8.8&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;with:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;148.100.85.113&lt;&#x2F;code&gt; being the ip statically assigned to eth0&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;148.100.84.1&lt;&#x2F;code&gt; being the gateway&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;255.255.254.0&lt;&#x2F;code&gt; being the subnetmask (a &lt;code&gt;&#x2F;23&lt;&#x2F;code&gt; essentially)&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;nixos&lt;&#x2F;code&gt; being the hostname&lt;&#x2F;li&gt;
&lt;li&gt;&lt;code&gt;eth0&lt;&#x2F;code&gt; being the target interface to assign these values to&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;9.9.9.9&lt;&#x2F;code&gt; and &lt;code&gt;8.8.8.8&lt;&#x2F;code&gt; are dns servers run by cloud9 and google as fallback.
&lt;small&gt; &lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;(not too relevant for our nix host but running alpine like described above would
actually require this when resolving domains as it sort of is a “minimal netboot” image)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;For reference here is the network configuration (excluding v6) directly
taken from the Z15 when it was running something that offered me a shell:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; show the ip address configuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;ip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; a show eth0&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; show the routes (focus on &amp;quot;default&amp;quot;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;ip&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; r&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;2: eth0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc mq state UP group default qlen 1000
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    link&#x2F;ether 02:02:12:f4:34:1a brd ff:ff:ff:ff:ff:ff
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    inet 148.100.85.113&#x2F;23 scope global eth0
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;       valid_lft forever preferred_lft forever
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;and for the route&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;default via 148.100.84.1 dev eth0 proto static
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;seems correct. Especially with the initrd userland using 64bit ifconfig
should be able to make sense out of the kernel commandline, right? Well actually &lt;strong&gt;it does&lt;&#x2F;strong&gt;
only issue is that &lt;mark&gt;&lt;strong&gt;it really aint that simple&lt;&#x2F;strong&gt;&lt;&#x2F;mark&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO add how I confirmed that networking this stuff worked in qemu and even initrd sshd stage1&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO mention how and why I turned off predictable interface foo&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;important&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Important&lt;&#x2F;p&gt;
	&lt;p&gt;&lt;strong&gt;TODO explain &lt;a href=&quot;https:&#x2F;&#x2F;www.ibm.com&#x2F;docs&#x2F;en&#x2F;linux-on-systems?topic=resources-persistent-configuration&quot;&gt;Persistent device configuration&lt;&#x2F;a&gt;.
And why this is a thing. And most importantly why this is not the sort of approach one
would want to use in NixOS (declarative distros). As it heavily relies on udev
and rebuilding the initrd to contain the “persistent” effectively udev rule changes&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;So at this point in time my assumption was that it probably is lacking drivers.&lt;&#x2F;p&gt;
&lt;p&gt;A quick way to check without using any
specialized commands that may not be present is going
via sysfs. So in this case with our interface being named &lt;code&gt;eth0&lt;&#x2F;code&gt;
running:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;ls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;l&lt;&#x2F;span&gt; &#x2F;sys&#x2F;class&#x2F;net&#x2F;eth0&#x2F;device&#x2F;driver&#x2F;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;reveals:&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;lrwxrwxrwx 1 root root    0 Feb  3 01:18 0.0.1000 -&amp;gt; ..&#x2F;..&#x2F;..&#x2F;..&#x2F;devices&#x2F;qeth&#x2F;0.0.1000
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;--w------- 1 root root 4096 Feb  3 01:20 bind
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;--w------- 1 root root 4096 Nov 10 12:04 group
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;lrwxrwxrwx 1 root root    0 Feb  3 01:20 module -&amp;gt; ..&#x2F;..&#x2F;..&#x2F;..&#x2F;module&#x2F;qeth
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;--w------- 1 root root 4096 Feb  3 01:20 uevent
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;--w------- 1 root root 4096 Feb  3 01:20 unbind
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;...
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;so &lt;code&gt;module -&amp;gt; ..&#x2F;..&#x2F;..&#x2F;..&#x2F;module&#x2F;qeth&lt;&#x2F;code&gt; is suggesting the &lt;code&gt;qeth&lt;&#x2F;code&gt; driver is responsible
for this interface. Now looking at &lt;code&gt;lsmod | grep qe&lt;&#x2F;code&gt; shows:&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;qeth_l3                65536  0
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;qeth_l2                57344  1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;bridge                348160  1 qeth_l2
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;qeth                  163840  2 qeth_l3,qeth_l2
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;qdio                   61440  2 qeth,qeth_l3
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;ccwgroup               20480  1 qeth
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;...
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;&lt;strong&gt;TODO provide an more elegant way how one would have come
to the conclusion thaht qeth_l2 is needed instead of seeing
it and just loading it&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO qeth_l3 isn’t needed right. I forgot sort of need to test via kexec&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;The only thing that caught my attention was &lt;code&gt;qeth_l2&lt;&#x2F;code&gt; and &lt;code&gt;qeth_l3&lt;&#x2F;code&gt; which both depend on &lt;code&gt;qeth&lt;&#x2F;code&gt;.
But there also is &lt;code&gt;ccwgroup&lt;&#x2F;code&gt; which I have never heard of but &lt;strong&gt;made the fatal flaw of believing
I won’t need this …&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Well I tried and tried but it just wouldn’t work. At one point loading pretty
much any module there is.
&lt;mark&gt;
Always keep the previously described
restrictions of actually not having a serial
console in mind
&lt;&#x2F;mark&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;running-alpine-z15&quot;&gt;running alpine (Z15)&lt;&#x2F;h3&gt;
&lt;p&gt;Maybe alpine linux would load the proper modules or do things
I don’t know about yet. So why not give alpine a shot again then:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO test V&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; TODO test this actually please&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;kexec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; vmlinuz-lts  &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;        -&lt;&#x2F;span&gt;initrd&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;initramfs-lts &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;        --&lt;&#x2F;span&gt;cmdline&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;ip=148.100.85.113::148.100.84.1:255.255.254.0:nixos:eth0::9.9.9.9:8.8.8.8 alpine_repo=https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.19&#x2F;main modloop=https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;v3.19&#x2F;releases&#x2F;s390x&#x2F;netboot&#x2F;modloop-lts&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h4 id=&quot;what-if-i-kexec-d-whats-already-running&quot;&gt;what if I kexec’d whats already running?!&lt;&#x2F;h4&gt;
&lt;p&gt;It wasn’t long until I suspected that kexec simply
doesn’t work. While s390x &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;torvalds&#x2F;linux&#x2F;blob&#x2F;2014c95afecee3e76ca4a56956a936e23283f05b&#x2F;arch&#x2F;s390&#x2F;Kconfig#L283&quot;&gt;has kexec support&lt;&#x2F;a&gt; maybe the hardware
or maybe rather hardware configuration somehow prevents it. You never know
its a mainframe after all. Only one way to find out:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO show abstracts of the original zipl config from IBMs default OS choices&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;So assuming these details are correct lets just call &lt;code&gt;kexec&lt;&#x2F;code&gt; in the same way
the pre-installed zipl installation called kernel+initrd+cmdline:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;kexec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; .&#x2F;TODO show the command&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;as I was anxiously awaiting an icmp reply after running the previous command
made it stop replying to pings for obvious reasons &lt;br&gt;…&lt;br&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;mark&gt;&lt;strong&gt;Its up!&lt;&#x2F;strong&gt; and responding to icmp!!&lt;&#x2F;mark&gt;
&lt;small&gt;(followed by
a weirdly long period of silence that got me slightly worried but
eventually it was allowing me to log in via ssh)
&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Ok so its safe to say that my fear of &lt;strong&gt;kexec NOT working&lt;&#x2F;strong&gt; was &lt;strong&gt;proven wrong&lt;&#x2F;strong&gt;,
great!&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;In such a situation it may be smart to append a tiny exta line to your
cmdline to make sure your machine actually booted trough kexec instead of
somehow having just rebooted which in this case would have had the same result
but appending a tiny piece to the cmdline allows us to check &lt;code&gt;&#x2F;proc&#x2F;cmdline&lt;&#x2F;code&gt;
and compare it to the default invoked by a reboot&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;So what could be making not just my initrd but also alpine fail? In alpines
case I can’t even argue that a driver may be missing as I’d be rather sure
that they thought of that. Its most definitely should be possible to run this
places other than just qemu I figured.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;alpines-s390x-net-option&quot;&gt;alpines &lt;code&gt;s390x_net=&lt;&#x2F;code&gt; option&lt;&#x2F;h3&gt;
&lt;p&gt;I ended up asking IBM but before they got a chance to reply, a friend pointed
out to me that there is a kernel cmdline option called &lt;code&gt;s390x_net=&lt;&#x2F;code&gt;. I never heard of
this option though. So I started digging. Since I couldn’t find it listed in any
official kernel resources &lt;a href=&quot;https:&#x2F;&#x2F;www.kernel.org&#x2F;doc&#x2F;html&#x2F;latest&#x2F;admin-guide&#x2F;kernel-parameters.html&quot;&gt;documenting the kernel parameters&lt;&#x2F;a&gt;
the only option left would be that the init takes care of it.&lt;&#x2F;p&gt;
&lt;p&gt;As previously pointed out &lt;code&gt;&#x2F;sys&#x2F;class&#x2F;net&#x2F;eth0&#x2F;device&lt;&#x2F;code&gt; in my case linked to &lt;code&gt;0.0.1000&lt;&#x2F;code&gt;
like we can see here:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;lrwxrwxrwx 1 root root    0 Feb  3 01:19 device -&amp;gt; ..&#x2F;..&#x2F;..&#x2F;0.0.1000&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;and running &lt;code&gt;ls -la &#x2F;sys&#x2F;devices&#x2F;qeth&lt;&#x2F;code&gt; reveals:&lt;&#x2F;p&gt;
&lt;div class=&quot;crt scanlines&quot; aria-hidden=&quot;true&quot;&gt;
	&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;drwxr-xr-x  3 root root    0 Feb  3 17:05 .
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;drwxr-xr-x 14 root root    0 Nov 10 12:04 ..
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;drwxr-xr-x  5 root root    0 Jan 14 13:02 0.0.1000
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;lrwxrwxrwx  1 root root    0 Feb  3 17:05 module -&amp;gt; ..&#x2F;..&#x2F;module&#x2F;qeth
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;-rw-r--r--  1 root root 4096 Feb  3 17:05 uevent
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;

&lt;&#x2F;div&gt;
&lt;p&gt;it made sense to assume this should be set to &lt;code&gt;0.0.1000&lt;&#x2F;code&gt;. So I gave it a shot setting
&lt;code&gt;s390x_net=0.0.1000&lt;&#x2F;code&gt; but nope. Googling the option dind’t really seem to help and
I don’t know of many alpine linux resources for s390x.&lt;&#x2F;p&gt;
&lt;p&gt;By now I realized that its probably not the best idea to continue digging here if I don’t even
know if NixOS or alpine actually boot. As in that case even if I set the correct option here
but some other part of the boot process would fail. I’d not even be able to tell &lt;small&gt;(as
pointed out earlier) serial isn’t an option in this specific case&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO point out that for qeth its always 3 id’s VV&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;read&lt;&#x2F;li&gt;
&lt;li&gt;write&lt;&#x2F;li&gt;
&lt;li&gt;data bus ID of your virtual network card&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h3 id=&quot;unconventional-logging-methods&quot;&gt;unconventional logging methods&lt;&#x2F;h3&gt;
&lt;p&gt;I’d need some way of knowing the state the system is in post kexec. With network&#x2F;serial
based methods being out of the question, one of the things that remained was the disk.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;dasd-direct-access-storage-devices&quot;&gt;dasd - (Direct Access Storage Devices)&lt;&#x2F;h4&gt;
&lt;p&gt;&lt;strong&gt;TODO reformat and remove the &amp;gt;&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote&gt;
&lt;p&gt;While configuring storage in my case (dasd)(&lt;strong&gt;TODO explain it a lil and link&lt;&#x2F;strong&gt;)
was still a little simpler than just loading the right modules and having a &lt;code&gt;&#x2F;dev&lt;&#x2F;code&gt; node
for the blockdevice show up. It had one advantage over &lt;code&gt;s390x_net=&lt;&#x2F;code&gt; which is that
the &lt;code&gt;dasd&lt;&#x2F;code&gt; kernel commandline parameter is much more common to encounter.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;p&gt;For example the &lt;a href=&quot;https:&#x2F;&#x2F;wiki.gentoo.org&#x2F;wiki&#x2F;S390&#x2F;Install&quot;&gt;gentoo S390 install guide&lt;&#x2F;a&gt;
provides a sample zipl configuration &lt;code&gt;&#x2F;etc&#x2F;zipl.conf&lt;&#x2F;code&gt;:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[defaultboot]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;defaultmenu = menu
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;[Gentoo]
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    image = &#x2F;boot&#x2F;image
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    target = &#x2F;boot&#x2F;zipl
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    parameters = &amp;quot;dasd=0150 root=&#x2F;dev&#x2F;dasda1 rootfstype=ext4 TERM=dumb net.ifnames=0&amp;quot;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;:menu
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    default = 1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    prompt = 1
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    target = &#x2F;boot&#x2F;zipl
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    timeout = 10
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    1 = Gentoo
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;with &lt;code&gt;dasd=0150&lt;&#x2F;code&gt; being what I’m after. Of course this wouldn’t be &lt;code&gt;0150&lt;&#x2F;code&gt; but looking in
&lt;code&gt;&#x2F;sys&#x2F;class&#x2F;block&#x2F;dasda&#x2F;device -&amp;gt; ..&#x2F;..&#x2F;..&#x2F;0.0.0100&lt;&#x2F;code&gt; suggestes giving &lt;code&gt;0.0.0100&lt;&#x2F;code&gt; a shot.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;In the hardware configurations encountered in this article
both &lt;code&gt;0.0.0100&lt;&#x2F;code&gt; and &lt;code&gt;0.0.1000&lt;&#x2F;code&gt; are brought up.
Make sure to not confuse them by accident&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;(yes this happened to me)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;So lets get our kexec’s &lt;code&gt;--append&lt;&#x2F;code&gt;’s (kernel commandline) statement to include &lt;code&gt;dasd=0.0.0100&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;kexec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;l&lt;&#x2F;span&gt; .&#x2F;bl0v3s-s390x-nixos-kernel &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    --&lt;&#x2F;span&gt;initrd&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;.&#x2F;bl0v3s-s390x-nixos-initrd &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;    -&lt;&#x2F;span&gt;append&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;dasd=0.0.0100&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;I left out the network configuration because it didn’t work for now either way and
I wanted to reduce the amount of things that could somehow affect the boot process
(&lt;small&gt;not just slowing it down&lt;&#x2F;small&gt;) . But it probably would have been fine to leave
it there its simply good practice.&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;blockquote class=&quot;tip&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Tip&lt;&#x2F;p&gt;
	&lt;p&gt;Unlike &lt;code&gt;s390x_net=&lt;&#x2F;code&gt; the &lt;code&gt;dasd=&lt;&#x2F;code&gt; kernel commandline option is actually handled by the kernel.
Thus you can make the kernel online it without the initrd&#x2F;initramfs being involved yet&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO factcheck this once more (memory sucks)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;in the linux kernel source tree &lt;code&gt;&#x2F;drivers&#x2F;s390&#x2F;block&#x2F;dasd.c&lt;&#x2F;code&gt; &lt;strong&gt;TODO permalink&lt;&#x2F;strong&gt; we can
see a notice regarding the &lt;code&gt;dasd=&lt;&#x2F;code&gt; kernel commandline parameter:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;C&quot; class=&quot;language-C z-code&quot;&gt;&lt;code class=&quot;language-C&quot; data-lang=&quot;C&quot;&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt; &lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;*&lt;&#x2F;span&gt; Initial attempt at a probe function. this can be simplified once
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt; &lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;*&lt;&#x2F;span&gt; the other detection code is gone.
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt; &lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-storage z-type z-c&quot;&gt;int&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-entity z-name z-function z-c&quot;&gt;dasd_generic_probe&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function z-parameters z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function z-parameters z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-storage z-type z-c&quot;&gt;struct&lt;&#x2F;span&gt; ccw_device &lt;span class=&quot;z-keyword z-operator z-c&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-c&quot;&gt;cdev&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-block z-begin z-c&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;	cdev&lt;span class=&quot;z-punctuation z-accessor z-c&quot;&gt;-&amp;gt;&lt;&#x2F;span&gt;handler &lt;span class=&quot;z-keyword z-operator z-assignment z-c&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-c&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;dasd_int_handler&lt;span class=&quot;z-punctuation z-terminator z-c&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;	&lt;span class=&quot;z-comment z-block z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;&#x2F;*&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt;	 &lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;*&lt;&#x2F;span&gt; Automatically online either all dasd devices (dasd_autodetect)
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt;	 &lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;*&lt;&#x2F;span&gt; or all devices specified with dasd= parameters during
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt;	 &lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;*&lt;&#x2F;span&gt; initial probe.
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;span class=&quot;z-comment z-block z-c&quot;&gt;	 &lt;span class=&quot;z-punctuation z-definition z-comment z-c&quot;&gt;*&#x2F;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;	&lt;span class=&quot;z-keyword z-control z-c&quot;&gt;if&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-variable z-function z-c&quot;&gt;dasd_get_feature&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;cdev&lt;span class=&quot;z-punctuation z-separator z-c&quot;&gt;,&lt;&#x2F;span&gt; DASD_FEATURE_INITIAL_ONLINE&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-comparison z-c&quot;&gt;&amp;gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-constant z-numeric z-integer z-decimal z-c&quot;&gt;0&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-arithmetic z-c&quot;&gt;||&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;	    &lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;dasd_autodetect &lt;span class=&quot;z-keyword z-operator z-arithmetic z-c&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-variable z-function z-c&quot;&gt;dasd_busid_known&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-variable z-function z-c&quot;&gt;dev_name&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-keyword z-operator z-c&quot;&gt;&amp;amp;&lt;&#x2F;span&gt;cdev&lt;span class=&quot;z-punctuation z-accessor z-c&quot;&gt;-&amp;gt;&lt;&#x2F;span&gt;dev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-comparison z-c&quot;&gt;!=&lt;&#x2F;span&gt; &lt;span class=&quot;z-constant z-numeric z-integer z-decimal z-c&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;		&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-variable z-function z-c&quot;&gt;async_schedule&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-begin z-c&quot;&gt;(&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;dasd_generic_auto_online&lt;span class=&quot;z-punctuation z-separator z-c&quot;&gt;,&lt;&#x2F;span&gt; cdev&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-c&quot;&gt;&lt;span class=&quot;z-meta z-group z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-group z-end z-c&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-c&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;	&lt;span class=&quot;z-keyword z-control z-flow z-return z-c&quot;&gt;return&lt;&#x2F;span&gt; &lt;span class=&quot;z-constant z-numeric z-integer z-decimal z-c&quot;&gt;0&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-c&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-c&quot;&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function z-c&quot;&gt;&lt;span class=&quot;z-meta z-block z-c&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-block z-end z-c&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote class=&quot;important&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Important&lt;&#x2F;p&gt;
	&lt;p&gt;&lt;strong&gt;TODO explain autodetect and ccw and whatever to point out that you
have to use dasd= (or udev effectively trough chzdev from s390-tools
or what it was again)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;(&lt;strong&gt;TODO figure out how the autodetect works and maybe explain it&lt;&#x2F;strong&gt;)
&lt;strong&gt;online all devices“&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&#x2F;sys&#x2F;bus&#x2F;ccw&#x2F;drivers&#x2F; &lt;a href=&quot;https:&#x2F;&#x2F;docs.redhat.com&#x2F;en&#x2F;documentation&#x2F;red_hat_enterprise_linux&#x2F;7&#x2F;html&#x2F;installation_guide&#x2F;chap-post-installation-configuration-s390#sect-post-installation-adding-dasds-s390&quot;&gt;this page&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO point out how I initially onlined it using echo 1&amp;gt; …. &#x2F;online in my initrd init script&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO show how I modified my initrd to mount the dasd and first write hello world and later on some state.
Mention why I first checked if the dasd works before instantly dumping network crap&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Well remember alpines &lt;code&gt;s390x_net=&lt;&#x2F;code&gt; that I didn’t want to play around with until I
found some (admittedly crude!) way of getting some form of log output. Now that retriving the logs
works I guess a sane question would be:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;q&gt;“why don’t you just look at the code?”&lt;small&gt;(its probably going to take less time than finding a resource explaining this)&lt;&#x2F;small&gt;&lt;&#x2F;q&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO use permalinks&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;so looking into how alpine creates their intiramfs’s I came to the conclusion that
&lt;a href=&quot;https:&#x2F;&#x2F;gitlab.alpinelinux.org&#x2F;alpine&#x2F;mkinitfs&quot;&gt;alpines mkinitfs repo&lt;&#x2F;a&gt; would be the place to look.&lt;&#x2F;p&gt;
&lt;p&gt;The &lt;a href=&quot;https:&#x2F;&#x2F;gitlab.alpinelinux.org&#x2F;alpine&#x2F;mkinitfs&#x2F;-&#x2F;blob&#x2F;master&#x2F;initramfs-init.in&quot;&gt;initramfs-init.in&lt;&#x2F;a&gt; file contains what I was
looking for. At &lt;a href=&quot;https:&#x2F;&#x2F;gitlab.alpinelinux.org&#x2F;alpine&#x2F;mkinitfs&#x2F;-&#x2F;blob&#x2F;master&#x2F;initramfs-init.in#L471&quot;&gt;line 471&lt;&#x2F;a&gt; the &lt;code&gt;myopts=&lt;&#x2F;code&gt;
variable is being introduced. Containing various options some commonly known like
&lt;code&gt;ip&lt;&#x2F;code&gt; &lt;small&gt;(remember the &lt;code&gt;ip=&lt;&#x2F;code&gt; statement)&lt;&#x2F;small&gt;.  Other than that for example &lt;code&gt;ssh_key&lt;&#x2F;code&gt; one can use to make for example the netboot images
we used earlier retrive that from a remote resource so we don’t have to bake our own kernels&#x2F;initrd’s. &lt;mark&gt;Line 530 to 536&lt;&#x2F;mark&gt;
would then make sense of &lt;code&gt;myopts&lt;&#x2F;code&gt; by effectively doing the following:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO explain that its breaking these down and assigning this to the KOPT shell variables&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-keyword z-control z-loop z-for z-shell&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt; i &lt;span class=&quot;z-keyword z-control z-in z-shell&quot;&gt;in&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;myopts&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-logical z-continue z-shell&quot;&gt;;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-control z-loop z-do z-shell&quot;&gt;do&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;	&lt;span class=&quot;z-meta z-conditional z-case z-shell&quot;&gt;&lt;span class=&quot;z-keyword z-control z-conditional z-case z-shell&quot;&gt;case&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;opt&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-control z-in z-shell&quot;&gt;in&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-conditional z-case z-shell&quot;&gt;	&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;=&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-shell&quot;&gt;&lt;span class=&quot;z-keyword z-control z-conditional z-patterns z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-commands z-shell&quot;&gt;	&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-eval z-shell&quot;&gt;eval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;KOPT_&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;=&lt;span class=&quot;z-string z-quoted z-single z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;${opt#*=}&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-commands z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-terminator z-case z-clause z-shell&quot;&gt;;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;	&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;&lt;span class=&quot;z-keyword z-control z-conditional z-patterns z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-commands z-shell&quot;&gt;	&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-eval z-shell&quot;&gt;eval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;KOPT_&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;=yes&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-commands z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-terminator z-case z-clause z-shell&quot;&gt;;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;	&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;no&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;&lt;span class=&quot;z-keyword z-control z-conditional z-patterns z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-commands z-shell&quot;&gt;	&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-eval z-shell&quot;&gt;eval&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;KOPT_&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;i&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;=no&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-commands z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-terminator z-case z-clause z-shell&quot;&gt;;;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-conditional z-case z-clause z-patterns z-shell&quot;&gt;	&lt;span class=&quot;z-keyword z-control z-conditional z-end z-shell&quot;&gt;esac&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-keyword z-control z-loop z-end z-shell&quot;&gt;done&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Further down starting &lt;a href=&quot;https:&#x2F;&#x2F;gitlab.alpinelinux.org&#x2F;alpine&#x2F;mkinitfs&#x2F;-&#x2F;blob&#x2F;master&#x2F;initramfs-init.in#L607&quot;&gt;at line 607&lt;&#x2F;a&gt;
we can see the following:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;bash&quot; class=&quot;language-bash z-code&quot;&gt;&lt;code class=&quot;language-bash&quot; data-lang=&quot;bash&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-keyword z-control z-conditional z-if z-shell&quot;&gt;if&lt;&#x2F;span&gt; &lt;span class=&quot;z-support z-function z-test z-begin z-shell&quot;&gt;[&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;KOPT_s390x_net&lt;span class=&quot;z-keyword z-operator z-expansion z-shell&quot;&gt;%%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;,&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-logical z-shell&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;qeth_l2&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-support z-function z-test z-end z-shell&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-logical z-continue z-shell&quot;&gt;;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-control z-conditional z-then z-shell&quot;&gt;then&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;	&lt;span class=&quot;z-keyword z-control z-loop z-for z-shell&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt; mod &lt;span class=&quot;z-keyword z-control z-in z-shell&quot;&gt;in&lt;&#x2F;span&gt; qeth qeth_l2 qeth_l3&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-logical z-continue z-shell&quot;&gt;;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-control z-loop z-do z-shell&quot;&gt;do&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;		&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;MOCK&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; modprobe &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;mod&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;	&lt;span class=&quot;z-keyword z-control z-loop z-end z-shell&quot;&gt;done&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;	&lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;_channel&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-unquoted z-shell&quot;&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-begin z-shell&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-echo z-shell&quot;&gt;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;KOPT_s390x_net&lt;span class=&quot;z-keyword z-operator z-expansion z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-logical z-pipe z-shell&quot;&gt;|&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;tr&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-keyword z-control z-regexp z-set z-begin z-shell&quot;&gt;[&lt;&#x2F;span&gt;A&lt;span class=&quot;z-keyword z-operator z-word z-shell&quot;&gt;-&lt;&#x2F;span&gt;Z&lt;span class=&quot;z-keyword z-control z-regexp z-set z-end z-shell&quot;&gt;]&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-control z-regexp z-set z-begin z-shell&quot;&gt;[&lt;&#x2F;span&gt;a&lt;span class=&quot;z-keyword z-operator z-word z-shell&quot;&gt;-&lt;&#x2F;span&gt;z&lt;span class=&quot;z-keyword z-control z-regexp z-set z-end z-shell&quot;&gt;]&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;	&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-echo z-shell&quot;&gt;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;_channel&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&lt;&#x2F;span&gt; &#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;group&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;	&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-echo z-shell&quot;&gt;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; 1 &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&lt;&#x2F;span&gt; &#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;_channel&lt;span class=&quot;z-keyword z-operator z-expansion z-shell&quot;&gt;%%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;,&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;layer2&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;	&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-echo z-shell&quot;&gt;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; 1 &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&lt;&#x2F;span&gt; &#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;_channel&lt;span class=&quot;z-keyword z-operator z-expansion z-shell&quot;&gt;%%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;,&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;online&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-keyword z-control z-conditional z-end z-shell&quot;&gt;fi&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So looking at this step by step
the first thing to take out of this is that
the condition defined by:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;&quot;${KOPT_s390x_net%%,*}&quot; = &quot;qeth_l2&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Has to be met in order to load the &lt;code&gt;qeth&lt;&#x2F;code&gt;, &lt;code&gt;qeth_l2&lt;&#x2F;code&gt;, &lt;code&gt;qeth_l3&lt;&#x2F;code&gt;
modules. This means that in alpine at least in any case we’d
have to specify &lt;code&gt;s390x_net=qeth_l2&lt;&#x2F;code&gt;. Before specifying any
ids like &lt;code&gt;0.0.1000&lt;&#x2F;code&gt;. Thus writing: &lt;code&gt;s390x_net=0.0.1000&lt;&#x2F;code&gt; can’t
actually have any effect, even if &lt;code&gt;qeth_l2&lt;&#x2F;code&gt; missing wouldn’t be the only issue.&lt;&#x2F;p&gt;
&lt;p&gt;the next line is:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO include kernel source code that made me discover it&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO I think when you echo anything other than 3 ids in there
this failed in the nixos initrd logs dumped to dasd but
confirm it&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;_channel=&quot;$(echo ${KOPT_s390x_net#*,} | tr [A-Z] [a-z])&quot;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;which is essentially being stripped from &lt;code&gt;qeth_l2&lt;&#x2F;code&gt; before
being written to the ccwgroup+qeth drivers sysfs path like&lt;&#x2F;p&gt;
&lt;p&gt;&lt;code&gt;echo &quot;$_channel&quot; &amp;gt; &#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;group&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Sadly you can’t cat this file to see what the distros provided
by IBM put in there. While the kernel doc actually gives clues
on what this driver is for, before I managed to come across that
a friend once again pointed out that I should give
&lt;code&gt;s390x_net=qeth_l2,0.0.1000,0.0.1001,0.0.1002&lt;&#x2F;code&gt; a try.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO &lt;a href=&quot;https:&#x2F;&#x2F;www.kernel.org&#x2F;doc&#x2F;html&#x2F;v5.5&#x2F;s390&#x2F;driver-model.html#ccwgroup-devices&quot;&gt;link this&lt;&#x2F;a&gt;
or maybe rater this https:&#x2F;&#x2F;docs.kernel.org&#x2F;driver-api&#x2F;s390-drivers.html#the-ccwgroup-bus&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;So it turns out that unlike seen before with the &lt;code&gt;dasd=0.0.0100&lt;&#x2F;code&gt; driver option.
The qeth driver along other networking devices actually consists out of multiple (3x) ccw devices.
One for each channel:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;read&lt;&#x2F;li&gt;
&lt;li&gt;write&lt;&#x2F;li&gt;
&lt;li&gt;data&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;&lt;strong&gt;(^ TODO explain these more indepth)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;IDs are typically handed out in the pattern like seen above.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO show how youd obtain these using tools from s390-tools or
maybe sysfs&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Now after having placed a few values into &lt;code&gt;&#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;group&lt;&#x2F;code&gt;
to no success. &lt;code&gt;echo &quot;0.0.1000,0.0.1001,0.0.1002&quot; &amp;gt; &#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;group&lt;&#x2F;code&gt;
did finally work.&lt;&#x2F;p&gt;
&lt;p&gt;The last 2 lines left in alpines init are&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-echo z-shell&quot;&gt;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; 1 &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&lt;&#x2F;span&gt; &#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;_channel&lt;span class=&quot;z-keyword z-operator z-expansion z-shell&quot;&gt;%%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;,&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;layer2&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-echo z-shell&quot;&gt;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; 1 &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&lt;&#x2F;span&gt; &#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;drivers&#x2F;qeth&#x2F;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;_channel&lt;span class=&quot;z-keyword z-operator z-expansion z-shell&quot;&gt;%%&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;,&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&#x2F;online&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;which are pretty self explainatory if you keep in mind that
&lt;code&gt;&quot;${_channel%%,*}&quot;&lt;&#x2F;code&gt; is just gonna take the first bus id from the 3 ids
passd. Thus &lt;code&gt;0.0.1000,0.0.1001,0.0.1002&lt;&#x2F;code&gt; becomes &lt;code&gt;0.0.1000&lt;&#x2F;code&gt; and
the resulting path would be just &lt;code&gt;&#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;devices&#x2F;0.0.1000&#x2F;&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;&lt;code&gt;&#x2F;sys&#x2F;bus&#x2F;ccwgroup&#x2F;devices&#x2F;$ID&#x2F;&lt;&#x2F;code&gt; doesn’t exist unless you setup
the ccwgroup like explained before. The directory only appears if this
has been done previously. Also as the path only contains one ID in
our case the first one from the 3 setup via qeth’s ccwgroup you
can get the impression that there is just &lt;code&gt;0.0.1000&lt;&#x2F;code&gt; but actually
&lt;code&gt;0.0.1001&lt;&#x2F;code&gt; and &lt;code&gt;0.0.1002&lt;&#x2F;code&gt; are involved too.&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO also somewhere in here mention that given how on hercules
we didn’t have to do the ccwgroup stuff I belived it was fine
to just write one address but confirm this claim&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;The Z15 relies on qeth as determined earlier. If networking
was configured on hercules | z&#x2F;VM’s I think you will also end
up having to use qeth. &lt;strong&gt;TODO confirm if z&#x2F;VM only offers this&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TODO V strip paths, give credit and explain&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;kexec&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;l&lt;&#x2F;span&gt; &#x2F;home&#x2F;host&#x2F;TestAndDevel&#x2F;kexec390&#x2F;bzImage &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;--&lt;&#x2F;span&gt;initrd&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;&#x2F;home&#x2F;host&#x2F;TestAndDevel&#x2F;kexec390&#x2F;initramfs-lts &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;--&lt;&#x2F;span&gt;append&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-option z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;ip=192.168.10.106:none:192.168.10.1:255.255.255.0:alpikexec:eth0:none:1.1.1.1:8.8.8.8 alpine_repo=https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;edge&#x2F;main modloop=https:&#x2F;&#x2F;dl-cdn.alpinelinux.org&#x2F;alpine&#x2F;edge&#x2F;releases&#x2F;s390x&#x2F;netboot&#x2F;modloop-lts ssh_key=https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;cuzrawr&#x2F;kexec390&#x2F;refs&#x2F;heads&#x2F;main&#x2F;randssh.key.pub dasd=0.0.0100 s390x_net=qeth_l2,0.0.1000,0.0.1001,0.0.1002
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;blockquote&gt;
&lt;p&gt;So this should mark the last issue to overcome before we can proceed booting something on the Z15.
Though as booting isn’t installing:&lt;&#x2F;p&gt;
&lt;&#x2F;blockquote&gt;
&lt;h2 id=&quot;installing-nixos&quot;&gt;installing NixOS&lt;&#x2F;h2&gt;
&lt;p&gt;As we can now boot NixOS in qemu or even on the Z15. The next rational step would be
actually installing it. But to do that we first need a bootloader:&lt;&#x2F;p&gt;
&lt;h3 id=&quot;supporting-the-zipl-booloader-on-nixos&quot;&gt;supporting the zipl booloader on NixOS&lt;&#x2F;h3&gt;
&lt;p&gt;Unlike seen with &lt;code&gt;x86&lt;&#x2F;code&gt; where there are more bootloaders than let say linux distro families.
S390x &#x2F; IBM Z doesn’t give us a lot to choose from. We got &lt;a href=&quot;https:&#x2F;&#x2F;bl0v3.com&#x2F;Blog&#x2F;porting-nixos-to-an-ibm-mainframe&#x2F;%22https:&#x2F;&#x2F;github.com&#x2F;ibm-s390-linux&#x2F;zipl%22&quot;&gt;s390-tools&lt;&#x2F;a&gt;’s zipl
(Z initial program load)er. Thats it&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;GRUB2 also supports s390x but as it needs to be loaded from zipl. Thus usually one
does not gain too much by using it.&lt;&#x2F;p&gt;
&lt;p&gt;(Yes some boot setups benefit from it and I think
suse actually uses that. &lt;small&gt;but then you can also boot into a linux kernel and use
kexec to chainload stuff.&lt;&#x2F;p&gt;
&lt;p&gt;Effectively building your own linux-based bootloader&lt;&#x2F;small&gt;)
&lt;strong&gt;TODO link the article I wrote on linux based bootloaders when I finished it&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;Well unlike arch where you would call lets say &lt;code&gt;grub-install&lt;&#x2F;code&gt; yourself. Or even
on distros supporting mainframes where you’d call &lt;code&gt;zipl&lt;&#x2F;code&gt; in a likewise fashion.&lt;&#x2F;p&gt;
&lt;p&gt;When using NixOS things are a little different. You will not just be required to write a &lt;a href=&quot;https:&#x2F;&#x2F;bl0v3.com&#x2F;Blog&#x2F;porting-nixos-to-an-ibm-mainframe&#x2F;%22x%22&quot;&gt;derivation TODO LINK&lt;&#x2F;a&gt; but also
a module to go with it. Which is meant to allow NixOS to track the options exposed and thus define
things in an declarative fashion like we are used to when using Nix(OS).&lt;&#x2F;p&gt;
&lt;p&gt;While packaging zipl wasn’t the last thing I did, I still put it down here.
I chose this in order to reduce the amount of sections the reader would have to go trough
before getting to see NixOS boot up for the first time.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;(I already got it to compile in lxc before even bothering doing
anything beyond what was needed to boot zipl as I really wouldn’t
want to put in all this effort to realize I couldn’t get zipl working
under nix &lt;strong&gt;which almost was the case&lt;&#x2F;strong&gt;  as you will see :o )&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;writing-the-zipl-derivation-compiling-it&quot;&gt;writing the zipl derivation (compiling it)&lt;&#x2F;h3&gt;
&lt;p&gt;&lt;a href=&quot;https:&#x2F;&#x2F;bl0v3.com&#x2F;Blog&#x2F;porting-nixos-to-an-ibm-mainframe&#x2F;%22https:&#x2F;&#x2F;github.com&#x2F;ibm-s390-linux&#x2F;zipl%22&quot;&gt;S390-tools&lt;&#x2F;a&gt; contains a lot of utilities&#x2F;tools
other than just zipl itself. Some are more or less useless on a NixOS host, some you
can’t get around. But as I wanted to initially just focus on zipl I decided to
strip down the makefile &lt;small&gt;(it appears as if there is no way to be particularly selective about the
components you actually want to build)&lt;&#x2F;small&gt;. So I outfitted &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;bolives-hax&#x2F;nixos-s390x&#x2F;blob&#x2F;dbg-fm&#x2F;pkgs&#x2F;zipl-package.nix&quot;&gt;my drvs&lt;&#x2F;a&gt; (TODO link to updated one) &lt;code&gt;patchPhase&lt;&#x2F;code&gt;
with:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;substituteInPlace&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; Makefile &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;      --&lt;&#x2F;span&gt;replace-fail&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;LIB_DIRS = libvtoc libzds libdasd libccw libvmcp libekmfweb &lt;span class=&quot;z-constant z-character z-escape z-shell&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;LIB_DIRS = #&lt;span class=&quot;z-constant z-character z-escape z-shell&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt;      --&lt;&#x2F;span&gt;replace-fail&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;TOOL_DIRS = zipl zdump fdasd dasdfmt dasdview tunedasd &lt;span class=&quot;z-constant z-character z-escape z-shell&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;TOOL_DIRS = zipl dasdfmt netboot zdev#&lt;span class=&quot;z-constant z-character z-escape z-shell&quot;&gt;\\&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;small&gt;for a quick and hacky yet effective temporary solution&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Then I ended up fighting the buildsystem for quite some time to get the dependency checks to
not fail anymore. To hit the first real issue …&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO mention how nix wraps compilers, binutils, and the libc.
Why it does that (like how it injects a bunch of flags)
and why it injecting flags here is a huge problem and not desired&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;I didn’t expect that id run into any issues that can’t aren’t essentially
to blame on nix. But here we go: &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ibm-s390-linux&#x2F;s390-tools&#x2F;issues&#x2F;171&quot;&gt;linker section overlap #171&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;By now IBM actually went out of their way to fix this. So any claims made after
this notice no longer apply. But I will still include the parts I wrote before that was the case.
As actually many months passed until &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ibm-s390-linux&#x2F;s390-tools&#x2F;commit&#x2F;605680d6fdf49807d90b6036d925232ffabaa2c9&quot;&gt;zipl&#x2F;boot: Increase section size for eckd_mv dumper&lt;&#x2F;a&gt; fixed it.&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;While you can read my observations from the issue meant for the folks at IBM. I will still attempt to
break down and simplify the issue a little here as well.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;linkerscripts&quot;&gt;linkerscripts&lt;&#x2F;h4&gt;
&lt;p&gt;Whats relevant to know about linkerscripts in this context is that
among other things they most importantly tell our compiler(linker) the layout it should
confirm to when “linking” our input files. Its not that common to come across them
unless you work relatively close to hardware and need a higher degree of control
over the binary outputs your compiler produces.&lt;&#x2F;p&gt;
&lt;p&gt;For a bootloader this is of great importance as without an operating system or similar
things around &lt;strong&gt;something&lt;&#x2F;strong&gt; needs to tell it where exactly to place things. For example
lets assume that the hardware loads a certain segment of code into a hardcoded memory
address and then moves execution to it. We’d have to link our executable accordingly.&lt;&#x2F;p&gt;
&lt;p&gt;Of course our program also needs to know the locations of resources required at runtime
like where to find the content of constant variables. Where the stack should be kept
and of corse where the executable sections are. You may even include things such as
headers&#x2F;metadata which of course also need to be in the right locations.&lt;&#x2F;p&gt;
&lt;p&gt;Linker scripts are meant help with that. Here is an abstract from (s390-tools&#x2F;zipl’s) linker script in question:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;lds&quot; class=&quot;language-lds z-code&quot;&gt;&lt;code class=&quot;language-lds&quot; data-lang=&quot;lds&quot;&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;SECTIONS
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;{
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  . = STAGE2_DESC;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  __stage2_desc = .;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  . = STAGE2_LOAD_ADDRESS;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .stage2.head : { *(.stage2.head) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  . = STAGE2_ENTRY;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .text.start : {
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;    *(.text.start)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .text : { *(.text) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  __ex_table_start = .;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .ex_table : { *(.ex_table) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  __ex_table_stop = .;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .rodata : {*(.rodata) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .data : { *(.data) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  __stage2_params = .;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  . = 0x4ff0;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .stage2dump.tail : { *(.stage2dump.tail) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  . = 0x5000;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .eckd2dump_mv.tail : { *(.eckd2dump_mv.tail) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  . = 0x5200;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  __bss_start = .;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  .bss : { *(.bss) }
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  __bss_stop = .;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  . = STAGE2_HEAP_ADDRESS;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  ...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  ...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;  ...
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;}
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;for example the following sections have the following functions:&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;.text&lt;&#x2F;code&gt; &lt;small&gt;yes .text (this has nothing to do with ascii text)&lt;&#x2F;small&gt;
traditionally contains out executable code. As in the actual opcodes&#x2F;machine code.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;.rodata&lt;&#x2F;code&gt; contains static variables, be it global or local if they are static they
are “ro”=“read only” and are put here&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;.bss&lt;&#x2F;code&gt; (block statring symbol) contains statically allocated variables. But unlike
&lt;code&gt;.rodata&lt;&#x2F;code&gt; these are merely allocated meaning they haven’t been assigned values yet
as that happens at runtime.&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;.data&lt;&#x2F;code&gt; think &lt;code&gt;.rodata&lt;&#x2F;code&gt; except that its rw as in “read&#x2F;write”-able&lt;&#x2F;p&gt;
&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;p&gt;The actual layout (that was causing me issues) looks like this:&lt;&#x2F;p&gt;
&lt;pre class=&quot;z-code&quot;&gt;&lt;code&gt;&lt;span class=&quot;z-text z-plain&quot;&gt;&#x2F;*
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Memory layout of stage 2 for ECKD DASD dump tool
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * (single volume and multi volume)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * ===============================================
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; *
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * General memory layout
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * ---------------------
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; *
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0x0000-0x1fff	Lowcore
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0x2000-0xafff	Sections (load): head, text, data, rodata, rodata.str,
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; *			stage2dump.tail, eckd2dump_mv.tail, bss
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0xb000-0xdfff	Memory allocation (heap)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0xe000-0xffff	Stack
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; *
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * Special memory locations
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * ------------------------
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; *
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0x78			Stage 2 description parameters
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0x2018		Stage 2 entry point
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0x4ff0		Stage 2 multi-volume dump parameters (eckd2dump_mv)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0x5000		Multi-volume dump parameters table (eckd2dump_mv)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; * 0x9ff0		Stage 2 single volume dump parameters (eckd2dump_sv)
&lt;&#x2F;span&gt;&lt;span class=&quot;z-text z-plain&quot;&gt; *&#x2F;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;In the linkerscript abstract shown above there is on line thats of particular interest
to us. And its &lt;code&gt;. = 0x4ff0;&lt;&#x2F;code&gt; followed by &lt;code&gt;.stage2dump.tail : { *(.stage2dump.tail) }&lt;&#x2F;code&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;So as the comment describing the layout in a human readable fashion
states &lt;code&gt;0x2018 Stage 2 entry point&lt;&#x2F;code&gt; and &lt;code&gt;0x4ff0	Stage 2 multi-volume dump parameters (eckd2dump_mv)&lt;&#x2F;code&gt;.
We can say that at &lt;code&gt;0x2018&lt;&#x2F;code&gt; stage 2 pickups execution leaving space up until &lt;code&gt;0x4ff0&lt;&#x2F;code&gt; where
the multi volume dump parameters are located. Thus &lt;code&gt;0x4ff0 - 0x2018 = 0x2fd8&lt;&#x2F;code&gt; gives us
&lt;code&gt;11248 bytes&lt;&#x2F;code&gt; of space to place our executable code before another non executable section
follows.&lt;&#x2F;p&gt;
&lt;h4 id=&quot;whats-the-problem-and-why-did-i-run-into-it&quot;&gt;whats the problem (and why did I run into it)?&lt;&#x2F;h4&gt;
&lt;p&gt;What needs to be said here is as I wanted to run this on the Z10, I chose to
compile it with the Z10’s (cpu) set as the target. (As opposed to z13-z16 which are whats commonly
used at the time of writing this). The problem though is that quoting &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ibm-s390-linux&#x2F;s390-tools&#x2F;issues&#x2F;171#issuecomment-2258137192&quot;&gt;sharkcz’s comment&lt;&#x2F;a&gt;&lt;&#x2F;p&gt;
&lt;p&gt;&lt;q&gt;in Fedora we are now at z13 as the arch level, we were on zEC12 for a long time and on z10 before that“&lt;&#x2F;q&gt;&lt;&#x2F;p&gt;
&lt;p&gt;with the last z10 being from 2008 its safe to assume that development is most likely done on
Z13 or even Z15 as IBM operates a Z15 for selected open source projects to use. Even I do so. But
unlike the other devs I guess what sets me apart from them is wanting to run this on the Z10
as that is the machine I actually have sitting around locally.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;Running things on real hardware. Sitting right in front of you remains special in my eyes.
Cloud services lack this magical feeling real hardware provides :3&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;But how does this now play into the issue? Wouldn’t zipl compile just fine for the Z10? There shouldn’t
really anything explicitly preventing it. While many more features got added none of them
appear to explicitly be incompatible with the Z10 architecture.&lt;&#x2F;p&gt;
&lt;p&gt;The issue is much simpler. Its not a specific
feature rather its that there are &lt;strong&gt;“many features”&lt;&#x2F;strong&gt; now resulting in more code to be compiled
and consequently more machine code to be emitted.&lt;&#x2F;p&gt;
&lt;p&gt;Now remember the fact that we “only” got &lt;code&gt;11248 bytes&lt;&#x2F;code&gt;. But that still doesn’t answer why this works for the Z13-Z15.
Well the thing is while the size limit remains the same for every IBM Z series mainframe. The
compilers &lt;code&gt;-march=&lt;&#x2F;code&gt; optimisation flag does have a bigger and bigger effect when compiling with
&lt;code&gt;-Os&lt;&#x2F;code&gt; &#x2F; &lt;code&gt;-Oz&lt;&#x2F;code&gt; optimizing for size. With s390x being a
&lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;ibm-s390-linux&#x2F;s390-tools&#x2F;issues&#x2F;171#issuecomment-2258137192&quot;&gt;cisc architecture&lt;&#x2F;a&gt;and more and more
instructions being added. The compiler can naturally generate smaller and smaller binaries.
Because imagine you can do some sort of cpu operation that would have required lets say 20 (or even 200) instructions in the
same space as 1 to 10.&lt;&#x2F;p&gt;
&lt;p&gt;Thats the issue at core here.&lt;&#x2F;p&gt;
&lt;p&gt;&lt;strong&gt;TODO show diffs proving my point&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;well-what-now&quot;&gt;well what now?&lt;&#x2F;h3&gt;
&lt;p&gt;While trying out various compiler flags, compiler versions and even clang&#x2F;LLVM &lt;small&gt;(because why not)&lt;&#x2F;small&gt;
I got a little lucky. Turns out that when using gcc14 paired with the &lt;code&gt;gcc.arch = &quot;z10&quot;;&lt;&#x2F;code&gt; flag. Things
would actually compile. Making the Z10 I guess the oldest mainframe one could build s390-tools zipl for
&lt;small&gt;(and luckily that was the one I was targetting)&lt;&#x2F;small&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Its of advantage that nix(pkgs) makes it somewhat trivial to swap out the version GCC used by &lt;code&gt;stdenv.mkDerivation {}&lt;&#x2F;code&gt;. It
does this by offering a bunch of packages
with the following namingscheme &lt;q&gt;gcc&lt;code&gt;&amp;lt;MAJOR_VERSION_NUMBER&amp;gt;&lt;&#x2F;code&gt;Stdenv&lt;&#x2F;q&gt;. As packages providing an &lt;code&gt;stdenv&lt;&#x2F;code&gt;
expose &lt;code&gt;.mkDerivation {}&lt;&#x2F;code&gt; which is what we want to build pretty much everything in nix.&lt;&#x2F;p&gt;
&lt;p&gt;Using the following did the trick:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;packages&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;s390x_linux&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;default&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;gcc14Stdenv&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;mkDerivation&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;        &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;name&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;s390-tools&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;        &lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# ...&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;strong&gt;(TODO after fixing the actual zipl drv include a proper snippet though it more or less says this either way)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;blockquote class=&quot;tip&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Tip&lt;&#x2F;p&gt;
	&lt;p&gt;Using multiple stdenv packages &lt;code&gt;mkDerivation {}&lt;&#x2F;code&gt; function will result
in having to compile it from scratch if you don’t have binary caches. This is often the case on
niche architectures or when using custom compiler flags with your nixpkgs.&lt;&#x2F;p&gt;
&lt;p&gt;Among other reasons, this is why using multiple &lt;code&gt;stdenv&lt;&#x2F;code&gt;’s is not exactly favorable. Especially if
you will only do that for a single package &lt;small&gt;(unlike using a certain gcc version is unavoidable like in my case until IBM’s fix&lt;&#x2F;small&gt;)&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;
&lt;p&gt;So with my initial crude attempts at writing the “s390-tools =&amp;gt; (zipl)” derivation
now actually building succesfully for the first time. Its time for the next stage:&lt;&#x2F;p&gt;
&lt;p&gt;&lt;small&gt;(gotta come back here some day to bring this derivation out of this hacky state its in but let that be my problem)&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;h3 id=&quot;going-from-zipl-to-boot-loader-zipl&quot;&gt;going from zipl to &lt;code&gt;boot.loader.zipl&lt;&#x2F;code&gt;:&lt;&#x2F;h3&gt;
&lt;p&gt;If you ever succesfully installed nixos before you probably remember having used an option starting with &lt;code&gt;boot.loader&lt;&#x2F;code&gt; like
&lt;code&gt;boot.loader.grub&lt;&#x2F;code&gt; or &lt;code&gt;boot.loader.systemd-boot&lt;&#x2F;code&gt; or even &lt;code&gt;boot.loader.generic-extlinux-compatible&lt;&#x2F;code&gt; (&lt;small&gt;assuming of course
you did not use the installer which seems to exist these days&lt;&#x2F;small&gt;)&lt;&#x2F;p&gt;
&lt;h4 id=&quot;though-what-would-need-to-be-done-to-get-boot-loader-zipl-to-show-up-in-here-as-well&quot;&gt;Though what would need to be done to get &lt;code&gt;boot.loader.zipl&lt;&#x2F;code&gt; to show up in here as well?&lt;&#x2F;h4&gt;
&lt;p&gt;In order for the module to work like the other bootloaders it needs to declare a single setting: &lt;code&gt;system.build.installBootLoader&lt;&#x2F;code&gt;
&lt;small&gt;(and maybe &lt;code&gt;system.boot.loader.id = &quot;zipl&quot;;&lt;&#x2F;code&gt; but that one is boring)&lt;&#x2F;small&gt; &lt;strong&gt;TODO confirm if loader.id is needed I forgot&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;This is as when &lt;code&gt;nixos-install&lt;&#x2F;code&gt; is being run (or &lt;code&gt;nixos-rebuild&lt;&#x2F;code&gt; for this matter) it will evaluate this specific option
and at some point during the rebuild&#x2F;install process execute whatever this option points to. All bootloaders I’ve seen
packaged so far bring some sort of wrapper script.&lt;&#x2F;p&gt;
&lt;p&gt;Grub for example has: &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;blob&#x2F;5135c59491985879812717f4c9fea69604e7f26f&#x2F;nixos&#x2F;modules&#x2F;system&#x2F;boot&#x2F;loader&#x2F;grub&#x2F;install-grub.pl&quot;&gt;nixos&#x2F;modules&#x2F;system&#x2F;boot&#x2F;loader&#x2F;grub&#x2F;install-grub.pl&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;And extlinux has: &lt;a href=&quot;https:&#x2F;&#x2F;github.com&#x2F;NixOS&#x2F;nixpkgs&#x2F;blob&#x2F;5135c59491985879812717f4c9fea69604e7f26f&#x2F;nixos&#x2F;modules&#x2F;system&#x2F;boot&#x2F;loader&#x2F;generic-extlinux-compatible&#x2F;extlinux-conf-builder.sh&quot;&gt;nixos&#x2F;modules&#x2F;system&#x2F;boot&#x2F;loader&#x2F;generic-extlinux-compatible&#x2F;extlinux-conf-builder.sh&lt;&#x2F;a&gt;.&lt;&#x2F;p&gt;
&lt;p&gt;Besides the fact that I don’t know the perl language the &lt;code&gt;extlinux-conf-builder.sh&lt;&#x2F;code&gt; helper script is also much simpler. So lets look at this
one as opposed to &lt;code&gt;install-grub.pl&lt;&#x2F;code&gt; .&lt;&#x2F;p&gt;
&lt;p&gt;From simply looking at the way its invoked its pretty clear what we will have to do something like:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-storage z-modifier z-shell&quot;&gt;export&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;PATH&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-unquoted z-shell&quot;&gt;&#x2F;empty:@path@&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function z-shell&quot;&gt;&lt;span class=&quot;z-entity z-name z-function z-shell&quot;&gt;usage&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-begin z-shell&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-section z-braces z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function z-shell&quot;&gt;    &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-echo z-shell&quot;&gt;echo&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;usage: &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;0&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; -t &amp;lt;timeout&amp;gt; -c &amp;lt;path-to-default-configuration&amp;gt; [-d &amp;lt;boot-dir&amp;gt;] [-g &amp;lt;num-generations&amp;gt;] [-n &amp;lt;dtbName&amp;gt;] [-r]&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&amp;amp;&lt;&#x2F;span&gt;&lt;span class=&quot;z-constant z-numeric z-integer z-decimal z-file-descriptor z-shell&quot;&gt;2&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function z-shell&quot;&gt;    &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-exit z-shell&quot;&gt;exit&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; 1&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-braces z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;timeout&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;                &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; Timeout in centiseconds&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;menu&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-unquoted z-shell&quot;&gt;1&lt;&#x2F;span&gt;                  &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; Enable menu by default&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;default&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;                &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; Default configuration&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;target&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-unquoted z-shell&quot;&gt;&#x2F;boot&lt;&#x2F;span&gt;            &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; Target directory&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;numGenerations&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-unquoted z-shell&quot;&gt;0&lt;&#x2F;span&gt;        &lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; Number of other generations to include in the menu&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; actual implementation&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-comment z-begin z-shell&quot;&gt;#&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt; ...&lt;&#x2F;span&gt;&lt;span class=&quot;z-comment z-line z-number-sign z-shell&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;&lt;small&gt;For now just assume &lt;code&gt;$PATH&lt;&#x2F;code&gt; is properly populated with all the executables we need&lt;&#x2F;small&gt;&lt;&#x2F;p&gt;
&lt;p&gt;You can see that the helper script is merely being called with a bunch of parameters. Just two of these &lt;strong&gt;have to&lt;&#x2F;strong&gt; be provided:
namely &lt;code&gt;-t timeout&lt;&#x2F;code&gt; and &lt;code&gt;-c path-to-default-configuration&lt;&#x2F;code&gt;. But all the other ones are optional | may have a default
value assigned if unspecified.&lt;&#x2F;p&gt;
&lt;p&gt;While most of these settings are quite useful and should be supported &lt;strong&gt;in theory&lt;&#x2F;strong&gt; &lt;code&gt;-c&lt;&#x2F;code&gt;
would be the only option you to respect. The &lt;code&gt;-c&lt;&#x2F;code&gt; doesn’t come from the nixos activation scripts though
as they wrapped it a tiny bit in reality it looks
like this&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;builder&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;builderArgs&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;d&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-single z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;${args.path}&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;c&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-language z-shell&quot;&gt;@&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;So &lt;code&gt;$@&lt;&#x2F;code&gt; is actually whats being passed rather than &lt;code&gt;-c &amp;lt;value&amp;gt;&lt;&#x2F;code&gt;&lt;&#x2F;p&gt;
&lt;p&gt;Thus its “the &lt;strong&gt;first&lt;&#x2F;strong&gt; commandline argument” passed to the executable declared by &lt;code&gt;system.build.installBootLoader&lt;&#x2F;code&gt; that
defines the path this script should install the bootloader files to.&lt;&#x2F;p&gt;
&lt;p&gt;The way one would want to wrap this and maybe processes further parameters,
depends on the features your bootloader actually supports and consequently the the module options you exposed
&lt;small&gt;(the menu bootentry selection timeout is a good example)&lt;&#x2F;small&gt;.&lt;&#x2F;p&gt;
&lt;small&gt;
&lt;blockquote class=&quot;note&quot;&gt;
	&lt;p class=&quot;alert-title&quot;&gt;
		&lt;i class=&quot;icon&quot;&gt;&lt;&#x2F;i&gt;Note&lt;&#x2F;p&gt;
	&lt;p&gt;grub supports &lt;strong&gt;A LOT&lt;&#x2F;strong&gt; of features which is probably why it needs a huge perl script as opposed to the shell based extlinux-compat shown above&lt;&#x2F;p&gt;

&lt;&#x2F;blockquote&gt;

&lt;&#x2F;small&gt;
&lt;p&gt;So to write a bootloader module one essentially only has to respect the installation path and ideally expose every
functionality&#x2F;feature the bootloader configs offer trough the nixos option system. And consequently parse the flags
you fed to your helper script trough the commandline parameters&#x2F;env given.&lt;&#x2F;p&gt;
&lt;p&gt;So the skeleton I ended up using looks something like this:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;nix&quot; class=&quot;language-nix z-code&quot;&gt;&lt;code class=&quot;language-nix&quot; data-lang=&quot;nix&quot;&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-entity z-function z-2 z-nix&quot;&gt;{&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function z-1 z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function z-1 z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-function z-1 z-nix&quot;&gt;lib&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;,&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;...&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-entity z-function z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-function z-nix&quot;&gt;:&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-other z-nix&quot;&gt;let&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;builder&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;substituteAll&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;src&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-unquoted z-path z-nix&quot;&gt;.&#x2F;zipl-conf-builder.sh&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;isExecutable&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-constant z-language z-nix&quot;&gt;true&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;path&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-other z-nix&quot;&gt;with&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;; &lt;span class=&quot;z-punctuation z-definition z-list z-nix&quot;&gt;[&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;coreutils&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;gnused&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;gnugrep&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;s390-tools&lt;&#x2F;span&gt; &lt;span class=&quot;z-comment z-line z-number-sign z-nix&quot;&gt;# zipl is found here&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-punctuation z-definition z-list z-nix&quot;&gt;]&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;    &lt;span class=&quot;z-keyword z-other z-inherit z-nix&quot;&gt;inherit&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-section z-function z-arguments z-nix&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;pkgs&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-function z-arguments z-nix&quot;&gt;)&lt;&#x2F;span&gt; &lt;span class=&quot;z-entity z-other z-attribute-name z-single z-nix&quot;&gt;bash&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-inherit z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-keyword z-other z-nix&quot;&gt;in&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;options&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;boot&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;loader&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;zipl&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;          &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;enable&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;mkOption&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;              &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;default&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-constant z-language z-nix&quot;&gt;false&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;              &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;type&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;types&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;bool&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;              &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;description&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;wether to enable s390-tools zipl bootloader&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;          &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;          &lt;span class=&quot;z-comment z-block z-nix&quot;&gt;&#x2F;* other options here like:
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-block z-nix&quot;&gt;          timeout = mkOption { ... }; 
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-block z-nix&quot;&gt;          
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-block z-nix&quot;&gt;          to then append below in between ${builder} and -c
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-comment z-block z-nix&quot;&gt;          *&#x2F;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;config&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;mkIf&lt;&#x2F;span&gt; &lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;config&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;boot&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;loader&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;zipl&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-nix&quot;&gt;.&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;enable&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-definition z-attrset-or-function z-nix&quot;&gt;{&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;system&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;build&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;installBootLoader&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-markup z-italic&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-begin z-nix&quot;&gt;${&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-name z-nix&quot;&gt;builder&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-embedded z-end z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; -c&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;      &lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;system&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;boot&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;loader&lt;&#x2F;span&gt;.&lt;span class=&quot;z-entity z-other z-attribute-name z-multipart z-nix&quot;&gt;id&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-bind z-nix&quot;&gt;=&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-double z-start z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;zipl&lt;span class=&quot;z-punctuation z-definition z-string z-double z-end z-nix&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;  &lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-terminator z-bind z-nix&quot;&gt;;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-nix&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-attrset z-nix&quot;&gt;}&lt;&#x2F;span&gt; 
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;other than &lt;code&gt;pkgs.substituteAll&lt;&#x2F;code&gt; wich takes care of the conf-builders &lt;code&gt;$PATH&lt;&#x2F;code&gt; variable being properly
populated. Everything seen above should have been covered by now. The script itself won’t
structurally and conceptually differ &lt;small&gt;(toooo much)&lt;&#x2F;small&gt; from the extlinux one. Except
that in my case boot loader menu entries and the actual
entries are being organized into 2 different blocks that are later on merged together.&lt;&#x2F;p&gt;
&lt;p&gt;Because one of nixos’s greatest feature is being able to switch between system-generations
(ideally directly from the bootloader) to temporarily roll back broken systems and such without
relying on CoW filesystems or such things. One most likely wants to add support fot that in ones
script as well. Thus a little funky shell magic is needed:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;sh&quot; class=&quot;language-sh z-code&quot;&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;    &lt;span class=&quot;z-keyword z-control z-loop z-for z-shell&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt; generation &lt;span class=&quot;z-keyword z-control z-in z-shell&quot;&gt;in&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-begin z-shell&quot;&gt;(&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;            &lt;span class=&quot;z-punctuation z-definition z-compound z-begin z-shell&quot;&gt;(&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-support z-function z-cd z-shell&quot;&gt;cd&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &#x2F;nix&#x2F;var&#x2F;nix&#x2F;profiles&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-logical z-and z-shell&quot;&gt;&amp;amp;&amp;amp;&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;ls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;d&lt;&#x2F;span&gt; system-&lt;span class=&quot;z-keyword z-operator z-regexp z-quantifier z-shell&quot;&gt;*&lt;&#x2F;span&gt;-link&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-compound z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;&#x2F;span&gt;            &lt;span class=&quot;z-keyword z-operator z-logical z-pipe z-shell&quot;&gt;|&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;sed&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-string z-quoted z-single z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;s&#x2F;system-\([0-9]\+\)-link&#x2F;\1&#x2F;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;#39;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;&#x2F;span&gt;            &lt;span class=&quot;z-keyword z-operator z-logical z-pipe z-shell&quot;&gt;|&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;sort&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;r&lt;&#x2F;span&gt; &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;&#x2F;span&gt;            &lt;span class=&quot;z-keyword z-operator z-logical z-pipe z-shell&quot;&gt;|&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;head&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;n&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;numGenerations&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-logical z-continue z-shell&quot;&gt;;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-control z-loop z-do z-shell&quot;&gt;do&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;        &lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;link&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-unquoted z-shell&quot;&gt;&#x2F;nix&#x2F;var&#x2F;nix&#x2F;profiles&#x2F;system-&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;-link&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;        &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;addZiplEntry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;link&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;tmpFile&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;        &lt;span class=&quot;z-keyword z-control z-loop z-for z-shell&quot;&gt;for&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt; specialisation &lt;span class=&quot;z-keyword z-control z-in z-shell&quot;&gt;in&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-begin z-shell&quot;&gt;(&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;            &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;ls&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &#x2F;nix&#x2F;var&#x2F;nix&#x2F;profiles&#x2F;system-&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;-link&#x2F;specialisation &lt;span class=&quot;z-punctuation z-separator z-continuation z-line z-shell&quot;&gt;\
&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;&lt;span class=&quot;z-meta z-group z-for z-shell&quot;&gt;&lt;span class=&quot;z-meta z-group z-expansion z-command z-parens z-shell&quot;&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;&#x2F;span&gt;            &lt;span class=&quot;z-keyword z-operator z-logical z-pipe z-shell&quot;&gt;|&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;sort&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;n&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-parameter z-option z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-parameter z-shell&quot;&gt; -&lt;&#x2F;span&gt;r&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-parens z-end z-shell&quot;&gt;)&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-logical z-continue z-shell&quot;&gt;;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-control z-loop z-do z-shell&quot;&gt;do&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;            &lt;span class=&quot;z-variable z-other z-readwrite z-assignment z-shell&quot;&gt;link&lt;&#x2F;span&gt;&lt;span class=&quot;z-keyword z-operator z-assignment z-shell&quot;&gt;=&lt;&#x2F;span&gt;&lt;span class=&quot;z-string z-unquoted z-shell&quot;&gt;&#x2F;nix&#x2F;var&#x2F;nix&#x2F;profiles&#x2F;system-&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;-link&#x2F;specialisation&#x2F;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;specialisation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;            &lt;span class=&quot;z-meta z-function-call z-shell&quot;&gt;&lt;span class=&quot;z-variable z-function z-shell&quot;&gt;addZiplEntry&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-function-call z-arguments z-shell&quot;&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;link&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-string z-quoted z-double z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-begin z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;generation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;-&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-begin z-shell&quot;&gt;{&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;specialisation&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-section z-expansion z-parameter z-end z-shell&quot;&gt;}&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;span class=&quot;z-punctuation z-definition z-string z-end z-shell&quot;&gt;&amp;quot;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-keyword z-operator z-assignment z-redirection z-shell&quot;&gt;&amp;gt;&amp;gt;&lt;&#x2F;span&gt; &lt;span class=&quot;z-meta z-group z-expansion z-parameter z-shell&quot;&gt;&lt;span class=&quot;z-punctuation z-definition z-variable z-shell&quot;&gt;$&lt;&#x2F;span&gt;&lt;span class=&quot;z-variable z-other z-readwrite z-shell&quot;&gt;tmpFile&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;        &lt;span class=&quot;z-keyword z-control z-loop z-end z-shell&quot;&gt;done&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;span class=&quot;z-source z-shell z-bash&quot;&gt;    &lt;span class=&quot;z-keyword z-control z-loop z-end z-shell&quot;&gt;done&lt;&#x2F;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;while a little simplified and still WIP &#x2F; subjected to change. addZiplEntry effectively&lt;&#x2F;p&gt;
&lt;ul&gt;
&lt;li&gt;add a menu option to the zipl config file&lt;&#x2F;li&gt;
&lt;li&gt;extracts the profiles init= and other kernel parameters&lt;&#x2F;li&gt;
&lt;li&gt;copies over the profiles kernel and initrd to the bootloader install dir&lt;&#x2F;li&gt;
&lt;li&gt;is able to also perform cleanup on kernels&#x2F;initrds if the generation was to be removed&lt;&#x2F;li&gt;
&lt;li&gt;actually installs zipl &lt;code&gt;zipl --config=&lt;&#x2F;code&gt; with the newly generated config&lt;&#x2F;li&gt;
&lt;&#x2F;ul&gt;
&lt;h2 id=&quot;booting-nixos-ibm-z10&quot;&gt;booting NixOS (IBM Z10)&lt;&#x2F;h2&gt;
&lt;p&gt;&lt;strong&gt;TODO link to secondary article that explains how
to even set up a mainframe (as in sitting in front of it)&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;hr &#x2F;&gt;
&lt;h2 id=&quot;etc&quot;&gt;etc :&lt;&#x2F;h2&gt;
&lt;p&gt;I also needed to address issues in pythons psutil,numpy1,numpy2 when building a more common NixOS installation, it is also required to do some modifications to libfuse,libuv,klibc,spdlog,luajit,libopus,tmp2-tss,aws-c-sdk,aws-c-common.&lt;&#x2F;p&gt;
&lt;p&gt;Also to have a more or less proper nixos system one may not get around the fact that nsncd has some serialization issues and netcat needs to be
taken from openssl not libressl as libressl completely dropped s390x support in recent years.&lt;&#x2F;p&gt;
&lt;p&gt;Also the tpm2 systemd service being broken and some kernel flags being absent is something to keep in mind.
&lt;strong&gt;TODO maybe elaborate on all of these points&lt;&#x2F;strong&gt;&lt;&#x2F;p&gt;
&lt;p&gt;TODO talk about https:&#x2F;&#x2F;github.com&#x2F;aws&#x2F;aws-sdk-cpp&lt;&#x2F;p&gt;
</content>
        
    </entry>
</feed>
