<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Macmpi</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Macmpi"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Macmpi"/>
	<updated>2026-04-28T15:03:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31975</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31975"/>
		<updated>2026-01-19T09:57:05Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Compatibility list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2835 BCM2835] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v6] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcmrpi_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2836 BCM2836] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837A/B0, RP3A0] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v7] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2709_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 2 (rev 1.2+), 3, 3+, Zero2W, cm0, cm3, cm3+, 4, 400, cm4, 5, 500, 500+, cm5 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837A/B0, RP3A0], [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2711 BCM2711] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2712 BCM2712] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v8] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2711_defconfig])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For example with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc... (check [https://pip-assets.raspberrypi.com/categories/685-app-notes-guides-whitepapers/documents/RP-009276-WP-1-Using%20OTG%20mode%20on%20Raspberry%20Pi%20SBCs.pdf whitepaper] for detailed info)&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
* Raspberry Pi technical [https://www.raspberrypi.com/documentation/ documentation] and [https://pip.raspberrypi.com/categories/685-app-notes-guides-whitepapers whitepapers]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31972</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31972"/>
		<updated>2026-01-17T10:15:29Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* See also */ ref Pi technical documentation and whitepapers&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2835 BCM2835] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v6] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcmrpi_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2836 BCM2836] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v7] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2709_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || later Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+, 4, 400, cm4, 5, 500, 500+, cm5 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837], [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2711 BCM2711] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2712 BCM2712] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v8] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2711_defconfig])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For example with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc... (check [https://pip-assets.raspberrypi.com/categories/685-app-notes-guides-whitepapers/documents/RP-009276-WP-1-Using%20OTG%20mode%20on%20Raspberry%20Pi%20SBCs.pdf whitepaper] for detailed info)&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
* Raspberry Pi technical [https://www.raspberrypi.com/documentation/ documentation] and [https://pip.raspberrypi.com/categories/685-app-notes-guides-whitepapers whitepapers]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31971</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31971"/>
		<updated>2026-01-17T10:05:42Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* USB-gadget */ reference whitepaper&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2835 BCM2835] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v6] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcmrpi_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2836 BCM2836] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v7] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2709_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || later Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+, 4, 400, cm4, 5, 500, 500+, cm5 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837], [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2711 BCM2711] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2712 BCM2712] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v8] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2711_defconfig])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For example with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc... (check [https://pip-assets.raspberrypi.com/categories/685-app-notes-guides-whitepapers/documents/RP-009276-WP-1-Using%20OTG%20mode%20on%20Raspberry%20Pi%20SBCs.pdf whitepaper] for detailed info)&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31969</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31969"/>
		<updated>2026-01-16T15:21:50Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Compatibility list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2835 BCM2835] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v6] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcmrpi_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2836 BCM2836] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v7] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2709_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || later Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+, 4, 400, cm4, 5, 500, 500+, cm5 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837], [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2711 BCM2711] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2712 BCM2712] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v8] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2711_defconfig])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For example with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31967</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31967"/>
		<updated>2026-01-15T11:13:43Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Compatibility list */ add kernel variant&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2835 BCM2835] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v6] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcmrpi_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2836 BCM2836] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v7] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2709_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || later Pi 2, Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837], [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2711 BCM2711] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2712 BCM2712] devices with [https://www.raspberrypi.com/documentation/computers/configuration.html#kernel-files-img v8] kernel and [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2711_defconfig])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For example with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31966</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31966"/>
		<updated>2026-01-15T10:55:38Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: add bcm parts and defconfigs ref&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2835 BCM2835] devices with [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcmrpi_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2836 BCM2836] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837] devices with [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2709_defconfig])&lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || later Pi 2, Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &amp;lt;br&amp;gt;([https://www.raspberrypi.com/documentation/computers/processors.html#bcm2837 BCM2837], [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2711 BCM2711] and [https://www.raspberrypi.com/documentation/computers/processors.html#bcm2712 BCM2712] devices with [https://www.raspberrypi.com/documentation/computers/linux_kernel.html#native-build-configuration bcm2711_defconfig])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For example with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Zram&amp;diff=31945</id>
		<title>Talk:Zram</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Zram&amp;diff=31945"/>
		<updated>2026-01-11T12:32:48Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; Advanced setups may also add these parameters to /etc/sysctl.conf as follows&lt;br /&gt;
Would be nice to add more explanations and references (like [https://wiki.archlinux.org/title/Zram#Optimizing_swap_on_zram this]?).&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 12:50, 11 Jan 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Zram&amp;diff=31944</id>
		<title>Talk:Zram</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Zram&amp;diff=31944"/>
		<updated>2026-01-11T12:17:31Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: advanced settings&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt; Advanced setups may also add these parameters to /etc/sysctl.conf as follows&lt;br /&gt;
Would be nice to add more explanations and references.&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 12:50, 11 Jan 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Zram&amp;diff=31943</id>
		<title>Zram</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Zram&amp;diff=31943"/>
		<updated>2026-01-11T12:13:34Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Configuration */ add zramctl&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents how to set up [https://docs.kernel.org/admin-guide/blockdev/zram.html ZRAM] in Alpine Linux. Zram can be used as an alternative to [[Swap]] partition.&lt;br /&gt;
&lt;br /&gt;
== Installation == &lt;br /&gt;
&lt;br /&gt;
Install the neccessary packages:{{Cmd|# apk add {{pkg|zram-init}}}}&lt;br /&gt;
&lt;br /&gt;
== Configuration == &lt;br /&gt;
&lt;br /&gt;
For a basic ZRAM swap, configure ZRAM by editing the file {{path|/etc/conf.d/zram-init}} as follows:{{Cat|/etc/conf.d/zram-init|&amp;lt;nowiki&amp;gt;load_on_start=yes&lt;br /&gt;
unload_on_stop=yes&lt;br /&gt;
num_devices=1&lt;br /&gt;
type0=swap&lt;br /&gt;
size0=8000&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Advanced parameters can be found in the [https://github.com/vaeth/zram-init/blob/main/openrc/conf.d/zram-init source repo].&lt;br /&gt;
&lt;br /&gt;
Start services:{{Cmd|# rc-service zram-init start}}&lt;br /&gt;
&lt;br /&gt;
Check overall status: {{Cmd|# zramctl}}&lt;br /&gt;
&lt;br /&gt;
View the ZRAM drive:{{Cmd|# cat /proc/swaps}}&lt;br /&gt;
&lt;br /&gt;
Check Algorithms:{{Cmd|# cat /sys/block/zram0/comp_algorithm}}&lt;br /&gt;
&lt;br /&gt;
Advanced setups may also add these parameters to {{path|/etc/sysctl.conf}} as follows:{{Cat|/etc/sysctl.conf|&amp;lt;nowiki&amp;gt;vm.page-cluster=0&lt;br /&gt;
vm.extfrag_threshold=0&lt;br /&gt;
vm.swappiness=100&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To ensure that service starts during next reboot: {{Cmd|# rc-update add zram-init}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting == &lt;br /&gt;
&lt;br /&gt;
Check whether ZRAM&#039;s module is loaded: {{Cmd|# lsmod &amp;amp;#124; grep zram}}&lt;br /&gt;
&lt;br /&gt;
If not loaded, use &amp;lt;code&amp;gt;modprobe&amp;lt;/code&amp;gt; to load it: (however, it should be automatically loaded if &amp;lt;code&amp;gt;load_on_start=yes&amp;lt;/code&amp;gt; is in the configuration) {{Cmd|# modprobe zram}}&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/vaeth/zram-init/blob/main/openrc/conf.d/zram-init sample zram-init file on official website]&lt;br /&gt;
* [https://wiki.archlinux.org/title/Zram Zram in Arch Wiki]&lt;br /&gt;
* [https://en.wikipedia.org/wiki/zram Zram in Wikipedia]&lt;br /&gt;
&lt;br /&gt;
[[Category:System Administration‏‎]]&lt;br /&gt;
[[Category:Storage‏‎‏‎]]&lt;br /&gt;
[[Category:Kernel]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31775</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31775"/>
		<updated>2025-12-11T12:18:29Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Manual method */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For exemple with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31774</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31774"/>
		<updated>2025-12-11T12:15:28Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Manual method */ add cli partition/format example&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
#:For exemple with {{pkg|sfdisk}} and {{pkg|dosfstools}}: {{Cmd|&amp;lt;nowiki&amp;gt;echo &#039;start=2048, size=300M, type=c, bootable&#039; | doas sfdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&amp;lt;br&amp;gt;doas mkfs.vfat -n PIBOOT -F 32 --offset 2048 /dev/mmcblk0p1}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=31771</id>
		<title>Installation on a headless host</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Installation_on_a_headless_host&amp;diff=31771"/>
		<updated>2025-12-09T11:39:51Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Headless bootstrap overlay file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page documents an easy installation procedure for Alpine Linux on a headless host i.e a system without keyboard, mouse &amp;amp; display to interact with but otherwise available only through a network connection. Somebody has to insert the Install media and power up the headless host. This procedure applies to &#039;&#039;&#039;all&#039;&#039;&#039; platforms. &lt;br /&gt;
&lt;br /&gt;
== Headless bootstrap overlay file ==  &lt;br /&gt;
&lt;br /&gt;
The [https://github.com/macmpi/alpine-linux-headless-bootstrap Headless bootstrap] repo provides a ready-to-use overlay file to bootstrap a headless system.&lt;br /&gt;
&lt;br /&gt;
While straightforward in default use-case, many optional settings and advanced modes are detailed on repo homepage (unattended installs scripting, secured logon, ssh keys configuration, gadget-modes, etc).&lt;br /&gt;
&lt;br /&gt;
{{Note|The author of above repo macmpi also maintains a number of [https://pkgs.alpinelinux.org/packages?name{{=}}&amp;amp;branch{{=}}edge&amp;amp;repo{{=}}&amp;amp;arch{{=}}&amp;amp;maintainer{{=}}macmpi packages] for Alpine Linux.}}&lt;br /&gt;
&lt;br /&gt;
To Install Alpine Linux on a headless host, just add [https://github.com/macmpi/alpine-linux-headless-bootstrap  headless.apkovl.tar.gz] overlay file as-is (along with optional config files) at the root of [[Create a Bootable Device|customizable boot device]], or of a side media.&lt;br /&gt;
&lt;br /&gt;
If using wifi networking, create a file {{Path|wpa_supplicant.conf}} in the same location as follows:{{Cat|wpa_supplicant.conf|&amp;lt;nowiki&amp;gt;country=FR&lt;br /&gt;
&lt;br /&gt;
network={&lt;br /&gt;
	key_mgmt=WPA-PSK&lt;br /&gt;
	ssid=&amp;quot;mySSID&amp;quot;&lt;br /&gt;
	psk=&amp;quot;myPassPhrase&amp;quot;&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;}} &lt;br /&gt;
&lt;br /&gt;
Alternately, &amp;lt;code&amp;gt;wpa_passphrase&amp;lt;/code&amp;gt; utility from {{pkg|wpa_supplicant}} package can be used to create the encrypted version of the above file as follows:{{Cmd|$ wpa_passphrase &#039;mySSID&#039; &#039;myPassPhrase&#039; &amp;gt; wpa_supplicant.conf}}&lt;br /&gt;
The above encrypted version of the {{Path|wpa_supplicant.conf}} file may be placed in the same location.&lt;br /&gt;
&lt;br /&gt;
Boot the system with the above setup: usual [[Installation#Installation_Step_Details|Installation steps]] can then be performed remotely using {{ic|ssh}}&lt;br /&gt;
&lt;br /&gt;
To find the ip of your headless host, one may use the {{ic|nmap}} tool from {{pkg|nmap}} package as follows: {{Codeline|$ nmap -v -sn 192.168.1.0/24}}&lt;br /&gt;
&lt;br /&gt;
== Alternative custom install media preparation steps==&lt;br /&gt;
&lt;br /&gt;
A Custom install media for a headless host can be created using a [[Create a Bootable Device|customizable boot device]] as per the below process.&lt;br /&gt;
&lt;br /&gt;
{{Note|Instead of [[Create a Bootable Device|customizable boot device]], if a read-only boot media is used, then storing the configs require either a separate storage media or server location.}}&lt;br /&gt;
&lt;br /&gt;
* Booting the [[Create a Bootable Device|customizable boot device]] on some computer with a display and keyboard attached, or in a virtual machine, and doing an intermediate &amp;quot;diskless&amp;quot; setup of just the boot media (more details below), i.e. using the offical &amp;lt;code&amp;gt;[[Alpine_setup_scripts#setup-alpine|setup-alpine]]&amp;lt;/code&amp;gt; to configure the system&#039;s network, possibly for dhcp if needed, a ssh server, and a login user. &lt;br /&gt;
* Choosing &amp;quot;disks=none&amp;quot; for now, yet, configure to store configs on the customizable boot device. &lt;br /&gt;
* Use &amp;lt;code&amp;gt;[[Alpine_local_backup|lbu commit]]&amp;lt;/code&amp;gt; to store the configs as local backup. Then your completed setup, including its securely created own private keys, will readily get (re)loaded on every subsequent (headless) boot from your custom-build &amp;lt;code&amp;gt;&amp;lt;hostname&amp;gt;.apkovl.tar.gz&amp;lt;/code&amp;gt; stored on the customizable boot device.&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [[Create a Bootable Device|Customizable boot device page]]&lt;br /&gt;
* [[Diskless Mode#Apkovl|Diskless page with information on apkovl]] &lt;br /&gt;
* [[Alpine local backup]]&lt;br /&gt;
* [https://github.com/macmpi/alpine-linux-headless-bootstrap/ Bootstrap Alpine Linux on a headless system] using pre-built &amp;lt;code&amp;gt;apkovl&amp;lt;/code&amp;gt; overlay file.&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Docker&amp;diff=31702</id>
		<title>Docker</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Docker&amp;diff=31702"/>
		<updated>2025-12-06T12:30:35Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Docker rootless */ add info on shadow-subids and XDG_RUNTIME_DIR&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Installation ==&lt;br /&gt;
&lt;br /&gt;
The {{Pkg|docker}} package is in the &#039;&#039;community&#039;&#039; repository. See [[Repositories]] how to add a repository.&lt;br /&gt;
&lt;br /&gt;
 apk add docker&lt;br /&gt;
&lt;br /&gt;
=== Docker as root ===&lt;br /&gt;
&lt;br /&gt;
To start the Docker daemon at boot, see [[OpenRC]].&lt;br /&gt;
&lt;br /&gt;
 rc-update add docker default&lt;br /&gt;
 service docker start&lt;br /&gt;
&lt;br /&gt;
Connecting to the Docker daemon through its socket requires you to add yourself to the &amp;lt;code&amp;gt;docker&amp;lt;/code&amp;gt; group.&lt;br /&gt;
&lt;br /&gt;
 addgroup ${USER} docker&lt;br /&gt;
&lt;br /&gt;
{{Warning|Adding users to this group is equivalent to granting them full root access on the host. [https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface See upstream documentation].}}&lt;br /&gt;
&lt;br /&gt;
=== Docker rootless ===&lt;br /&gt;
&lt;br /&gt;
Docker rootless allows unprivileged users to run the docker daemon and docker containers in user namespaces. This is not the same as dockremap explained in the section below. With dockremap the daemon still runs as root.&lt;br /&gt;
&lt;br /&gt;
This requires the {{Pkg|docker-rootless-extras}} package (available in &#039;&#039;community&#039;&#039;) and enabling &amp;lt;code&amp;gt;cgroups v2&amp;lt;/code&amp;gt;:&lt;br /&gt;
edit &amp;lt;code&amp;gt;/etc/rc.conf&amp;lt;/code&amp;gt; and set &amp;lt;code&amp;gt;rc_cgroup_mode=&amp;quot;unified&amp;quot;&amp;lt;/code&amp;gt;. Then start the service on boot:&lt;br /&gt;
&lt;br /&gt;
 rc-update add cgroups default&lt;br /&gt;
&lt;br /&gt;
Additionally, install {{Pkg|shadow-subids}} package: &amp;lt;code&amp;gt;/etc/subuid&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/etc/subgid&amp;lt;/code&amp;gt; files need to be set up as explained in [https://docs.docker.com/engine/security/rootless/ the official documentation].&amp;lt;br&amp;gt;&lt;br /&gt;
Confirm [https://docs.docker.com/engine/security/rootless/tips/#advanced-usage &amp;lt;code&amp;gt;XDG_RUNTIME_DIR&amp;lt;/code&amp;gt;] environment variable (and related directory) are [[Wayland#XDG_RUNTIME_DIR|properly set]].&lt;br /&gt;
&lt;br /&gt;
Now docker can be start from an unprivileged user with&lt;br /&gt;
&lt;br /&gt;
  dockerd-rootless&lt;br /&gt;
&lt;br /&gt;
=== Docker Compose ===&lt;br /&gt;
&lt;br /&gt;
{{Pkg|docker-cli-compose}} is in the &#039;&#039;community&#039;&#039; repository starting with Alpine Linux 3.15.&lt;br /&gt;
&lt;br /&gt;
 apk add docker-cli-compose&lt;br /&gt;
&lt;br /&gt;
== Isolate containers with a user namespace ==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
adduser -SDHs /sbin/nologin dockremap&lt;br /&gt;
addgroup -S dockremap&lt;br /&gt;
echo dockremap:$(cat /etc/passwd|grep dockremap|cut -d: -f3):65536 &amp;gt;&amp;gt; /etc/subuid&lt;br /&gt;
echo dockremap:$(cat /etc/passwd|grep dockremap|cut -d: -f4):65536 &amp;gt;&amp;gt; /etc/subgid&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
add to &amp;lt;code&amp;gt;/etc/docker/daemon.json&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
{  &lt;br /&gt;
        &amp;quot;userns-remap&amp;quot;: &amp;quot;dockremap&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;You may also consider these options : &#039;&#039;&lt;br /&gt;
        &amp;quot;experimental&amp;quot;: false,&lt;br /&gt;
        &amp;quot;live-restore&amp;quot;: true,&lt;br /&gt;
        &amp;quot;ipv6&amp;quot;: false,&lt;br /&gt;
        &amp;quot;icc&amp;quot;: false,&lt;br /&gt;
        &amp;quot;no-new-privileges&amp;quot;: false&#039;&#039;&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find all possible configurations [https://docs.docker.com/engine/reference/commandline/dockerd/#daemon-configuration-file here].&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;WARNING: No {swap,memory} limit support&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
You might encounter this message when executing &amp;lt;code&amp;gt;docker info&amp;lt;/code&amp;gt;.&lt;br /&gt;
To correct this situation, we have to enable the &amp;lt;code&amp;gt;cgroup_enable=memory swapaccount=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Grub ===&lt;br /&gt;
If you use Grub, add the cgroup condition into &amp;lt;code&amp;gt;/etc/default/grub&amp;lt;/code&amp;gt;, then upgrade your grub&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;GRUB_CMDLINE_LINUX_DEFAULT=&amp;quot;... cgroup_enable=memory swapaccount=1&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Extlinux ===&lt;br /&gt;
With Extlinux, you add the cgroup condition, but inside of &amp;lt;code&amp;gt;/etc/update-extlinux.conf&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;default_kernel_opts=&amp;quot;... cgroup_enable=memory swapaccount=1&amp;quot;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then update the config and reboot&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;update-extlinux&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== How to use docker ==&lt;br /&gt;
&lt;br /&gt;
Check the [https://docs.docker.com/ official documentation] for details on general usage of docker, including creating and management of containers. Repeating these instructions here be redundant.&lt;br /&gt;
&lt;br /&gt;
Public images can be browsed at the [https://hub.docker.com/ Docker Hub]. These should also serve as further reference on the Dockerfile format.&lt;br /&gt;
&lt;br /&gt;
Official Docker image files are denoted on the website by a special badge.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [https://www.erianna.com/creating-a-alpine-linux-repository/ Creating and Hosting an Alpine Linux Package Repository for Docker Packages]&lt;br /&gt;
* [[Running Alpine in a Docker Container]]&lt;br /&gt;
* [https://wiki.archlinux.org/index.php/Docker Docker - ArchWiki]&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31663</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31663"/>
		<updated>2025-12-04T18:27:54Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Wireless drivers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/e1e78b65b350c799cb7cac49713e21c79fcf993d may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31645</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31645"/>
		<updated>2025-12-04T12:05:04Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Camera */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31644</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31644"/>
		<updated>2025-12-04T11:56:12Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Camera */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
With camera enabled in [[#Customize_config.txt_and_usercfg.txt| usercfg]] file, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used to check camera availability.&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31643</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31643"/>
		<updated>2025-12-04T11:36:37Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Customize config.txt and usercfg.txt */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, Pi firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Camera ===&lt;br /&gt;
&lt;br /&gt;
Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}. To list cameras like picam connected to pi, the command {{Codeline|$ libcamera-hello --list-cameras}} from the {{pkg|rpicam-apps|arch=}} package in the [[Repositories#Testing|testing]] repository can be used.  &lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Raspberry_Pi&amp;diff=31641</id>
		<title>Talk:Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Raspberry_Pi&amp;diff=31641"/>
		<updated>2025-12-04T11:32:51Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Picam */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Known Bugs ==&lt;br /&gt;
Added a warning since I wasted more than an hour trying to boot.&lt;br /&gt;
-- [[User:Lucid|Lucid]] Thu, 11 Feb 2021 15:01:24 -0500&lt;br /&gt;
&lt;br /&gt;
== Entropy ==&lt;br /&gt;
&lt;br /&gt;
Added a troubleshooting section since I ran into a few issues that weren&#039;t immediately obvious. I&#039;ll update the section a bit more later but for the entropy issue I haven&#039;t yet found a good solution (appropriate package? haveged with runlevel default didn&#039;t help) so put in the best short term fix I could find for now.&lt;br /&gt;
&lt;br /&gt;
It might be a good idea to add a note about tmpfs being ram-limited. On a 3A+ only ~200M is available for / on a basic installation which severely limits the amount of packages that can be installed.&lt;br /&gt;
&lt;br /&gt;
== Persistence ==&lt;br /&gt;
Wouldn&#039;t it be more reasonable to partition the SD-Card accordingly? That way, you could have FS &amp;gt; 2GB, too. --[[User:Kurushiyama|Kurushiyama]] ([[User talk:Kurushiyama|talk]]) 10:53, 8 October 2016 (UTC)&lt;br /&gt;
&lt;br /&gt;
I have read that using a journalling fs is not a good idea for SD cards as it shortens their life by multiplying the read/writes. Wouldn&#039;t ext2 thus be a better fs for persistent overlays? -- [[User:Nevarmaor|Nevarmaor]] ([[User talk:Nevarmaor|talk]]) 21:56, 20 February 2017 (UTC)&lt;br /&gt;
&lt;br /&gt;
Having burned holes in far too many SD Cards I&#039;m writing up some notes to setup a persistent storage running off of [https://en.wikipedia.org/wiki/F2FS F2FS]. I think that should be the default.&lt;br /&gt;
-- [[User:Lucid|Lucid]] Thu, 11 Feb 2021 15:01:24 -0500&lt;br /&gt;
&lt;br /&gt;
== Installing Alpine- Linux on raspberry pi zero w (udhcpc fail problem) ==&lt;br /&gt;
&lt;br /&gt;
The existing tutorial for raspberry pi is followed except on the reboot, the udhcpc attempts to connect and fails. I managed to fix this problem by editing the /etc/network/interfaces file and add the line:&lt;br /&gt;
&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
   pre-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf #&amp;lt;--This is the line added to pre-start the wpa_supplicant daemon and log on correctly. &lt;br /&gt;
&lt;br /&gt;
I learned this with the help of the tutorial by Jack Wallen: How to Configure Wireless... on linux.com website&lt;br /&gt;
&lt;br /&gt;
== Which version should I use? ==&lt;br /&gt;
&lt;br /&gt;
There are now three versions of Alpine to choose from (armv7, armhf, aarch64), it might be useful to have a table indicating which version is supported on which hardware. (I&#039;m already unclear on why armv7 and armhf, I assume both are 32 bits and armv7 has soft-float-point instead of hard-float-point, but don&#039;t all RPi devices have hard-float-point capabilities? It would be useful to have a little text about this.)&lt;br /&gt;
&lt;br /&gt;
As I understand aarch64 only applies to BCM2837 and above chips (ARMv8 and above), which means it can only run on RPi 3 and above (but I believe RPi 3 and above should be able to use the other images since they also support the 32 bits mode).&lt;br /&gt;
&lt;br /&gt;
Conversely I assume armhf should be usable on all RPi.&lt;br /&gt;
&lt;br /&gt;
== New Install on RPi Zero W ==&lt;br /&gt;
&lt;br /&gt;
I finally got my Pi Zero W installation done and encountered during setup and subsequent boots very sketchy network performance in the form of very high packet loss.  I overcame this by switching from static IP address (which seemed to break networking scripts) to dhcp by editing the /etc/network/interfaces file.  I also edited the /etc/wpa_supplicant/wpa_supplicant.conf file using vi to delete duplicated entries which accumulated while trying to get a decent network connection via wireless. &lt;br /&gt;
&lt;br /&gt;
I then went on to try to install the software which is the purpose of using Alpine for me, mosquitto.  This had me stumped as I am using armhf, V3.12, have the 3.12 main, community, edge main and community and testing repos and can see mosquito and mosquito-clients packages in the repository listing but consistently get errors on install.  I tried to resolve dependencies by hand via installation on required packages with the result I can install some but not all of these packages.  I can install other software such as sshd and nmap but get an almost meaningless to me error about unsatisfiable contraints, mosquito (missing), which I am guessing means it is not really in the repo or the entry in the repo does not work.  &lt;br /&gt;
&lt;br /&gt;
This is an added comment about overlooking the obvious - I was mispelling mosquitto (yes, I was trying to install something I typed as mosquito, missing one &#039;t&#039;).  It worked much better with the correct spelling and now I can take back most of those things I was saying about the maintainer of the repo.  &lt;br /&gt;
&lt;br /&gt;
I notice no activity on these wiki pages for over a year.  Anybody actually use this section of the Wiki?&lt;br /&gt;
&lt;br /&gt;
== Proposal: Consolidating Disk Installation Materials ==&lt;br /&gt;
It looks like the material on disk-based installation is currently spread between this page and another dedicated page [[Classic install or sys mode on Raspberry Pi|sys-mode install page]]. I would like to propose merging it with the sys-install instructions, so there&#039;s only one copy. That will lower the maintenance burden when the procedure changes. --[[User:Etothepii|Etothepii]] June 27, 2021.&lt;br /&gt;
&lt;br /&gt;
== OTG mode on Pi CM4 ==&lt;br /&gt;
On Pi Compute Module 4 with I/O board, it seems to be necessary to set: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;. This is due to the way it&#039;s wired as far as I can tell and the setting is present in stock Raspberry PI OS config file. I&#039;ve updated the preparation section accordingly.&lt;br /&gt;
&lt;br /&gt;
== Moving content around ==&lt;br /&gt;
&lt;br /&gt;
The way content was sorted on the page was not ideal. First there&#039;s preparation steps, followed by installation steps. But along with the first installation steps, there&#039;s an explanation that this process will install Alpine in diskless mode and the implications of this. It&#039;s not ideal to explain what we&#039;re doing halfway through the process.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve moved this explanation to the top, so that people can understand what they&#039;re doing and decide the right process before going through half the steps. Hopefully, this&#039;ll result in content in this page being in a more intuitive order.&lt;br /&gt;
&lt;br /&gt;
Please let me know if you have any comments on this. [[User:WhyNotHugo|WhyNotHugo]] ([[User talk:WhyNotHugo|talk]]) 14:09, 20 December 2022 (UTC)&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Note: Raspberry Pi Imager will create ... you may want to grow that partition afterwards&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;gt; Raspberry Pi Imager will create a minimum-sized FAT32 partition with only about 8MB of free space. If you need a bigger partition (i.e. with more available room for diskless packages cache and config files), you may want to grow that partition afterwards.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s worth pointing out that rpi-imager creates neither a partition nor can you grow it afterwards.&lt;br /&gt;
&lt;br /&gt;
rpi-imager creates this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ parted -l&lt;br /&gt;
Model: Generic STORAGE DEVICE (scsi)&lt;br /&gt;
Disk /dev/sdb: 3965MB&lt;br /&gt;
Sector size (logical/physical): 512B/512B&lt;br /&gt;
Partition Table: loop&lt;br /&gt;
Disk Flags: &lt;br /&gt;
&lt;br /&gt;
Number  Start  End     Size    File system  Flags&lt;br /&gt;
 1      0.00B  3965MB  3965MB  fat16&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can&#039;t create a second partition or grow this partition, as it is not a partition. It should be possible to grow the filesystem on the device, but fatresize refuses to do so, as it tries to fix the non-existing partition table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sudo fatresize -s 1G -f /dev/sdb1&lt;br /&gt;
fatresize 1.1.0 (20250116)&lt;br /&gt;
part(start=0, end=7744511, length=7744512)&lt;br /&gt;
No Implementation: GNU Parted cannot resize this partition to this size.  We&#039;re working on it!&lt;br /&gt;
$ sudo fatresize -s 1G -f /dev/sdb&lt;br /&gt;
fatresize 1.1.0 (20250116)&lt;br /&gt;
part(start=0, end=7744511, length=7744512)&lt;br /&gt;
No Implementation: GNU Parted cannot resize this partition to this size.  We&#039;re working on it!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with current versions of rpi-imager at least you really actually can&#039;t install Alpine Linux. --[[User:Enkore|Enkore]] ([[User talk:Enkore|talk]]) 15:54, 26 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Note: ... you may want to grow that partition afterwards&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;gt; It&#039;s worth pointing out that rpi-imager creates neither a partition nor can you grow it afterwards.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This may be a bit of an overstatement (ref [[Raspberry_Pi#Resize_partition_created_with_image_file|workaround]], [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17561#note_547712 issue] &amp;amp; [https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/91195 fix]).&amp;lt;br&amp;gt;&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 13:50, 11 October 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful ERASE_DISKS variable ==&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In most cases the desired installation disk will be the same as the live install media. In most cases setup-disk will prompt asking to install to the install media. In some cases, such as if the install media is not the only disk present, it may be necessary to manually specify it by running:&lt;br /&gt;
&lt;br /&gt;
 ERASE_DISKS=/dev/mmcblk0 setup-disk -m sys /dev/mmcblk0&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thank you for your useful contribution, [[User:Spubby|Spubby]], as this can help users to implement a very useful, fully non-interactive {{ic|setup-disk}} process when using an answerfile for {{ic|setup-alpine}}, confirmed in Issue {{Issue|10549}}.  Although this &#039;&#039;&#039;Raspberry Pi&#039;&#039;&#039; wiki page does not deal with answerfiles, your tip has been reworked into that [[Using_an_answerfile_with_setup-alpine#Answerfile_Variables|answerfile wiki]]!  That page has been proposed to [[Talk:Using_an_answerfile_with_setup-alpine| be moved]], notwithstanding.  Thanks also for your helpful point earlier about [[WirePlumber]] requiring udev for ALSA device discovery, which now appears in the Prerequisites section!  Please continue your help! - [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 08:39, 28 November 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Picam ==&lt;br /&gt;
Few comments on this section:&lt;br /&gt;
* I added information in &amp;lt;code&amp;gt;usercfg&amp;lt;/code&amp;gt; section for camera detection/setup. &lt;br /&gt;
* Is &amp;lt;code&amp;gt;udev&amp;lt;/code&amp;gt; really required? If is really specific to package (if so, an issue may need to be opened against the package so that a dependency is added)?&lt;br /&gt;
* If there are no more specific bugs/workarounds needed with this package, it pretty much is a standard package install procedure, so unsure we should keep that dedicated section overall.&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 11:30, 04 December 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31639</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31639"/>
		<updated>2025-12-04T11:29:09Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Customize config.txt and usercfg.txt */ camera detection&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* To use a camera, firmware can try to load adequate driver overlay if [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect &amp;lt;code&amp;gt;camera_auto_detect=1&amp;lt;/code&amp;gt;] is set. If failing, set &amp;lt;code&amp;gt;camera_auto_detect=0&amp;lt;/code&amp;gt; and explicitly add [https://www.raspberrypi.com/documentation/computers/camera_software.html#configuration relevant overlay for camera].&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Test the picam using the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Raspberry_Pi&amp;diff=31637</id>
		<title>Talk:Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Raspberry_Pi&amp;diff=31637"/>
		<updated>2025-12-04T11:05:51Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Known Bugs ==&lt;br /&gt;
Added a warning since I wasted more than an hour trying to boot.&lt;br /&gt;
-- [[User:Lucid|Lucid]] Thu, 11 Feb 2021 15:01:24 -0500&lt;br /&gt;
&lt;br /&gt;
== Entropy ==&lt;br /&gt;
&lt;br /&gt;
Added a troubleshooting section since I ran into a few issues that weren&#039;t immediately obvious. I&#039;ll update the section a bit more later but for the entropy issue I haven&#039;t yet found a good solution (appropriate package? haveged with runlevel default didn&#039;t help) so put in the best short term fix I could find for now.&lt;br /&gt;
&lt;br /&gt;
It might be a good idea to add a note about tmpfs being ram-limited. On a 3A+ only ~200M is available for / on a basic installation which severely limits the amount of packages that can be installed.&lt;br /&gt;
&lt;br /&gt;
== Persistence ==&lt;br /&gt;
Wouldn&#039;t it be more reasonable to partition the SD-Card accordingly? That way, you could have FS &amp;gt; 2GB, too. --[[User:Kurushiyama|Kurushiyama]] ([[User talk:Kurushiyama|talk]]) 10:53, 8 October 2016 (UTC)&lt;br /&gt;
&lt;br /&gt;
I have read that using a journalling fs is not a good idea for SD cards as it shortens their life by multiplying the read/writes. Wouldn&#039;t ext2 thus be a better fs for persistent overlays? -- [[User:Nevarmaor|Nevarmaor]] ([[User talk:Nevarmaor|talk]]) 21:56, 20 February 2017 (UTC)&lt;br /&gt;
&lt;br /&gt;
Having burned holes in far too many SD Cards I&#039;m writing up some notes to setup a persistent storage running off of [https://en.wikipedia.org/wiki/F2FS F2FS]. I think that should be the default.&lt;br /&gt;
-- [[User:Lucid|Lucid]] Thu, 11 Feb 2021 15:01:24 -0500&lt;br /&gt;
&lt;br /&gt;
== Installing Alpine- Linux on raspberry pi zero w (udhcpc fail problem) ==&lt;br /&gt;
&lt;br /&gt;
The existing tutorial for raspberry pi is followed except on the reboot, the udhcpc attempts to connect and fails. I managed to fix this problem by editing the /etc/network/interfaces file and add the line:&lt;br /&gt;
&lt;br /&gt;
iface wlan0 inet dhcp&lt;br /&gt;
   pre-up wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf #&amp;lt;--This is the line added to pre-start the wpa_supplicant daemon and log on correctly. &lt;br /&gt;
&lt;br /&gt;
I learned this with the help of the tutorial by Jack Wallen: How to Configure Wireless... on linux.com website&lt;br /&gt;
&lt;br /&gt;
== Which version should I use? ==&lt;br /&gt;
&lt;br /&gt;
There are now three versions of Alpine to choose from (armv7, armhf, aarch64), it might be useful to have a table indicating which version is supported on which hardware. (I&#039;m already unclear on why armv7 and armhf, I assume both are 32 bits and armv7 has soft-float-point instead of hard-float-point, but don&#039;t all RPi devices have hard-float-point capabilities? It would be useful to have a little text about this.)&lt;br /&gt;
&lt;br /&gt;
As I understand aarch64 only applies to BCM2837 and above chips (ARMv8 and above), which means it can only run on RPi 3 and above (but I believe RPi 3 and above should be able to use the other images since they also support the 32 bits mode).&lt;br /&gt;
&lt;br /&gt;
Conversely I assume armhf should be usable on all RPi.&lt;br /&gt;
&lt;br /&gt;
== New Install on RPi Zero W ==&lt;br /&gt;
&lt;br /&gt;
I finally got my Pi Zero W installation done and encountered during setup and subsequent boots very sketchy network performance in the form of very high packet loss.  I overcame this by switching from static IP address (which seemed to break networking scripts) to dhcp by editing the /etc/network/interfaces file.  I also edited the /etc/wpa_supplicant/wpa_supplicant.conf file using vi to delete duplicated entries which accumulated while trying to get a decent network connection via wireless. &lt;br /&gt;
&lt;br /&gt;
I then went on to try to install the software which is the purpose of using Alpine for me, mosquitto.  This had me stumped as I am using armhf, V3.12, have the 3.12 main, community, edge main and community and testing repos and can see mosquito and mosquito-clients packages in the repository listing but consistently get errors on install.  I tried to resolve dependencies by hand via installation on required packages with the result I can install some but not all of these packages.  I can install other software such as sshd and nmap but get an almost meaningless to me error about unsatisfiable contraints, mosquito (missing), which I am guessing means it is not really in the repo or the entry in the repo does not work.  &lt;br /&gt;
&lt;br /&gt;
This is an added comment about overlooking the obvious - I was mispelling mosquitto (yes, I was trying to install something I typed as mosquito, missing one &#039;t&#039;).  It worked much better with the correct spelling and now I can take back most of those things I was saying about the maintainer of the repo.  &lt;br /&gt;
&lt;br /&gt;
I notice no activity on these wiki pages for over a year.  Anybody actually use this section of the Wiki?&lt;br /&gt;
&lt;br /&gt;
== Proposal: Consolidating Disk Installation Materials ==&lt;br /&gt;
It looks like the material on disk-based installation is currently spread between this page and another dedicated page [[Classic install or sys mode on Raspberry Pi|sys-mode install page]]. I would like to propose merging it with the sys-install instructions, so there&#039;s only one copy. That will lower the maintenance burden when the procedure changes. --[[User:Etothepii|Etothepii]] June 27, 2021.&lt;br /&gt;
&lt;br /&gt;
== OTG mode on Pi CM4 ==&lt;br /&gt;
On Pi Compute Module 4 with I/O board, it seems to be necessary to set: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;. This is due to the way it&#039;s wired as far as I can tell and the setting is present in stock Raspberry PI OS config file. I&#039;ve updated the preparation section accordingly.&lt;br /&gt;
&lt;br /&gt;
== Moving content around ==&lt;br /&gt;
&lt;br /&gt;
The way content was sorted on the page was not ideal. First there&#039;s preparation steps, followed by installation steps. But along with the first installation steps, there&#039;s an explanation that this process will install Alpine in diskless mode and the implications of this. It&#039;s not ideal to explain what we&#039;re doing halfway through the process.&lt;br /&gt;
&lt;br /&gt;
I&#039;ve moved this explanation to the top, so that people can understand what they&#039;re doing and decide the right process before going through half the steps. Hopefully, this&#039;ll result in content in this page being in a more intuitive order.&lt;br /&gt;
&lt;br /&gt;
Please let me know if you have any comments on this. [[User:WhyNotHugo|WhyNotHugo]] ([[User talk:WhyNotHugo|talk]]) 14:09, 20 December 2022 (UTC)&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Note: Raspberry Pi Imager will create ... you may want to grow that partition afterwards&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;gt; Raspberry Pi Imager will create a minimum-sized FAT32 partition with only about 8MB of free space. If you need a bigger partition (i.e. with more available room for diskless packages cache and config files), you may want to grow that partition afterwards.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It&#039;s worth pointing out that rpi-imager creates neither a partition nor can you grow it afterwards.&lt;br /&gt;
&lt;br /&gt;
rpi-imager creates this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ parted -l&lt;br /&gt;
Model: Generic STORAGE DEVICE (scsi)&lt;br /&gt;
Disk /dev/sdb: 3965MB&lt;br /&gt;
Sector size (logical/physical): 512B/512B&lt;br /&gt;
Partition Table: loop&lt;br /&gt;
Disk Flags: &lt;br /&gt;
&lt;br /&gt;
Number  Start  End     Size    File system  Flags&lt;br /&gt;
 1      0.00B  3965MB  3965MB  fat16&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can&#039;t create a second partition or grow this partition, as it is not a partition. It should be possible to grow the filesystem on the device, but fatresize refuses to do so, as it tries to fix the non-existing partition table:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ sudo fatresize -s 1G -f /dev/sdb1&lt;br /&gt;
fatresize 1.1.0 (20250116)&lt;br /&gt;
part(start=0, end=7744511, length=7744512)&lt;br /&gt;
No Implementation: GNU Parted cannot resize this partition to this size.  We&#039;re working on it!&lt;br /&gt;
$ sudo fatresize -s 1G -f /dev/sdb&lt;br /&gt;
fatresize 1.1.0 (20250116)&lt;br /&gt;
part(start=0, end=7744511, length=7744512)&lt;br /&gt;
No Implementation: GNU Parted cannot resize this partition to this size.  We&#039;re working on it!&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with current versions of rpi-imager at least you really actually can&#039;t install Alpine Linux. --[[User:Enkore|Enkore]] ([[User talk:Enkore|talk]]) 15:54, 26 August 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== &amp;quot;Note: ... you may want to grow that partition afterwards&amp;quot; ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;gt; It&#039;s worth pointing out that rpi-imager creates neither a partition nor can you grow it afterwards.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
This may be a bit of an overstatement (ref [[Raspberry_Pi#Resize_partition_created_with_image_file|workaround]], [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17561#note_547712 issue] &amp;amp; [https://gitlab.alpinelinux.org/alpine/aports/-/merge_requests/91195 fix]).&amp;lt;br&amp;gt;&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 13:50, 11 October 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful ERASE_DISKS variable ==&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
In most cases the desired installation disk will be the same as the live install media. In most cases setup-disk will prompt asking to install to the install media. In some cases, such as if the install media is not the only disk present, it may be necessary to manually specify it by running:&lt;br /&gt;
&lt;br /&gt;
 ERASE_DISKS=/dev/mmcblk0 setup-disk -m sys /dev/mmcblk0&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thank you for your useful contribution, [[User:Spubby|Spubby]], as this can help users to implement a very useful, fully non-interactive {{ic|setup-disk}} process when using an answerfile for {{ic|setup-alpine}}, confirmed in Issue {{Issue|10549}}.  Although this &#039;&#039;&#039;Raspberry Pi&#039;&#039;&#039; wiki page does not deal with answerfiles, your tip has been reworked into that [[Using_an_answerfile_with_setup-alpine#Answerfile_Variables|answerfile wiki]]!  That page has been proposed to [[Talk:Using_an_answerfile_with_setup-alpine| be moved]], notwithstanding.  Thanks also for your helpful point earlier about [[WirePlumber]] requiring udev for ALSA device discovery, which now appears in the Prerequisites section!  Please continue your help! - [[User:John3-16|John3-16]] ([[User talk:John3-16|talk]]) 08:39, 28 November 2025 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Picam ==&lt;br /&gt;
Few comments on this section:&lt;br /&gt;
* Is &amp;lt;code&amp;gt;udev&amp;lt;/code&amp;gt; really required? Does that relate to [https://www.raspberrypi.com/documentation/computers/config_txt.html#camera_auto_detect camera_auto_detect] configuration feature (with specific rules probably not available in Alpine&#039;s udev packages anyway), or is really specific to package (if so, an issue may need to be opened against the package so that a dependency is added)?&lt;br /&gt;
* If there are no more specific bugs/workarounds needed with this package, it pretty much is a standard package install procedure, so unsure we should keep that dedicated section overall.&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31633</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31633"/>
		<updated>2025-12-04T10:18:55Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Resize partition created with image file */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;printf &#039;%s\n&#039; d n p 1 2048 +127M t 06 x b 0 r w | doas fdisk /dev/mmcblk0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31632</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31632"/>
		<updated>2025-12-04T08:39:22Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Resize partition created with image file */ simplify from 3.23&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Since Alpine 3.23, media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can have partitions seamlessly resized with &amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools (mind a [https://gitlab.gnome.org/GNOME/gparted/-/issues/298 &amp;lt;code&amp;gt;gparted&amp;lt;/code&amp;gt; bug] if partition gets converted into FAT32 in the process).&lt;br /&gt;
&lt;br /&gt;
On pre-3.23 releases, media can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up-to maximum 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data, e.g. with following script (128MB size):&lt;br /&gt;
{{Cmd|printf &amp;quot;d\nn\np\n1\n2048\n+127M\nt\n06\nx\nb\n0\nr\nw\n&amp;quot; &amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt; doas fdisk /dev/mmcblk0&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/mmcblk0}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31630</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31630"/>
		<updated>2025-12-04T08:11:41Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Manual method */ update wording&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 partition. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31629</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31629"/>
		<updated>2025-12-04T08:08:30Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: cm0 supported from 3.23&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm0, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm0, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31587</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31587"/>
		<updated>2025-12-02T07:53:49Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Linux Kernel Graphics Modes */ add reference&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is [https://forums.raspberrypi.com/viewtopic.php?t=317511#p1900440 recommended for most devices]: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Using_an_answerfile_with_setup-alpine&amp;diff=31562</id>
		<title>Talk:Using an answerfile with setup-alpine</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Using_an_answerfile_with_setup-alpine&amp;diff=31562"/>
		<updated>2025-11-28T17:38:21Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: Created page with &amp;quot;This page content should probably be better linked/referenced with main setup-alpine page.&amp;lt;br&amp;gt; Some content is somehow redundant (sub-setup scripts and help text) and MACRO parameters [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10549 export passing] hint could be explained.&amp;lt;br&amp;gt; Macmpi (talk) 17:35, 28 November 2025 (UTC)&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page content should probably be better linked/referenced with main [[setup-alpine]] page.&amp;lt;br&amp;gt;&lt;br /&gt;
Some content is somehow redundant (sub-setup scripts and help text) and MACRO parameters [https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10549 export passing] hint could be explained.&amp;lt;br&amp;gt;&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 17:35, 28 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31561</id>
		<title>User talk:Spubby</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31561"/>
		<updated>2025-11-28T17:12:57Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi,&lt;br /&gt;
Sorry had to revert your change on Pi install, as that note was confusing in this place, and may probably need to be discussed elsewhere (like in [[setup-alpine]] pages, or similar). Once 3.23 is released, &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; help text may be added there, and it will explain &amp;lt;code&amp;gt;ERASE_DISKS&amp;lt;/code&amp;gt; use for any platform.&amp;lt;br&amp;gt;&lt;br /&gt;
Hope this helps understanding.&amp;lt;br&amp;gt;&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 17:10, 28 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31560</id>
		<title>User talk:Spubby</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31560"/>
		<updated>2025-11-28T17:11:32Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi,&lt;br /&gt;
Sorry had to revert your change on Pi install, as that note was confusing in this place, and may probably need to be discussed elsewhere (like in [[setup-alpine]] pages). once 3.23 will be released, setup-disk help text may be added there, and it will explain ERASE_DISKS use.&amp;lt;br&amp;gt;&lt;br /&gt;
Hope this helps understanding.&amp;lt;br&amp;gt;&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 17:10, 28 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31559</id>
		<title>User talk:Spubby</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31559"/>
		<updated>2025-11-28T17:10:56Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi,&lt;br /&gt;
Sorry had to revert your change on Pi install, as that note was confusing in this place, and may probably need to be discussed elsewhere (like in [[setup-alpine]] pages). once 3.23 will be released, setup-disk help text may be added there, and it will explain ERASE_DISKS function.&amp;lt;br&amp;gt;&lt;br /&gt;
Hope this helps understanding.&amp;lt;br&amp;gt;&lt;br /&gt;
[[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 17:10, 28 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31558</id>
		<title>User talk:Spubby</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=User_talk:Spubby&amp;diff=31558"/>
		<updated>2025-11-28T17:08:49Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: Created page with &amp;quot;Hi, Sorry had to revert your change on Pi install, as that note was confusing in this place, and may probably need to be discussed elsewhere (like in setup-alpine pages). once 3.23 will be released, setup-disk help text may be added there, and it will explain ERASE_DISKS function.&amp;lt;br&amp;gt; Hope this helps understanding.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Hi,&lt;br /&gt;
Sorry had to revert your change on Pi install, as that note was confusing in this place, and may probably need to be discussed elsewhere (like in [[setup-alpine]] pages). once 3.23 will be released, setup-disk help text may be added there, and it will explain ERASE_DISKS function.&amp;lt;br&amp;gt;&lt;br /&gt;
Hope this helps understanding.&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31557</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31557"/>
		<updated>2025-11-28T17:03:05Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: Undo revision 31556 by Spubby (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31538</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31538"/>
		<updated>2025-11-27T12:39:00Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Installation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually beforehand).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31537</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31537"/>
		<updated>2025-11-27T12:04:28Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: new section on serial ports&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Serial ports &amp;amp; console ===&lt;br /&gt;
Depending on Pi devices and &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; configurations, different &#039;&#039;UART&#039;&#039;s may be configured: refer to [https://www.raspberrypi.com/documentation/computers/configuration.html#configure-uarts devices documentation] for details.&amp;lt;br&amp;gt;&lt;br /&gt;
Usually &amp;lt;code&amp;gt;/dev/ttyAMA0&amp;lt;/code&amp;gt; maps into first &amp;lt;code&amp;gt;PL011&amp;lt;/code&amp;gt; (on GPIOs), and if activated, &amp;lt;code&amp;gt;/dev/ttyS0&amp;lt;/code&amp;gt; into so-called [https://www.raspberrypi.com/documentation/computers/configuration.html#mini-uart-and-cpu-core-frequency &amp;lt;code&amp;gt;mini UART&amp;lt;/code&amp;gt;] (has some limitations).&lt;br /&gt;
&lt;br /&gt;
Alpine does not setup [https://github.com/RPi-Distro/raspberrypi-sys-mods/blob/pios/trixie/usr/lib/udev/rules.d/99-com.rules PiOS&#039;s specific symlinks] &amp;lt;code&amp;gt;/dev/serial0&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;/dev/serial1&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Change &amp;lt;code&amp;gt;console=&amp;lt;/code&amp;gt; parameter from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; to desired serial port to set it as kernel console (may block or delay boot if improperly set).&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31536</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31536"/>
		<updated>2025-11-27T08:11:19Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Installation */ mention date issue for setup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&amp;lt;br&amp;gt;&lt;br /&gt;
(As most Pi devices do not have RTC, make sure to add a NTP service during &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; or set date manually).&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31521</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31521"/>
		<updated>2025-11-21T15:24:54Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Fine-tuned support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;&#039;&#039;&#039;supported kernels&#039;&#039;&#039;&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31520</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31520"/>
		<updated>2025-11-21T15:24:11Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Fine-tuned support */ add Pi-specific package info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Several Pi-specific {{pkg|raspberrypi-*|arch=}} packages are provided to further tune support: some are installed by default within supported Pi releases, some others are optional from &amp;lt;code&amp;gt;community&amp;lt;/code&amp;gt; repo.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31414</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31414"/>
		<updated>2025-11-05T19:07:19Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Fine-tuned support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with few [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31413</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31413"/>
		<updated>2025-11-05T19:02:14Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Fine-tuned support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/main/linux-lts generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31412</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31412"/>
		<updated>2025-11-05T18:59:26Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Fine-tuned support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro [https://gitlab.alpinelinux.org/alpine/aports/-/tree/master/community/linux-stable generic defconfigs]&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31411</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31411"/>
		<updated>2025-11-05T18:54:16Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Fine-tuned support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Other available [[Kernels|generic kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro generic defconfigs&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31410</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31410"/>
		<updated>2025-11-05T18:47:23Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Fine-tuned support */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; packaged kernels are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Other [[Kernels|available kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro generic defconfigs&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31409</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31409"/>
		<updated>2025-11-05T18:45:40Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: rewording on kernels&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
!Port !!  Raspberry Pi Models &lt;br /&gt;
|-&lt;br /&gt;
|armhf ||  Pi 1, Zero, ZeroW, cm1 &lt;br /&gt;
|-&lt;br /&gt;
|armv7 || Pi 2, 3, 3+, Zero2W, cm3, cm3+ &lt;br /&gt;
|-&lt;br /&gt;
| aarch64 || Pi 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Fine-tuned support ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; package kernels are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
These kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and [https://gitlab.alpinelinux.org/alpine/aports/-/blob/9ad68e613f9fa26d184f5b8d21fa679fca15e8e0/main/linux-rpi/APKBUILD#L68-70 defconfigs]&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect features parity with PiOS shipped kernels.&lt;br /&gt;
&lt;br /&gt;
The {{pkg|linux-firmware|arch=}} package bundles {{pkg|linux-firmware-brcm|arch=}}  containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
&lt;br /&gt;
Other [[Kernels|available kernels]] like &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; are built from upstream with &#039;&#039;Alpine&#039;s distro generic defconfigs&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected Pi device features, and may require different/additional configurations steps and are &#039;&#039;&#039;unsupported&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Include:Arm_support_matrix&amp;diff=31400</id>
		<title>Include:Arm support matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Include:Arm_support_matrix&amp;diff=31400"/>
		<updated>2025-11-05T14:56:59Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: armhf is Pi only (link there)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Do not add heading(s) or content unrelated to this topic as the table below is transcluded in multiple pages. The &amp;lt;noinclude&amp;gt; and &amp;lt;/noinclude&amp;gt; tags help to view this page properly when editing.--&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; |Alpine Linux Hardware Support Matrix&lt;br /&gt;
|-&lt;br /&gt;
! Architecture !! Port !! Description !! Since&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; |[[:Category:ARM|ARM]] || [[Raspberry Pi|armhf]] || 32 bit ARM with hard-float ABI - for ARMv6 devices - [[Raspberry Pi]] 1, Zero, ZeroW, cm1 (&#039;&#039;defconfig bcmrpi&#039;&#039;) || v3.0&lt;br /&gt;
|-&lt;br /&gt;
|  | [[Alpine on ARM|armv7]] || 32 bit ARM - for ARMv7 devices (including [[Raspberry Pi]] 2, 3, 3+, Zero2W, cm3, cm3+ with &#039;&#039;defconfig bcm2709&#039;&#039;) || v3.9&lt;br /&gt;
|-&lt;br /&gt;
|  | [[Alpine on ARM|aarch64]] || 64 bit ARM - for ARMv8+ devices (including [[Raspberry Pi]] 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 with &#039;&#039;defconfig bcm2711&#039;&#039;) || v3.5&lt;br /&gt;
&amp;lt;noinclude&amp;gt;|}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Include:Arm_support_matrix&amp;diff=31398</id>
		<title>Talk:Include:Arm support matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Include:Arm_support_matrix&amp;diff=31398"/>
		<updated>2025-11-05T14:47:43Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In fact this matrix mixes 2 dimensions (hardware and kernel builds) which may be a bit confusing from non-Pi ARM users.&amp;lt;br&amp;gt;&lt;br /&gt;
Indeed armv7/aarch64 hardware is supported by several kernels: generic upstream (linux-lts/linux-stable) like for all other hardware platforms, and custom Pi (linux-rpi with Pi foundation downstream patches and defconfigs). For armhf it&#039;s only Pi.&amp;lt;br&amp;gt;&lt;br /&gt;
The matrix as it stands may lead to think ARM is for Pi only, which it is not.&amp;lt;br&amp;gt;&lt;br /&gt;
Maybe we should have 2 different matrices: one only on HW for main page (just CPU cores, not talking about defconfigs), and another one on Pi Page that dives into the Pi specific models and defconfigs.&amp;lt;br&amp;gt;&lt;br /&gt;
Thoughts (made few tweaks to hopefully clarify)? [[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 14:48, 05 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Include:Arm_support_matrix&amp;diff=31397</id>
		<title>Include:Arm support matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Include:Arm_support_matrix&amp;diff=31397"/>
		<updated>2025-11-05T14:45:21Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Do not add heading(s) or content unrelated to this topic as the table below is transcluded in multiple pages. The &amp;lt;noinclude&amp;gt; and &amp;lt;/noinclude&amp;gt; tags help to view this page properly when editing.--&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; |Alpine Linux Hardware Support Matrix&lt;br /&gt;
|-&lt;br /&gt;
! Architecture !! Port !! Description !! Since&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; |[[:Category:ARM|ARM]] || [[Alpine on ARM|armhf]] || 32 bit ARM with hard-float ABI - for ARMv6 devices - [[Raspberry Pi]] 1, Zero, ZeroW, cm1 (&#039;&#039;defconfig bcmrpi&#039;&#039;) || v3.0&lt;br /&gt;
|-&lt;br /&gt;
|  | [[Alpine on ARM|armv7]] || 32 bit ARM - for ARMv7 devices (including [[Raspberry Pi]] 2, 3, 3+, Zero2W, cm3, cm3+ with &#039;&#039;defconfig bcm2709&#039;&#039;) || v3.9&lt;br /&gt;
|-&lt;br /&gt;
|  | [[Alpine on ARM|aarch64]] || 64 bit ARM - for ARMv8+ devices (including [[Raspberry Pi]] 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 with &#039;&#039;defconfig bcm2711&#039;&#039;) || v3.5&lt;br /&gt;
&amp;lt;noinclude&amp;gt;|}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Include:Arm_support_matrix&amp;diff=31396</id>
		<title>Include:Arm support matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Include:Arm_support_matrix&amp;diff=31396"/>
		<updated>2025-11-05T14:42:30Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: armv7/aarch64  not Pi only &amp;amp; link Raspberry Pi page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;!-- Do not add heading(s) or content unrelated to this topic as the table below is transcluded in multiple pages. The &amp;lt;noinclude&amp;gt; and &amp;lt;/noinclude&amp;gt; tags help to view this page properly when editing.--&amp;gt;&lt;br /&gt;
&amp;lt;noinclude&amp;gt;&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; |Alpine Linux Hardware Support Matrix&lt;br /&gt;
|-&lt;br /&gt;
! Architecture !! Port !! Description !! Since&amp;lt;/noinclude&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| rowspan=&amp;quot;3&amp;quot; |[[:Category:ARM|ARM]] || [[Alpine on ARM|armhf]] || 32 bit ARM with hard-float ABI - for ARMv6 devices - [[Raspberry Pi]] 1, Zero, ZeroW, cm1 (defconfig bcmrpi) || v3.0&lt;br /&gt;
|-&lt;br /&gt;
|  | [[Alpine on ARM|armv7]] || 32 bit ARM - for ARMv7 devices - including [[Raspberry Pi]] 2, 3, 3+, Zero2W, cm3, cm3+ (defconfig bcm2709) || v3.9&lt;br /&gt;
|-&lt;br /&gt;
|  | [[Alpine on ARM|aarch64]] || 64 bit ARM - for ARMv8+ devices - including [[Raspberry Pi]] 3, 3+, 4, 400, Zero2W, cm3, cm3+, cm4, 5, 500, 500+, cm5 (defconfig bcm2711) || v3.5&lt;br /&gt;
&amp;lt;noinclude&amp;gt;|}&amp;lt;/noinclude&amp;gt;&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Talk:Include:Arm_support_matrix&amp;diff=31395</id>
		<title>Talk:Include:Arm support matrix</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Talk:Include:Arm_support_matrix&amp;diff=31395"/>
		<updated>2025-11-05T14:25:11Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: ARM hardware matrix issue&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;In fact this matrix mixes 2 dimensions (hardware and kernel builds) which may be a bit confusing from non-Pi ARM users.&amp;lt;br&amp;gt;&lt;br /&gt;
Indeed armv7/aarch64 hardware is supported by several kernels: generic upstream (linux-lts/linux-stable) like for all other hardware platforms, and custom Pi (linux-rpi with Pi foundation downstream patches and defconfigs). For armhf it&#039;s only Pi.&amp;lt;br&amp;gt;&lt;br /&gt;
The matrix as it stands may lead to think ARM is for Pi only, which it is not.&amp;lt;br&amp;gt;&lt;br /&gt;
Maybe we should have 2 different matrices: one only on HW for main page (just CPU cores, not talking about defconfigs), and another one on Pi Page that dives into the Pi specific models and defconfigs.&amp;lt;br&amp;gt;&lt;br /&gt;
Thoughts? [[User:Macmpi|Macmpi]] ([[User talk:Macmpi|talk]]) 14:25, 05 November 2025 (UTC)&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31393</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31393"/>
		<updated>2025-11-05T13:41:48Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Compatibility list */ add links for firmware source repo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; |Alpine Linux Hardware Support Matrix&lt;br /&gt;
|-&lt;br /&gt;
! Architecture !! Port !! Description !! Since&lt;br /&gt;
|-&lt;br /&gt;
{{:Include:Arm support matrix}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* &amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and defconfigs&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect mostly same features than with PiOS shipped kernels. &amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&lt;br /&gt;
* &amp;lt;code&amp;gt;linux-firmware&amp;lt;/code&amp;gt; bundles &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping [https://github.com/RPi-Distro/firmware-nonfree wifi] and [https://github.com/RPi-Distro/bluez-firmware bluetooth] firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
* &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;linux-stable&amp;lt;/code&amp;gt; kernels are upstream kernels only with &#039;&#039;Alpine&#039;s distro generic defconfigs&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected features, and may require different/additional configurations steps (&#039;&#039;unsupported&#039;&#039;).}}&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31392</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31392"/>
		<updated>2025-11-05T13:33:56Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Compatibility list */ shipping brcm firmware files&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; |Alpine Linux Hardware Support Matrix&lt;br /&gt;
|-&lt;br /&gt;
! Architecture !! Port !! Description !! Since&lt;br /&gt;
|-&lt;br /&gt;
{{:Include:Arm support matrix}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Note|&lt;br /&gt;
* &amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and defconfigs&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect mostly same features than with PiOS shipped kernels. &amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&lt;br /&gt;
* &amp;lt;code&amp;gt;linux-firmware&amp;lt;/code&amp;gt; bundles &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; containing &#039;&#039;downtream Pi Foundation&#039;s&#039;&#039; shipping wifi and bluetooth firmware files for Pi devices: it ensures optimal support for wireless connectivity (on par with PiOS community).&lt;br /&gt;
* &amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;linux-stable&amp;lt;/code&amp;gt; kernels are upstream kernels only with &#039;&#039;Alpine&#039;s distro generic defconfigs&#039;&#039;: &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; instances may be used with related Pi devices. However, they may not fully support all expected features, and may require different/additional configurations steps (&#039;&#039;unsupported&#039;&#039;).}}&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31391</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=31391"/>
		<updated>2025-11-05T12:30:16Z</updated>

		<summary type="html">&lt;p&gt;Macmpi: /* Compatibility list */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi devices are well supported on Alpine Linux by default. This page enlightens few specific information like [[#Preparing_for_the_installation| install media creation]], [[#Post_Installation| post-install]] customization and [[#Troubleshooting| troubleshooting]]. &lt;br /&gt;
&lt;br /&gt;
== Compatibility list ==&lt;br /&gt;
&lt;br /&gt;
Refer to the information regarding Raspberry Pi models in the below table when choosing image/file to download from [https://alpinelinux.org/downloads/ Downloads] page for your device. [[Installation#Verifying_downloaded_image|Verify]] the downloaded image before proceeding further.&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot; align=&amp;quot;center&amp;quot; style=&amp;quot;width:100%; border:1px #0771a6 solid; background:#f9f9f9; text-align:left; border-collapse:collapse;&amp;quot;&lt;br /&gt;
|- style=&amp;quot;background:#333333; color:#ffffff; font-size: 1.2em; text-align:center;&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;4&amp;quot; |Alpine Linux Hardware Support Matrix&lt;br /&gt;
|-&lt;br /&gt;
! Architecture !! Port !! Description !! Since&lt;br /&gt;
|-&lt;br /&gt;
{{:Include:Arm support matrix}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; kernels are built with &#039;&#039;Pi Foundation&#039;s downstream patches and defconfigs&#039;&#039; files (with very [https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/linux-rpi/common-changes.config minor deviations]): therefore user should expect mostly same features than with PiOS shipped kernels. &amp;lt;code&amp;gt;linux-rpi&amp;lt;/code&amp;gt; are the &#039;&#039;supported kernels&#039;&#039; shipped within Alpine&#039;s &#039;&#039;Raspberrypi install releases&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;linux-lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;linux-stable&amp;lt;/code&amp;gt; kernels are upstream kernels only with &#039;&#039;Alpine&#039;s distro generic defconfigs&#039;&#039;: they may be used with any &amp;lt;code&amp;gt;armv7&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;aarch64&amp;lt;/code&amp;gt; devices, including related Pi devices. However, they may not fully support all expected features, and may require different/additional configurations steps.}}&lt;br /&gt;
&lt;br /&gt;
== Preparing the installation media ==&lt;br /&gt;
&lt;br /&gt;
=== Raspberry Pi Imager ===&lt;br /&gt;
&lt;br /&gt;
[https://www.raspberrypi.com/news/raspberry-pi-imager-imaging-utility Raspberry Pi Imager] is a GUI utility for creating distributions install media for Pi devices in few clicks: it takes care of downloading, partitioning and formatting. Pre-built binaries are available for [https://github.com/raspberrypi/rpi-imager/releases Linux/macOS/Windows].&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Alpine Linux is listed under &#039;&#039;&#039;Other general-purpose OS&#039;&#039;&#039; section from &#039;&#039;&#039;Choose OS&#039;&#039;&#039; tab.&lt;br /&gt;
&lt;br /&gt;
This utility can also be used from an Alpine linux system: install the {{pkg|rpi-imager}} package from [[Repositories#Using_testing_repository|testing]] repository. To launch the utility in graphical mode issue the command: {{Cmd|rpi-imager}}&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;--cli&#039;&#039;&#039; option is also available. For complete usage guide, check out the &amp;lt;code&amp;gt;rpi-imager(1)&amp;lt;/code&amp;gt; manpages, which you can [[install]] with the {{Pkg|rpi-imager-doc}} package. &lt;br /&gt;
&lt;br /&gt;
=== Manual method === &lt;br /&gt;
&lt;br /&gt;
Alternatively, the Alpine Linux image/tarball for Raspberry Pi may be [https://alpinelinux.org/downloads/ downloaded], and SD card install media can be prepared.  Use the [[#Compatibility list|compatibility list]] above when choosing image/tarball to download. &lt;br /&gt;
&lt;br /&gt;
{{Tip|To reduce SD wear risk, it is advised to keep at least 10% of capacity as unallocated space. If partitioned  previously at full capacity, run &amp;lt;code&amp;gt;blkdiscard /dev/mmcblk0&amp;lt;/code&amp;gt; to ensure [https://man7.org/linux/man-pages/man8/blkdiscard.8.html device sectors are discarded] before re-partitioning.}}&lt;br /&gt;
&lt;br /&gt;
* For image file i.e &#039;&#039;img.gz&#039;&#039;, follow the regular [[Installation#Preparing installation media|installation media preparation steps]] to create a SD card which can be used as a [[Create a Bootable Device|customizable boot device]]. &lt;br /&gt;
&lt;br /&gt;
* For tarball i.e &#039;&#039;tar.gz&#039;&#039;, the SD card needs to be prepared i.e partitioned and formatted first.&lt;br /&gt;
&lt;br /&gt;
# Create a &#039;&#039;&#039;FAT32&#039;&#039;&#039; partition and format it using a graphical partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [https://gparted.org gparted]: just make sure the partition type is &amp;lt;code&amp;gt;W95 FAT32 (LBA)&amp;lt;/code&amp;gt;. (The current type can be found in the &amp;quot;Type&amp;quot; column in the output of &amp;lt;code&amp;gt;fdisk -l&amp;lt;/code&amp;gt;.)&lt;br /&gt;
#: {{warning|Do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition. Due to an upstream firmware [https://github.com/raspberrypi/firmware/issues/1529 bug], kernel/initramfs cannot be loaded from subdirectory with same name as volume label. Since kernel is installed to &amp;lt;code&amp;gt;boot/&amp;lt;/code&amp;gt; folder in Alpine Linux, do not use the volume label &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; for the FAT partition.}}&lt;br /&gt;
# Extract the tarball to the root of the bootable FAT32 partition.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Note|Using image file (manually or with Raspberry Pi Imager) will create a minimum-sized FAT16 volume with only about [https://gitlab.alpinelinux.org/alpine/aports/-/blob/98f4e18d0ab978e3a6dd6fad23cbbd4464a5cdc8/scripts/mkimg.arm.sh#L56 8MB of free space]. While enough for most use-cases, it may prove insufficient if using same media for Diskless/Data-disk Modes with many large add-on packages: one may then want to [[#Resize partition created with image file|grow that partition]] for more ample packages cache storage, or follow the tarball [[#Manual method|Manual method]] and allocate optimal partition size.}}&lt;br /&gt;
&lt;br /&gt;
== Considerations for choosing install modes ==&lt;br /&gt;
&lt;br /&gt;
The installation procedure for Alpine Linux &#039;&#039;&#039;requires basic understanding of the three modes&#039;&#039;&#039; i.e [[Installation#Installation_Overview|diskless/data disk/system disk]]. &lt;br /&gt;
&lt;br /&gt;
[[Diskless Mode|Diskless mode]] may be preferable on a pi with SD Card as the only storage device, as running the entire system from memory will improve performance (by avoiding the slow SD card) and improve the SD card life (by reducing the writes to the card, as all logging will happen in RAM). This mode is suitable for scenarios where there is not expected to be significant changes to disk after setup (like running a static HTTP server)&lt;br /&gt;
&lt;br /&gt;
[[Classic install or sys mode on Raspberry Pi|System disk]] mode installation may be more appropriate for the following use cases:&lt;br /&gt;
&lt;br /&gt;
* There will be constant changes to the disk after initial setup (for example, if you expect people to login and save files to their home directories)&lt;br /&gt;
* Logs should persist across reboots&lt;br /&gt;
* Plan to install packages which consume more space than can be loaded into RAM&lt;br /&gt;
* Plan to install kernel modules (such as ZFS)&lt;br /&gt;
&lt;br /&gt;
System disk mode with [[OverlayFS#Immutable_root_with_tmpfs_overlay|Immutable root option]] can also be a solution to keep whole system on read-only media (lower RAM requirement than diskless mode which loads whole system in RAM) while avoiding SD wear as runtime files are mapped to &#039;&#039;tmpfs&#039;&#039; in RAM (check limitations).&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
{{Tip|To install Alpine Linux on a Pi without keyboard, mouse &amp;amp; display, additional preparatory steps for install media are available at [[Installation on a headless host|headless Installation]] page.}}&lt;br /&gt;
&lt;br /&gt;
Once [[#Preparing the installation media|install media is prepared]], proceed to perform [[Installation#Base_configuration|standard procedures]] for actual install and initial base setup.&lt;br /&gt;
&lt;br /&gt;
After install and reboot, check notes below for further customization and [[#Troubleshooting| troubleshooting]].&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Customize &#039;&#039;config.txt&#039;&#039; and &#039;&#039;usercfg.txt&#039;&#039; ===&lt;br /&gt;
&lt;br /&gt;
Instead of the BIOS found on a conventional PC, Raspberry Pi devices use a configuration file called &#039;&#039;&#039;config.txt&#039;&#039;&#039;. The GPU reads &#039;&#039;&#039;config.txt&#039;&#039;&#039; before the Arm CPU and Linux initialise. &lt;br /&gt;
It is recommended to create a custom &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on boot partition to configure low-level system settings, as &#039;&#039;&#039;config.txt&#039;&#039;&#039; may be replaced during bootloader/system upgrades. However, few [https://www.raspberrypi.com/documentation/computers/config_txt.html#include settings] can only be set within &#039;&#039;&#039;config.txt&#039;&#039;&#039;, and will have no effect when specified in &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; (e.g. &amp;lt;code&amp;gt;gpu_mem&amp;lt;/code&amp;gt;). All available settings information can be found [https://www.raspberrypi.com/documentation/computers/config_txt.html here].&amp;lt;br&amp;gt;&lt;br /&gt;
Some noteworthy settings include:&lt;br /&gt;
* &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt; to enable audio support with &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver for onboard audio jack and legacy hdmi audio mode.&lt;br /&gt;
* By default system will use &#039;&#039;legacy video driver&#039;&#039;: some [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] may be used to adjust displays modes (e.g. if you see black edges around your screen after booting the Pi, you can add &amp;lt;code&amp;gt;disable_overscan=1&amp;lt;/code&amp;gt;). Alternatively, better supported &#039;&#039;Linux DRM-KMS driver&#039;&#039; may be used (see setup[[#Linux_Kernel_Graphics_Modes| below]]).&lt;br /&gt;
* Enabling default serial console with &amp;lt;code&amp;gt;enable_uart=1&amp;lt;/code&amp;gt;, together with &amp;lt;code&amp;gt;console=serial0,115200&amp;lt;/code&amp;gt; in &#039;&#039;cmdline.txt&#039;&#039; kernel parameters list.&lt;br /&gt;
* To maximize available CPU memory if not requiring extra GPU features (i.e. headless/CLI use-cases), cut-down bootloader may be installed with {{Pkg|raspberrypi-bootloader-cutdown|arch=}} package, and activated by adding &amp;lt;code&amp;gt;gpu_mem=16&amp;lt;/code&amp;gt; in &#039;&#039;&#039;config.txt&#039;&#039;&#039; (setting may be wiped after bootloader package update).&lt;br /&gt;
* If you plan to install on a Pi Computer Module 4 with I/O board, you may need to add: &amp;lt;code&amp;gt;otg_mode=1&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
After installation, [[Alpine_Package_Keeper#Upgrade_a_Running_System|check and apply updates]] to keep your system secure.&lt;br /&gt;
&lt;br /&gt;
=== Linux Kernel Graphics Modes ===&lt;br /&gt;
&lt;br /&gt;
By default system configuration will use legacy video driver: while it may remain well suited for [https://forums.raspberrypi.com/viewtopic.php?t=310315#p1856052 lower-ram devices] (i.e. Pi Zero/1), this driver has some limitations and is now lacking support.&amp;lt;br&amp;gt;&lt;br /&gt;
Linux DRM-KMS driver is recommended for most devices: it is enabled by adding the following to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;:&lt;br /&gt;
 # Enable DRM VC4 V3D driver&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 max_framebuffers=2&lt;br /&gt;
 &lt;br /&gt;
 # Don&#039;t have the firmware create an initial video= setting in cmdline.txt.&lt;br /&gt;
 # Use the kernel&#039;s default instead.&lt;br /&gt;
 disable_fw_kms_setup=1&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;vc4-kms-v3d&amp;lt;/code&amp;gt; overlay:&lt;br /&gt;
* ignores legacy video [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#legacy-video-options options] from &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039; / &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables Linux HDMI audio support by [https://www.raspberrypi.com/documentation/computers/config_txt.html#hdmi-audio default]. Eventual onboard audio jack still needs legacy &amp;lt;code&amp;gt;snd_bcm2835&amp;lt;/code&amp;gt; driver through &amp;lt;code&amp;gt;dtparam{{=}}audio{{=}}on&amp;lt;/code&amp;gt; option in &#039;&#039;&#039;usrcfg.txt&#039;&#039;&#039;.&lt;br /&gt;
* enables HDMI cec device within &amp;lt;code&amp;gt;/sys/class/rc&amp;lt;/code&amp;gt;, supported through standard {{pkg|libcec|arch=}}.}}&lt;br /&gt;
&lt;br /&gt;
3D Mesa drivers may be also added for [https://docs.mesa3d.org/drivers/vc4.html vc4] (Pi Zero-3) or [https://docs.mesa3d.org/drivers/v3d.html v3d] (Pi 4-5) devices:{{cmd|apk add {{pkg|mesa-dri-gallium|arch=}}}}&lt;br /&gt;
[https://forums.raspberrypi.com/viewtopic.php?t=363368#p2179572 vc4 devices limitations] in memory management may require regular reboots.&lt;br /&gt;
&lt;br /&gt;
=== Wireless drivers ===&lt;br /&gt;
&lt;br /&gt;
As of Alpine 3.17, Wifi and Bluetooth drivers are available within install image: they are part of &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; (and linked dependencies). Since kernel 6.1.25 (i.e. Alpine 3.18), onboard bluetooth is enabled &amp;amp; autoprobed by default. This may be disabled by setting [https://github.com/raspberrypi/rpi-firmware/tree/master/overlays krnbt] off).&lt;br /&gt;
&lt;br /&gt;
Adding the following file to disable roaming and few other &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver features [https://github.com/RPi-Distro/firmware-nonfree/commit/2788cb549a19bf2e77901c4071ef88c2ad683b7c may improve wifi stability].&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;$cat /etc/modprobe.d/brcmfmac.conf&amp;lt;br&amp;gt;&lt;br /&gt;
options brcmfmac roamoff=1 feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Alternatively&#039;&#039; same parameters may be passed all-in-one-line to kernel from &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039; as:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;brcmfmac.roamoff=1 brcmfmac.feature_disable=0x282000&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|On Alpine 3.22.0, aforementioned &amp;lt;code&amp;gt;brcmfmac&amp;lt;/code&amp;gt; driver options &#039;&#039;&#039;must&#039;&#039;&#039; be applied to circumvent an issue due to [https://gitlab.alpinelinux.org/alpine/aports/-/issues/17195 shipping &amp;lt;code&amp;gt;wpa_supplicant&amp;lt;/code&amp;gt;]. This is fixed from 3.22.1.}}&lt;br /&gt;
&lt;br /&gt;
=== USB-gadget ===&lt;br /&gt;
&lt;br /&gt;
Pi Zeros/A/A+/3A+/4B/400/5/500/CMs may be configured in various [https://trac.gateworks.com/wiki/linux/OTG#USBDeviceMode USB-gadget roles] (or a composite combination thereof) connected to host via USB: such roles may be serial-gadget (i.e. console access for setup), ethernet-gadget for networking, mass-storage (appear as USB disk), webcam, keyboard, etc...&lt;br /&gt;
&lt;br /&gt;
This may be achieved by loading relevant drivers &amp;amp; options in early boot sequence: in any case &amp;lt;code&amp;gt;dtoverlay=dwc2,dr_mode=peripheral&amp;lt;/code&amp;gt; must be added to &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039;.&amp;lt;br&amp;gt;&lt;br /&gt;
Then, for instance, serial gadget may be enabled with &amp;lt;code&amp;gt;echo &amp;quot;g_serial&amp;quot; | tee -a /etc/modules-load.d/gadget.conf&amp;lt;/code&amp;gt; (or adding &amp;lt;code&amp;gt;modules=g_serial&amp;lt;/code&amp;gt; in &#039;&#039;&#039;cmdline.txt&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
{{Tip|community &amp;lt;code&amp;gt;{{pkg|xg_multi|arch=}}&amp;lt;/code&amp;gt; package may ease setup for serial/ethernet/mass-storage composite gadget, while ensuring interoperability across most host OS.}}&lt;br /&gt;
&lt;br /&gt;
=== Picam ===&lt;br /&gt;
&lt;br /&gt;
{{Note| The below instructions has been tested only in [[Classic install or sys mode on Raspberry Pi|sys mode]] install with Pi Zero 2W.}}&lt;br /&gt;
&lt;br /&gt;
# To use {{pkg|rpicam-apps|arch=}} package, upgrade to [[Repositories#Upgrading_to_edge|edge]] branch.&lt;br /&gt;
# Setup eudev as device manager:{{Cmd|# setup-devd udev}}&lt;br /&gt;
# Add &amp;lt;Code&amp;gt;camera_auto_detect=1&amp;lt;/Code&amp;gt; option to the user config file {{Path|/boot/usercfg.txt}}&lt;br /&gt;
# Install the package {{pkg|rpicam-apps|arch=}} available in the [[Repositories#Testing|testing]] repository.&lt;br /&gt;
# Due to bug {{Issue|16911}}, change the permission after every reboot as follows:{{Cmd|$ doas chmod 666 /dev/dma_heap/*}}&lt;br /&gt;
# Test the picam by the command {{Cmd|$ libcamera-hello --list-cameras}}&lt;br /&gt;
&lt;br /&gt;
=== Resize partition created with image file ===&lt;br /&gt;
Media created from image file (manually or with [[#Raspberry Pi Imager|Raspberry Pi Imager]]) can &#039;&#039;&#039;cautiously&#039;&#039;&#039; be grown up to 128MB (as base image is created as [https://www.pctechguide.com/hard-disks/file-systems-fat-fat8-fat16-fat32-and-ntfs-explained FAT16 with 2k clusters]) with &amp;lt;code&amp;gt;[https://serverfault.com/questions/994448/extend-linux-partition-size-without-losing-any-data-techniques fdisk]&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;parted&amp;lt;/code&amp;gt;-based tools may fail doing so).&amp;lt;br&amp;gt;&lt;br /&gt;
Proceed with care to delete &amp;lt;code&amp;gt;d&amp;lt;/code&amp;gt;, and then &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; recreate primary partition of desired size-1MB (will start at sector 2048 by default), change it to &amp;lt;code&amp;gt;06&amp;lt;/code&amp;gt; (FAT16) with &amp;lt;code&amp;gt;t&amp;lt;/code&amp;gt; command, and go to &amp;lt;code&amp;gt;x&amp;lt;/code&amp;gt; extra menu and then &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; (move beginning of data in a partition to &amp;lt;code&amp;gt;0&amp;lt;/code&amp;gt; -- mind this increases size by 2048 sectors=1MB). Finally return &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt; and write &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; new partition table.&amp;lt;br&amp;gt;&lt;br /&gt;
Then filesystem needs to be resized accordingly with &amp;lt;code&amp;gt;fatresize&amp;lt;/code&amp;gt;.&amp;lt;br&amp;gt;&lt;br /&gt;
This should not destroy existing data.&amp;lt;br&amp;gt;&lt;br /&gt;
For exemple scripting it (128MB size):&lt;br /&gt;
{{Cmd|doas fdisk /dev/sda &amp;lt;&amp;lt;EOF  &lt;br /&gt;
d&lt;br /&gt;
n&lt;br /&gt;
p&lt;br /&gt;
1&lt;br /&gt;
2048&lt;br /&gt;
+127M&lt;br /&gt;
t&lt;br /&gt;
06&lt;br /&gt;
x&lt;br /&gt;
b&lt;br /&gt;
0&lt;br /&gt;
r&lt;br /&gt;
w&lt;br /&gt;
EOF&lt;br /&gt;
doas fatresize -n 1 -s 128M /dev/sda}}&lt;br /&gt;
&lt;br /&gt;
== Custom installation instructions ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic_install_or_sys_mode_on_Raspberry_Pi#Convert diskless to sys mode|Convert diskless to sys mode]]. &lt;br /&gt;
* An alternate approach [[OverlayFS#Loopback image with overlayfs|using loopback image with overlayfs]] for memory constrained Raspberry Pi models (3A+,Pi Zero) with only 512M of RAM running Diskless mode.&lt;br /&gt;
* [[Netbooting Raspberry Pi]] device&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;raspinfo&amp;lt;/code&amp;gt; utility from the {{Pkg|raspberrypi-utils-raspinfo|arch=}} package can be used as a first step to diagnose issues: it will make a log report of essential Pi system configuration, and is often used as a reference to submit questions or bug reports within Raspberry Pi community (Forums, Github, etc).&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect, as default CPU/GPU RAM split depends on Pi models and activated settings (audio, camera, video drivers, etc). To find out how your system is actually split, use &amp;lt;Code&amp;gt;vcgencmd&amp;lt;/Code&amp;gt; utility from the {{pkg|raspberrypi-utils-vcgencmd|arch=}} package as follows:{{Cmd|&amp;lt;nowiki&amp;gt;# vcgencmd get_mem gpu&lt;br /&gt;
# vcgencmd get_mem arm&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
To modify the memory allocation refer to &#039;&#039;legacy&#039;&#039; [https://www.raspberrypi.com/documentation/computers/legacy_config_txt.html#gpu_mem gpu_mem] parameter information for &#039;&#039;&#039;config.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
=== Long boot time when running headless ===&lt;br /&gt;
&lt;br /&gt;
If no peripherals are connected, the system might hang for an exceptionally long period of time while it attempts to accumulate entropy.&lt;br /&gt;
&lt;br /&gt;
If this is the case, simply plugging in any USB device should work around this issue, since it increases the amount of entropy available to the kernel via interrupts.&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
While running Raspberry Pi models with only 512M of RAM (i.e. Zero, 3A+), a fresh Alpine Linux installation in Diskless mode will only leave around 200M for tmpfs root. Such allocation may be [[Diskless_Mode#Modifying_root_filesystem_size| tuned]] or alternative install modes shall be [[#Considerations_for_choosing_install_modes| considered]].&lt;br /&gt;
&lt;br /&gt;
=== Clock-related error messages ===&lt;br /&gt;
&lt;br /&gt;
During the booting time, you might notice errors related to the hardware clock.  Many Raspberry Pi do not have a hardware clock, or may have one without battery, in which case the behaviour depends on whether you physically cut power or not. &lt;br /&gt;
&lt;br /&gt;
Also, &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt; will adapt the installation to the type of Raspberry Pi you use, which means for example that on a RPI5, you will see &amp;lt;code&amp;gt;hwclock&amp;gt;&amp;lt;/code&amp;gt; service, whereas on a RPI4 it will use &amp;lt;code&amp;gt;swclock&amp;lt;/code&amp;gt;. In doubt, make sure to do the installation on the target hardware.&lt;br /&gt;
&lt;br /&gt;
If you still experience clock errors, add the following line to &#039;&#039;&#039;/etc/chrony/chrony.conf&#039;&#039;&#039;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;makestep 0.1 3&amp;lt;/code&amp;gt; &lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
In Alpine 3.14, the WiFi drivers for the Raspberry Pi were moved from &amp;lt;code&amp;gt;linux-firmware-brcm&amp;lt;/code&amp;gt; to the &amp;lt;code&amp;gt;linux-firmware-cypress&amp;lt;/code&amp;gt; package (source?). Since the images seem to be an outdated version of the former, Wi-Fi will work during installation, but after the first update it will break.&lt;br /&gt;
Use the ethernet interface to download the required packages:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add {{pkg|linux-firmware-cypress|arch=a*}}}}&lt;br /&gt;
&lt;br /&gt;
And reboot.&lt;br /&gt;
&lt;br /&gt;
If you need Wi-Fi, you&#039;ll need to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card.&lt;br /&gt;
(Replace /mnt/sdcard with the correct mount point.)&lt;br /&gt;
&lt;br /&gt;
  git clone --depth 1 https://github.com/RPi-Distro/firmware-nonfree.git&lt;br /&gt;
  cp firmware-nonfree/brcm/* /mnt/sdcard/firmware/brcm&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* [[Classic install or sys mode on Raspberry Pi]] &lt;br /&gt;
* [[Raspberry Pi 3 - Setting Up Bluetooth]]&lt;br /&gt;
* [[Raspberry Pi 3 - Configuring it as wireless access point -AP Mode]]&lt;br /&gt;
* [[Raspberry Pi 3 - Browser Client]]&lt;br /&gt;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
* [[Netbooting Raspberry Pi]]&lt;br /&gt;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* [[OverlayFS‎‎]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
* [[Tutorials and Howtos#Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Macmpi</name></author>
	</entry>
</feed>