Compare commits

...

2 commits

6 changed files with 367 additions and 0 deletions

172
build/archos-build.uefi Normal file
View file

@ -0,0 +1,172 @@
#!/usr/bin/bash
DEVICE="ArchOS.raw"
declare -A GUID=""
GUID=([ESP]="c12a7328-f81f-11d2-ba4b-00a0c93ec93b" [ROOT]="4f68bce3-e8cd-4db1-96e7-fbcaf984b709")
mkdir repart
cd repart || exit
cat > 10-esp.conf << EOF
[Partition]
Type=esp
Label=EFI System Partition
SizeMinBytes=512M
SizeMaxBytes=512M
Format=vfat
EOF
cat > 20-root.conf << EOF
[Partition]
Type=root
Label=ArchOS Build Root
Format=ext4
GrowFileSystem=yes
EOF
cat > 30-swap.conf << EOF
[Partition]
Type=swap
Label=ArchOS Build Swap
SizeMinBytes=512M
SizeMaxBytes=3G
Format=swap
EOF
cd ..
# Temporär
touch "${DEVICE}"
systemd-repart --definitions=repart --dry-run=no --size=auto --empty=allow "${DEVICE}"
#systemd-repart --definitions=repart --dry-run=no --size=10G --empty=create "${DEVICE}"
mount /dev/disk/by-partuuid/"${GUID[ROOT]}" /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-partuuid/"${GUID[ESP]}" /mnt/boot
# Pacman im Live-System konfigurieren
sed -i 's/#\(Color\)/\1/' /etc/pacman.conf
# Umbruch notwendug
sed -i 's/#\(ParallelDownloads\s=\s5\)/\1\
ILoveCandy/' /etc/pacman.conf
TIMEZONE="Europe/Berlin"
LANG="de_DE.UTF-8"
KEYMAP="de-latin1"
HOSTNAME_NEW="arch-build"
KERNEL="linux"
BASE=(base)
INITRD=(mkinitcpio)
MICROCODE="amd-ucode"
WIFI_BACKEND=(wpa_supplicant)
NETWORK=(iptables-nft firewalld inetutils avahi networkmanager networkmanager-openconnect networkmanager-openvpn networkmanager-pptp networkmanager-vpnc "${WIFI_BACKEND[@]}" modemmanager)
OTHER=(vim mkosi git lynx openssh htop bash-completion man-db man-pages reflector "${BASE[@]}" "${INITRD[@]}" plymouth linux-firmware xdg-utils)
pacstrap /mnt "${KERNEL}" "${MICROCODE}" "${NETWORK[@]}" "${OTHER[@]}"
arch-chroot /mnt hwclock --systohc
arch-chroot /mnt rm -rf /etc/localtime
arch-chroot /mnt ln -sf "/usr/share/zoneinfo/${TIMEZONE}" /etc/localtime
sed -i 's/#\(Color\)/\1/' /mnt/etc/pacman.conf
# Umbruch notwendug
sed -i 's/#\(ParallelDownloads\s=\s5\)/\1\
ILoveCandy/' /mnt/etc/pacman.conf
sed -i "s/#\(${LANG}\)/\1/" /mnt/etc/locale.gen
arch-chroot /mnt locale-gen
echo "LANG=${LANG}" > /mnt/etc/locale.conf
echo "KEYMAP=${KEYMAP}" > /mnt/etc/vconsole.conf
echo "${HOSTNAME_NEW}" > /mnt/etc/hostname
cat > /mnt/etc/hosts << EOF
# The following lines are desirable for IPv4 capable hosts
127.0.0.1 localhost
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
EOF
arch-chroot /mnt chpasswd <<< "root:testen"
arch-chroot /mnt chpasswd <<< "build:build"
sed -i 's/#\(CHARACTER_SET:\).*/\1utf-8/' /mnt/etc/lynx.cfg
cat > /mnt/etc/xdg/reflector/reflector.conf << EOF
--save /etc/pacman.d/mirrorlist
--country Germany
--protocol https
--latest 5
EOF
mkdir -p /mnt/etc/systemd/resolved.conf.d
cat > /mnt/etc/systemd/resolved.conf.d/disable-multicastDNS.conf << EOF
[Resolve]
MulticastDNS=no
EOF
arch-chroot /mnt systemctl enable systemd-resolved
arch-chroot /mnt systemctl enable systemd-timesyncd
arch-chroot /mnt systemctl enable NetworkManager
arch-chroot /mnt systemctl enable reflector.timer
arch-chroot /mnt systemctl enable firewalld
arch-chroot /mnt systemctl enable fstrim.timer
arch-chroot /mnt systemctl enable gdm
arch-chroot /mnt systemctl enable avahi-daemon
arch-chroot /mnt systemctl enable bluetooth
sed -i 's/^HOOKS=(.*)/HOOKS=(base systemd keyboard plymouth autodetect sd-vconsole modconf kms block filesystems fsck)/' /mnt/etc/mkinitcpio.conf
arch-chroot /mnt mkinitcpio -p "${KERNEL}"
arch-chroot /mnt bootctl install
cat > /mnt/boot/loader/loader.conf << EOF
timeout 5
console-mode max
editor yes
default *
EOF
cat > /mnt/boot/loader/entries/arch.conf << EOF
title Arch Linux Build
version 0.1
linux /vmlinuz-${KERNEL}
initrd /${MICROCODE}.img
initrd /initramfs-${KERNEL}.img
options quiet splash rw
EOF
mkdir -p /mnt/usr/lib/repart.d
#cd repart || exit
cat > /mnt/usr/lib/repart.d/10-esp.conf << EOF
[Partition]
Type=esp
Label=EFI System Partition
SizeMinBytes=512M
SizeMaxBytes=512M
Format=vfat
EOF
cat > /mnt/usr/lib/repart.d/20-root.conf << EOF
[Partition]
Type=root
Label=ArchOS Build Root
Format=ext4
GrowFileSystem=yes
EOF
cat > /mnt/usr/lib/repart.d/30-swap.conf << EOF
[Partition]
Type=swap
Label=ArchOS Build Swap
SizeMinBytes=512M
SizeMaxBytes=3G
Format=swap
EOF
exit 0

