diff --git a/device/raspberry/rpi5/mkosi.conf b/device/raspberry/rpi5/mkosi.conf new file mode 100644 index 0000000..18a97f3 --- /dev/null +++ b/device/raspberry/rpi5/mkosi.conf @@ -0,0 +1,38 @@ +[Distribution] +Distribution=rosa +Release=rosa13 +Architecture=arm64 + +[Output] +Format=disk +CompressOutput= +# RPI firmware does not support +# 4k sectors +SectorSize=512 + +[Content] +Packages= + kernel-6.12-generic + raspberrypi-bootloader + coreutils + dnf5 + neovim + dracut + iproute2 + locales-en + openssh-server + rosa-repos + systemd + +Bootable=no +Autologin=yes +RootPassword=root +RootShell=/usr/bin/bash +Locale=en_US.UTF-8 +Timezone=Europe/Moscow +Hostname=raspberrypi +WithDocs=no +CleanPackageMetadata=false + +[Build] +WithNetwork=yes diff --git a/device/raspberry/rpi5/mkosi.extra/boot/cmdline.txt b/device/raspberry/rpi5/mkosi.extra/boot/cmdline.txt new file mode 100644 index 0000000..f6fcc3a --- /dev/null +++ b/device/raspberry/rpi5/mkosi.extra/boot/cmdline.txt @@ -0,0 +1 @@ +console=serial0,115200 console=tty1 loglevel=1 root=LABEL=rootfs rootfstype=ext4 fsck.repair=yes diff --git a/device/raspberry/rpi5/mkosi.extra/boot/config.txt b/device/raspberry/rpi5/mkosi.extra/boot/config.txt new file mode 100644 index 0000000..0841f04 --- /dev/null +++ b/device/raspberry/rpi5/mkosi.extra/boot/config.txt @@ -0,0 +1,49 @@ +# For more options and information see +# http://rptl.io/configtxt +# Some settings may impact device functionality. See link above for details + +# Uncomment some or all of these to enable the optional hardware interfaces +#dtparam=i2c_arm=on +#dtparam=i2s=on +#dtparam=spi=on + +# Enable audio (loads snd_bcm2835) +dtparam=audio=on + +# Additional overlays and parameters are documented +# /boot/firmware/overlays/README + +# Automatically load overlays for detected cameras +camera_auto_detect=1 + +# Automatically load overlays for detected DSI displays +display_auto_detect=1 + +# Automatically load initramfs files, if found +auto_initramfs=1 + +# Enable DRM VC4 V3D driver +dtoverlay=vc4-kms-v3d +max_framebuffers=2 + +# Don't have the firmware create an initial video= setting in cmdline.txt. +# Use the kernel's default instead. +disable_fw_kms_setup=1 + +# Disable compensation for displays with overscan +disable_overscan=1 + +# Run as fast as firmware / board allows +arm_boost=1 + +[cm4] +# Enable host mode on the 2711 built-in XHCI USB controller. +# This line should be removed if the legacy DWC2 controller is required +# (e.g. for USB device mode) or if USB support is not required. +otg_mode=1 + +[cm5] +dtoverlay=dwc2,dr_mode=host + +[all] +arm_64bit=1 diff --git a/device/raspberry/rpi5/mkosi.extra/etc/repart.d/50-root.conf b/device/raspberry/rpi5/mkosi.extra/etc/repart.d/50-root.conf new file mode 100644 index 0000000..a580295 --- /dev/null +++ b/device/raspberry/rpi5/mkosi.extra/etc/repart.d/50-root.conf @@ -0,0 +1,4 @@ +# grow up rootfs on first boot +[Partition] +Type=root +GrowFileSystem=yes diff --git a/device/raspberry/rpi5/mkosi.extra/etc/systemd/network/80-ethernet.network b/device/raspberry/rpi5/mkosi.extra/etc/systemd/network/80-ethernet.network new file mode 100644 index 0000000..439df18 --- /dev/null +++ b/device/raspberry/rpi5/mkosi.extra/etc/systemd/network/80-ethernet.network @@ -0,0 +1,10 @@ +[Match] +Type=ether + +[Network] +DHCP=yes +LinkLocalAddressing=yes +MulticastDNS=yes + +[DHCPv4] +ClientIdentifier=mac diff --git a/device/raspberry/rpi5/mkosi.extra/etc/systemd/system/systemd-growfs-root.service.d/10-rootfs.conf b/device/raspberry/rpi5/mkosi.extra/etc/systemd/system/systemd-growfs-root.service.d/10-rootfs.conf new file mode 100644 index 0000000..69b3b18 --- /dev/null +++ b/device/raspberry/rpi5/mkosi.extra/etc/systemd/system/systemd-growfs-root.service.d/10-rootfs.conf @@ -0,0 +1,5 @@ +[Unit] +ConditionFirstBoot=true + +[Install] +WantedBy=multi-user.target diff --git a/device/raspberry/rpi5/mkosi.extra/usr/lib/systemd/system-preset/10-raspberry.preset b/device/raspberry/rpi5/mkosi.extra/usr/lib/systemd/system-preset/10-raspberry.preset new file mode 100644 index 0000000..18f0c33 --- /dev/null +++ b/device/raspberry/rpi5/mkosi.extra/usr/lib/systemd/system-preset/10-raspberry.preset @@ -0,0 +1,7 @@ +enable sshd.service +enable systemd-networkd.service +enable systemd-growfs-root.service + +# We install dnf in some images but it's only going to be used rarely, +# so let's not have dnf create its cache. +disable dnf-makecache.* diff --git a/device/raspberry/rpi5/mkosi.postinst.d/10-boot.sh b/device/raspberry/rpi5/mkosi.postinst.d/10-boot.sh new file mode 100755 index 0000000..72d1e3e --- /dev/null +++ b/device/raspberry/rpi5/mkosi.postinst.d/10-boot.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Find vmlinuz and initrd files in the /boot directory +vmlinuz_file=$(find ${BUILDROOT}/boot -name 'vmlinuz-*' -type f | head -n 1) +initrd_file=$(find ${BUILDROOT}/boot -name 'initrd-*.img' -type f | head -n 1) + +# Check if both files were found +if [[ -z "$vmlinuz_file" || -z "$initrd_file" ]]; then + printf "Error: vmlinuz or initrd files not found in /boot.\n" + exit 1 +fi + +# Extract the base names of the files (without the directory path) +kernel_name=$(basename "$vmlinuz_file") +initrd_name=$(basename "$initrd_file") + +# Append the required lines to /boot/config.txt +{ + printf "kernel=%s\n" "$kernel_name" + printf "initramfs %s followkernel\n" "$initrd_name" +} >> ${BUILDROOT}/boot/config.txt + +printf "The kernel and initrd entries have been added to /boot/config.txt.\n" diff --git a/device/raspberry/rpi5/mkosi.repart/00-boot.conf b/device/raspberry/rpi5/mkosi.repart/00-boot.conf new file mode 100644 index 0000000..9daddcc --- /dev/null +++ b/device/raspberry/rpi5/mkosi.repart/00-boot.conf @@ -0,0 +1,7 @@ +[Partition] +Type=esp +Label=bootfs +Format=vfat +CopyFiles=/boot/:/ +SizeMinBytes=256M +SizeMaxBytes=256M diff --git a/device/raspberry/rpi5/mkosi.repart/10-root.conf b/device/raspberry/rpi5/mkosi.repart/10-root.conf new file mode 100644 index 0000000..72033dd --- /dev/null +++ b/device/raspberry/rpi5/mkosi.repart/10-root.conf @@ -0,0 +1,7 @@ +[Partition] +Type=root +Label=rootfs +Format=ext4 +CopyFiles=/ +ExcludeFiles=/boot/firmware +Minimize=guess diff --git a/device/rockchip/ok3568c/mkosi.conf b/device/rockchip/ok3568c/mkosi.conf index 7bdcdc4..e9b25a5 100644 --- a/device/rockchip/ok3568c/mkosi.conf +++ b/device/rockchip/ok3568c/mkosi.conf @@ -8,9 +8,16 @@ Distribution=rosa Release=rosa13 Architecture=arm64 +[Build] +WithNetwork=yes +BuildSources=./:mkosi + ./mkosi.images/u-boot/configuration:configuration + [Output] Format=disk CompressOutput= +# nand u-boot does not support +# 4k sectors SectorSize=512 [Content] @@ -36,9 +43,3 @@ Timezone=Europe/Moscow Hostname=elara WithDocs=no CleanPackageMetadata=false - -[Build] -WithNetwork=yes - -BuildSources=./:mkosi - ./mkosi.images/u-boot/configuration:configuration