README: add building steps

This commit is contained in:
Antoine Martin 2024-08-22 11:27:01 -04:00
parent a6efd9ddf6
commit 269b0c0570
Signed by: forge
GPG key ID: D62A472A4AA7D541

View file

@ -18,7 +18,77 @@ Thus the following use cases are still not supported / tested:
* `qubes-vm-kernel-support` Not adapted for use on Alpine yet, due to it providing a Dracut module. In most cases, it is not necessary as Qubes provides the kernel. * `qubes-vm-kernel-support` Not adapted for use on Alpine yet, due to it providing a Dracut module. In most cases, it is not necessary as Qubes provides the kernel.
This package is only neccessary when VM uses its own kernel, thus a hook is added to Dracut to generate the initrd for use within qubes. This package is only neccessary when VM uses its own kernel, thus a hook is added to Dracut to generate the initrd for use within qubes.
#### Issues, recommendations and proposals ## How to build
Since this template builder uses pre-built Alpine Linux packages for QubesOS template support, it by defaults does not build everything locally. If you want to build them locally, you can follow these steps. If not, you can skip to the next section.
### Build packages
**1) Set-up build environment on Alpine Linux**
```
apk add alpine-sdk lua-aports
addgroup <yourusername> abuild
mkdir -p /var/cache/distfiles
chmod a+w /var/cache/distfiles
abuild-keygen -a -i
cp /home/user/.abuild/*.pub /etc/apk/keys
```
(see [Creating an Alpine package](https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package) on Alpine Linux Wiki for more details)
**2) Create work directory and clone `qports` with appropriate branch**
```
mkdir work
cd work
git clone https://ayakael.net/forge/qports -b <desired Qubes Rel, i.e r4.2>
```
**3) Build all packages using `buildrepo`**
`buildrepo -a <path/to/qports> -d <path/to/work/dir>/packages qports`
**4) Make these packages available on an HTTP server and export the following variables**
```
export QUBESALPINE_MIRROR=<https://url-to-custom-repo>
export QUBESALPINE_KEYFILE=<https://url-to-custom-repo-key>
```
### Build template
**1) Create work directory and clone `qubes-builder-alpine` with appropriate branch**
```
mkdir work
cd work
git clone https://ayakael.net/forge/qubes-builder-alpine -b <desred Qubes Rel, i.e r4.2>
```
**2) Set-up build environment for QubesOS template build**
```
git clone https://github.com/QubesOS/qubes-builder
mkdir qubes-builder/qubes-src
ln -s $(pwd) qubes-builder/qubes-src/builder-alpine
cp builder.conf qubes-builder/.
git clone https://github.com/QubesOS/qubes-linux-template-builder qubes-builder/qubes-src/linux-template-builder
```
**3) Setup build information**
```
echo "%define _arch x86_64" >> qubes-builder/qubes-src/linux-template-builder/templates.spec
echo "4.2.0" > qubes-builder/qubes-src/linux-template-builder/version
```
If you want to build a different Alpine version than default, you can modify `qubes-builder/builder.conf` on line `DIST_VM` to alpine<desired-version-without-dot> (i.e alpine320).
**4) Build template**
```
cd qubes-builder
make linux-template-builder
```
**5) Install produced RPM on dom0**
```
qvm-run --pass-io <build-vm> 'cat <path/to/work/dir>/qubes-builder/qubes-src/linux-template-builder/rpm/noarch/qubes-template-*.rpm' > qubes-template-alpine.rpm
qvm-template install --nogpgcheck $(pwd)/qubes-template-alpine.rpm
```
## Issues, recommendations and proposals
**To report an issue or share a recommendation** **To report an issue or share a recommendation**
Go [here](https://gitlab.alpinelinux.org/ayakael/qubes-builder-alpine/-/issues) Go [here](https://gitlab.alpinelinux.org/ayakael/qubes-builder-alpine/-/issues)