151
mkosi/Readme.md Normal file
View file

@ -0,0 +1,151 @@
```
/
/mkosi.skeleton/ oder mkosi.skeleton.tar
/mkosi.extra/ oder mkosi.extra.tar
/mkosi.nspawn
/mkosi.cache/
/mkosi.builddir/
/mkosi.rootpw
/mkosi.passphrase
/mkosi.crt
/mkosi.key
/mkosi.output/
/mkosi.credentials/
/mkosi.repart/
/mkosi.repart/*.conf
/mkosi.conf
/mkosi.presets/
```
---
```
mkosi.conf
```
```ini
[Match]
Distribution=
Release=
PathExists=
ImageId=
ImageVersion=
Bootable=
Format=
SystemdVersion=
[Preset]
Preset=
Dependencies=
[Distribution]
Distribution=fedora|debian|ubuntu|arch|opensuse|mageia|centos|openmandriva|rocky|alma
Release=
Architecture=alpha|arc|arm|arm64|ia64|loongarch64|mips64-le|mips-le|parisc|ppc|ppc64|ppc64-le|riscv32|riscv64|s390|s390x|tilegx|x86|x86-64
Mirror=
LocalMirror=
RepositoryKeyCheck=
Repositories=
CacheOnly=
[Output]
Format=directory|tar|cpio|disk|uki|none
ManifestFormat=json|changelog
Output=
CompressOutput=yes|no|xz|zstd
OutputDirectory=mkosi.output/
WorkspaceDirectory=mkosi.workspace/
CacheDirectory=mkosi.cache/
BuildDirectory=mkosi.builddir/
ImageVersion=
ImageId=
SplitArtifacts=
RepartDirectories=mkosi.repart/
SectorSize=
Overlay=
UseSubvolumes=auto|yes|no
Seed=(uuid)|random
SourceDateEpoch=
[Content]
Packages=
BuildPackages=
WithDocs=
BaseTrees=
SkeletonTrees=mkosi.skeleton/
PackageManagerTrees=
ExtraTrees=mkosi.extra/|mkosi.extra.tar
RemovePackages=
RemoveFiles=
CleanPackageMetadata=yes|no|auto
PrepareScript=
BuildScript=
PostInstallationScript=
FinalizeScript=
BuildSources=
Environment=
WithTests=yes|no
WithNetwork=yes|no
Bootable=yes|no|auto
Bootloader=none|systemd-boot|uki|grub
BiosBootloader=none|grub
Initrds=
KernelCommandLine=
KernelModulesInclude=
KernelModulesExclude=
KernelModulesInitrd=yes|no
KernelModulesInitrdInclude=
KernelModulesInitrdExclude=
Locale=
LocaleMessages=
Keymap=
Timezone=
Hostname=
RootShell=
RootPassword= (mkosi.rootpw (hashed:))
Autologin=yes|no
MakeInitrd=
Ssh=
[Validation]
SecureBoot=
SecureBootKey=
SecureBootCertificate=
SecureBootSignTools=sbsign|pesign|auto
VerityKey=
VerityCertificate=
SignExpectedPCR=yes|no|auto
Passphrase=
Checksum=
Sign=
Key=
[Host]
Incremental=
NSpawnSettings= (mkosi.nspawn)
ExtraSearchPaths=
QemuGui=yes|no
QemuSmp=2
QemuMem=1G
QemuKvm=yes|no|auto
QemuVsock=yes|no|auto
QemuSwtpm=yes|no|auto
QemuCdrom=yes|no
QemuFirmware=uefi|bios|linux|auto
QemuKernel=
QemuArgs=
Ephemeral=
Credentials=key=value key2=value2
KernelCommandLineExtra=
Acl=yes|no
ToolsTree= (mkosi.tools/)
ToolsTreeDistribution=
ToolsTreeRelease=
ToolsTreePackages=
RuntimeTrees=
```
---
```
mkosi.nspawn
```
```
```
---

