diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/appliance.kiwi b/ubuntu/aarch64/ubuntu-noble-rpi/appliance.kiwi new file mode 100644 index 0000000..e4f6f77 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/appliance.kiwi @@ -0,0 +1,75 @@ + + + + + Marcus Schäfer + marcus.schaefer@gmail.com + Disk image for RaspberryPi test build + + + 1.22.4 + apt + en_US + us + UTC + true + + + + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/config.sh b/ubuntu/aarch64/ubuntu-noble-rpi/config.sh new file mode 100644 index 0000000..92f4da7 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/config.sh @@ -0,0 +1,92 @@ +#!/bin/bash +set -ex + +#====================================== +# Functions... +#-------------------------------------- +test -f /.kconfig && . /.kconfig + +echo "Configure image: [$kiwi_iname]..." + +#====================================== +# add missing fonts +#-------------------------------------- +CONSOLE_FONT="eurlatgr.psfu" + +#====================================== +# Install firmware +#-------------------------------------- +dpkg -i /var/tmp/firmware/linux-firmware-raspi_6-0ubuntu3_arm64.deb +dpkg -i /var/tmp/firmware/linux-firmware-raspi2_6-0ubuntu3_arm64.deb + +#====================================== +# Setup default target, multi-user +#-------------------------------------- +baseSetRunlevel 3 + +# On Debian based distributions the kiwi built in way +# to setup locale, keyboard and timezone via systemd tools +# does not work because not(yet) provided by the distribution. +# Thus the following manual steps to make the values provided +# in the image description effective needs to be done. +# +#======================================= +# Setup system locale +#--------------------------------------- +echo "LANG=${kiwi_language}" > /etc/locale.conf + +#======================================= +# Setup system keymap +#--------------------------------------- +echo "KEYMAP=${kiwi_keytable}" > /etc/vconsole.conf +echo "FONT=eurlatgr.psfu" >> /etc/vconsole.conf +echo "FONT_MAP=" >> /etc/vconsole.conf +echo "FONT_UNIMAP=" >> /etc/vconsole.conf + +#======================================= +# Setup system timezone +#--------------------------------------- +rm -f /etc/localtime +ln -s /usr/share/zoneinfo/${kiwi_timezone} /etc/localtime + +#======================================= +# Setup HW clock to UTC +#--------------------------------------- +echo "0.0 0 0.0" > /etc/adjtime +echo "0" >> /etc/adjtime +echo "UTC" >> /etc/adjtime + +#====================================== +# Activate services +#-------------------------------------- +baseInsertService ssh +baseInsertService systemd-networkd +baseInsertService symlink-resolvconf +baseInsertService rpi-eeprom-update +baseInsertService systemd-timesyncd + +#====================================== +# Sysconfig Update +#-------------------------------------- +# Systemd controls the console font now +echo FONT="$CONSOLE_FONT" >> /etc/vconsole.conf + +#====================================== +# Configure Raspberry Pi specifics +#-------------------------------------- +# Add necessary kernel modules to initrd (will disappear with bsc#1084272) +echo 'add_drivers+=" bcm2835_dma dwc2 "' \ + > /etc/dracut.conf.d/raspberrypi_modules.conf + +# Work around HDMI connector bug and network issues +# No HDMI hotplug available +# Prevent too many page allocations (bsc#1012449) +cat > /etc/modprobe.d/50-rpi3.conf <<-EOF + options drm_kms_helper poll=0 + options smsc95xx turbo_mode=N +EOF + +# Avoid running out of DMA pages for smsc95xx (bsc#1012449) +cat > /usr/lib/sysctl.d/50-rpi3.conf <<-EOF + vm.min_free_kbytes = 2048 +EOF diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/editbootinstall_rpi.sh b/ubuntu/aarch64/ubuntu-noble-rpi/editbootinstall_rpi.sh new file mode 100644 index 0000000..f74fafa --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/editbootinstall_rpi.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -ex + +image_fs=$1 + +root_partnum=$2 + +root_device=/dev/mapper/loop*p${root_partnum} + +loop_name=$(basename $root_device | cut -f 1-2 -d'p') + +disk_device=/dev/${loop_name} + +#========================================== +# Change partition label type to MBR +#------------------------------------------ +# The target system doesn't support GPT, so let's move it to +# MBR partition layout instead. +# +# Also make sure to set the ESP partition to type 0xc so that +# broken firmware (Rpi) detects it as FAT. +# +# Use tabs, "<<-" strips tabs, but no other whitespace! +cat > gdisk.tmp <<-'EOF' + x + r + g + t + 1 + c + w + y + EOF +dd if=$disk_device of=mbrid.bin bs=1 skip=440 count=4 +gdisk $disk_device < gdisk.tmp +dd of=$disk_device if=mbrid.bin bs=1 seek=440 count=4 +rm -f mbrid.bin +rm -f gdisk.tmp diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/pre_disk_sync.sh b/ubuntu/aarch64/ubuntu-noble-rpi/pre_disk_sync.sh new file mode 100644 index 0000000..95bee9a --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/pre_disk_sync.sh @@ -0,0 +1,36 @@ +#!/bin/dash + +set -ex + +# copy Raspberry Pi boot data to "EFI" part... +#========================================== +# copy firmware +#------------------------------------------ +cp -a /usr/lib/linux-firmware-raspi/* /boot/efi + +#========================================== +# copy device tree's +#------------------------------------------ +cp -a /usr/lib/firmware/*-raspi/device-tree/overlays /boot/efi/ +cp -a /usr/lib/firmware/*-raspi/device-tree/broadcom/* /boot/efi/ + +#========================================== +# copy initrd and kernel +#------------------------------------------ +cp /boot/initrd-*-raspi /boot/efi/initrd.img +cp /boot/vmlinuz-*-raspi /boot/efi/vmlinuz + +#========================================== +# copy u-boot +#------------------------------------------ +cp /usr/lib/u-boot/rpi_3/u-boot.bin /boot/efi/uboot_rpi_3.bin +cp /usr/lib/u-boot/rpi_4/u-boot.bin /boot/efi/uboot_rpi_4.bin +cp /usr/lib/u-boot/rpi_arm64/u-boot.bin /boot/efi/uboot_rpi_arm64.bin + +#========================================== +# create u-boot loader config +#------------------------------------------ +echo "console=serial0,115200 dwc_otg.lpm_enable=0 console=tty1 root=LABEL=ROOT rd.kiwi.debug rootfstype=xfs rootwait fixrtc" > /boot/efi/cmdline.txt + +mkimage -A arm64 -O linux -T script -C none -d /boot/efi/boot.cmd \ + /boot/efi/boot.scr diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/boot/efi/boot.cmd b/ubuntu/aarch64/ubuntu-noble-rpi/root/boot/efi/boot.cmd new file mode 100644 index 0000000..b3768e5 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/boot/efi/boot.cmd @@ -0,0 +1,70 @@ +# Ubuntu Classic RPi U-Boot script (for armhf and arm64) + +# Expects to be called with the following environment variables set: +# +# devtype e.g. mmc/scsi etc +# devnum The device number of the given type +# distro_bootpart The partition containing the boot files +# (introduced in u-boot mainline 2016.01) +# prefix Prefix within the boot partiion to the boot files +# kernel_addr_r Address to load the kernel to +# fdt_addr_r Address to load the FDT to +# ramdisk_addr_r Address to load the initrd to. + +#Set device tree address +# Take fdt addr from the prior stage boot loader, if available +if test -n "$fdt_addr"; then + fdt addr ${fdt_addr} + fdt move ${fdt_addr} ${fdt_addr_r} # implicitly sets fdt active +else + fdt addr ${fdt_addr_r} +fi +fdt get value bootargs /chosen bootargs + +setenv bootargs " ${bootargs} quiet splash" + +if test -z "${fk_image_locations}"; then + setenv fk_image_locations ${prefix} +fi + +for pathprefix in ${fk_image_locations}; do + # Store the gzip header (1f 8b) in the kernel area for comparison to the + # header of the image we load. Load "vmlinuz" into the portion of memory for + # the RAM disk (because we want to uncompress to the kernel area if it's + # compressed) and compare the word at the start + mw.w ${kernel_addr_r} 0x8b1f # little endian + + #Loading kernel + if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${pathprefix}vmlinuz; then + kernel_size=${filesize} + + #Determine whether the kernel image is compressed + if cmp.w ${kernel_addr_r} ${ramdisk_addr_r} 1; then + # gzip compressed image (NOTE: *not* a self-extracting gzip compressed + # kernel, just a kernel image that has been gzip'd) + echo "Decompressing kernel..." + unzip ${ramdisk_addr_r} ${kernel_addr_r} + setenv kernel_size ${filesize} + setenv try_boot "booti" + else + # Possibly self-extracting or uncompressed; copy data into the kernel area + # and attempt launch with bootz then booti + echo "Copying kernel..." + cp.b ${ramdisk_addr_r} ${kernel_addr_r} ${kernel_size} + setenv try_boot "bootz booti" + fi + + #Loading the root file system + if load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${pathprefix}initrd.img; then + setenv ramdisk_param "${ramdisk_addr_r}:${filesize}" + else + setenv ramdisk_param "-" + fi + + #Boot kernel + for cmd in ${try_boot}; do + echo "Booting Ubuntu (with ${cmd}) from ${devtype} ${devnum}:${partition}..." + ${cmd} ${kernel_addr_r} ${ramdisk_param} ${fdt_addr_r} + done + fi +done diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/boot/efi/config.txt b/ubuntu/aarch64/ubuntu-noble-rpi/root/boot/efi/config.txt new file mode 100644 index 0000000..3ba1cc8 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/boot/efi/config.txt @@ -0,0 +1,43 @@ +[all] +kernel=vmlinuz +cmdline=cmdline.txt +initramfs initrd.img followkernel + +[pi4] +max_framebuffers=2 +arm_boost=1 + +[all] +# Enable the audio output, I2C and SPI interfaces on the GPIO header. As these +# parameters related to the base device-tree they must appear *before* any +# other dtoverlay= specification +dtparam=audio=on +dtparam=i2c_arm=on +dtparam=spi=on + +# Comment out the following line if the edges of the desktop appear outside +# the edges of your display +disable_overscan=1 + +# If you have issues with audio, you may try uncommenting the following line +# which forces the HDMI output into HDMI mode instead of DVI (which doesn't +# support audio output) +#hdmi_drive=2 + +# Enable the serial pins +enable_uart=1 + +# Autoload overlays for any recognized cameras or displays that are attached +# to the CSI/DSI ports. Please note this is for libcamera support, *not* for +# the legacy camera stack +camera_auto_detect=1 +display_auto_detect=1 + +# Config settings specific to arm64 +arm_64bit=1 +dtoverlay=dwc2 + +[cm4] +# Enable the USB2 outputs on the IO board (assuming your CM4 is plugged into +# such a board) +dtoverlay=dwc2,dr_mode=host diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/apt/sources.list b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/apt/sources.list new file mode 100644 index 0000000..040f4fd --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/apt/sources.list @@ -0,0 +1,42 @@ +# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to +# newer versions of the distribution. +deb http://ports.ubuntu.com/ubuntu-ports jammy main restricted +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy main restricted + +## Major bug fix updates produced after the final release of the +## distribution. +deb http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy-updates main restricted + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team. Also, please note that software in universe WILL NOT receive any +## review or updates from the Ubuntu security team. +deb http://ports.ubuntu.com/ubuntu-ports jammy universe +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy universe +deb http://ports.ubuntu.com/ubuntu-ports jammy-updates universe +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy-updates universe + +## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +## team, and may not be under a free licence. Please satisfy yourself as to +## your rights to use the software. Also, please note that software in +## multiverse WILL NOT receive any review or updates from the Ubuntu +## security team. +deb http://ports.ubuntu.com/ubuntu-ports jammy multiverse +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy multiverse +deb http://ports.ubuntu.com/ubuntu-ports jammy-updates multiverse +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy-updates multiverse + +## N.B. software from this repository may not have been tested as +## extensively as that contained in the main release, although it includes +## newer versions of some applications which may provide useful features. +## Also, please note that software in backports WILL NOT receive any review +## or updates from the Ubuntu security team. +deb http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy-backports main restricted universe multiverse + +deb http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy-security main restricted +deb http://ports.ubuntu.com/ubuntu-ports jammy-security universe +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy-security universe +deb http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse +# deb-src http://ports.ubuntu.com/ubuntu-ports jammy-security multiverse diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/default/rpi-eeprom-update b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/default/rpi-eeprom-update new file mode 100644 index 0000000..e53f962 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/default/rpi-eeprom-update @@ -0,0 +1,2 @@ +FIRMWARE_RELEASE_STATUS="default" +BOOTFS=/boot/efi diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/firstboot b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/firstboot new file mode 100644 index 0000000..e69de29 diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/sudoers b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/sudoers new file mode 100644 index 0000000..2c12b37 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/sudoers @@ -0,0 +1,90 @@ +## sudoers file. +## +## This file MUST be edited with the 'visudo' command as root. +## Failure to use 'visudo' may result in syntax or file permission errors +## that prevent sudo from running. +## +## See the sudoers man page for the details on how to write a sudoers file. +## + +## +## Host alias specification +## +## Groups of machines. These may include host names (optionally with wildcards), +## IP addresses, network numbers or netgroups. +# Host_Alias WEBSERVERS = www1, www2, www3 + +## +## User alias specification +## +## Groups of users. These may consist of user names, uids, Unix groups, +## or netgroups. +# User_Alias ADMINS = millert, dowdy, mikef + +## +## Cmnd alias specification +## +## Groups of commands. Often used to group related commands together. +# Cmnd_Alias PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \ +# /usr/bin/pkill, /usr/bin/top +# Cmnd_Alias REBOOT = /sbin/halt, /sbin/reboot, /sbin/poweroff + +## +## Defaults specification +## +## Prevent environment variables from influencing programs in an +## unexpected or harmful way (CVE-2005-2959, CVE-2005-4158, CVE-2006-0151) +Defaults always_set_home +## Path that will be used for every command run from sudo +Defaults secure_path="/usr/sbin:/usr/bin:/sbin:/bin" +Defaults env_reset +## Change env_reset to !env_reset in previous line to keep all environment variables +## Following list will no longer be nevessary after this change +Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_ATIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE" +## Comment out the preceding line and uncomment the following one if you need +## to use special input methods. This may allow users to compromise the root +## account if they are allowed to run commands without authentication. +#Defaults env_keep = "LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_ATIME LC_ALL LANGUAGE LINGUAS XDG_SESSION_COOKIE" + +## Do not insult users when they enter an incorrect password. +Defaults !insults + +## Uncomment to use a hard-coded PATH instead of the user's to find commands +Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +## +## Uncomment to send mail if the user does not enter the correct password. +# Defaults mail_badpass +## +## Uncomment to enable logging of a command's output, except for +## sudoreplay and reboot. Use sudoreplay to play back logged sessions. +# Defaults log_output +# Defaults!/usr/bin/sudoreplay !log_output +# Defaults!REBOOT !log_output + +## In the default (unconfigured) configuration, sudo asks for the root password. +## This allows use of an ordinary user account for administration of a freshly +## installed system. When configuring sudo, delete the two +## following lines: +Defaults targetpw # ask for the password of the target user i.e. root +ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'! + +## +## Runas alias specification +## + +## +## User privilege specification +## +root ALL=(ALL) ALL + +ms ALL=(ALL) NOPASSWD: ALL + +## Uncomment to allow members of group wheel to execute any command +# %wheel ALL=(ALL) ALL + +## Same thing without a password +# %wheel ALL=(ALL) NOPASSWD: ALL + +## Read drop-in files from /etc/sudoers.d +## (the '#' here does not indicate a comment) +#includedir /etc/sudoers.d diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/network/20-local.network b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/network/20-local.network new file mode 100644 index 0000000..c868f27 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/network/20-local.network @@ -0,0 +1,5 @@ +[Match] +Name=lan0 + +[Network] +DHCP=yes diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/system/symlink-resolvconf.service b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/system/symlink-resolvconf.service new file mode 100644 index 0000000..b7ada88 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/system/symlink-resolvconf.service @@ -0,0 +1,12 @@ +[Unit] +Description=Make the resolv.conf symlink during first boot +ConditionPathExists=!/etc/resolv.conf +ConditionPathExists=/etc/firstboot + +[Service] +Type=oneshot +ExecStart=/bin/ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf +ExecStartPost=/bin/rm /etc/firstboot + +[Install] +WantedBy=multi-user.target diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/timesyncd.conf b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/timesyncd.conf new file mode 100644 index 0000000..25b1c47 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/systemd/timesyncd.conf @@ -0,0 +1,2 @@ +[Time] +NTP=pool.ntp.org diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/udev/rules.d/70-persistent-net.rules b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/udev/rules.d/70-persistent-net.rules new file mode 100644 index 0000000..8865e78 --- /dev/null +++ b/ubuntu/aarch64/ubuntu-noble-rpi/root/etc/udev/rules.d/70-persistent-net.rules @@ -0,0 +1 @@ +SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="?*", NAME="lan0" diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/var/tmp/firmware/linux-firmware-raspi2_6-0ubuntu3_arm64.deb b/ubuntu/aarch64/ubuntu-noble-rpi/root/var/tmp/firmware/linux-firmware-raspi2_6-0ubuntu3_arm64.deb new file mode 100644 index 0000000..f80f9c5 Binary files /dev/null and b/ubuntu/aarch64/ubuntu-noble-rpi/root/var/tmp/firmware/linux-firmware-raspi2_6-0ubuntu3_arm64.deb differ diff --git a/ubuntu/aarch64/ubuntu-noble-rpi/root/var/tmp/firmware/linux-firmware-raspi_6-0ubuntu3_arm64.deb b/ubuntu/aarch64/ubuntu-noble-rpi/root/var/tmp/firmware/linux-firmware-raspi_6-0ubuntu3_arm64.deb new file mode 100644 index 0000000..f3057f2 Binary files /dev/null and b/ubuntu/aarch64/ubuntu-noble-rpi/root/var/tmp/firmware/linux-firmware-raspi_6-0ubuntu3_arm64.deb differ