14
mkosi/mkosi.conf Normal file
View file

@ -0,0 +1,14 @@
# Initrd
[Distribution]
Distribution=arch
[Output]
ImageId=initrd
Format=cpio
ManifestFormat=
Compress=zstd
Cache=mkosi.cache
OutputDirectory=mkosi.output
[Content]
Packages=systemd,systemd-udev,bash,less,libfido2,p11-kit,tpm2-tss

View file

@ -0,0 +1,8 @@
# [Match]
# Distribution=arch
[Content]
Packages=
[Output]
Format=

15
mkosi/mkosi.default Normal file
View file

@ -0,0 +1,15 @@
[Match]
Distribution=fedora
Release=24
[Output]
Format=raw btrfs
Bootable=yes
# SecureBoot=yes
# Verity=yes
[Packages]
# The packages to appear in both the build and the final image
Packages=openssh-clients httpd
# The packages to appear in the build image, but absent from the final image
BuildPackages=make gcc libcurl-devel

7
mkosi/run.sh Normal file
View file

@ -0,0 +1,7 @@
#!/bin/bash
mkosi -t raw btrfs --bootable -o ArchOS.raw
systemd-nspawn -bi ArchOS.raw
qemu-kvm -m 512 -smp 2 -bios /usr/share/edk2/ovmf/OVMF_CODE.fd -drive format=raw,file=ArchOS.raw
mkosi -d fedora -t raw_squashfs --checksum -xz --package=openssh-clients --package=emacs
#########################
mkosi [--force] [--directory=<path>]