<?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=Wowaname</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=Wowaname"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Wowaname"/>
	<updated>2026-05-03T19:02:20Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26338</id>
		<title>Classic install or sys mode on Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26338"/>
		<updated>2024-01-22T22:28:16Z</updated>

		<summary type="html">&lt;p&gt;Wowaname: /* Post-installation */ clarify installing packages (rc-update shouldn&amp;#039;t be needed w/ vim+mc+htop anyway)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
A how-to for classic (&amp;quot;sys mode&amp;quot;) installation.&lt;br /&gt;
&lt;br /&gt;
This method works with a desktop PC under Ubuntu and other Linuxes.&lt;br /&gt;
&lt;br /&gt;
= Preparation =&lt;br /&gt;
&lt;br /&gt;
Download the archive from the &#039;&#039;&#039;Raspberry Pi armhf&#039;&#039;&#039; link  [https://alpinelinux.org/downloads/ here].&lt;br /&gt;
&#039;&#039;&#039;Sha256&#039;&#039;&#039; and &#039;&#039;&#039;GPG&#039;&#039;&#039; links appear next to the link to check the download.&lt;br /&gt;
&lt;br /&gt;
Create an MBR partition table with two partitions on an 8 GB (or larger) class 10 sd-card:&lt;br /&gt;
* First one, a &#039;&#039;&#039;fat16&#039;&#039;&#039; type, of 256MB. You may have to set &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lba&amp;lt;/code&amp;gt; flags&lt;br /&gt;
* The second one, an &#039;&#039;&#039;ext4&#039;&#039;&#039; type, occupying the remaining space on the media&lt;br /&gt;
&lt;br /&gt;
Eject and re-insert your SD card to ensure recognition of all the partitions.&lt;br /&gt;
&lt;br /&gt;
Go into the first partition (&#039;&#039;&#039;fat16&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Untar the archive with {{pkg|tar|arch=}}:&lt;br /&gt;
 tar zxvf ~/Download/alpine-rpi-{{AlpineLatest}}-armhf.tar.gz&lt;br /&gt;
&lt;br /&gt;
Due to a bug&amp;lt;sup&amp;gt;&amp;lt;small&amp;gt;[which?]&amp;lt;/small&amp;gt;&amp;lt;/sup&amp;gt;, it is recommended to add a file named &amp;lt;code&amp;gt;usercfg.txt&amp;lt;/code&amp;gt; into the partition.  The file should contain the following single line:&lt;br /&gt;
&lt;br /&gt;
 enable_uart=1&lt;br /&gt;
&lt;br /&gt;
For headless use, you can add the following parameters to maximize available memory (32 megs is required for the rpi bootloader):&lt;br /&gt;
&lt;br /&gt;
 gpu_mem=32&lt;br /&gt;
&lt;br /&gt;
to enable audio support:&lt;br /&gt;
&lt;br /&gt;
 dtparam=audio=on&lt;br /&gt;
&lt;br /&gt;
Eject the SD card properly. Insert it into the Raspberry Pi. Plug in a usb keyboard as well as the HDMI and network cables. Power on.&lt;br /&gt;
&lt;br /&gt;
When the command prompt displays, log in as root. (no password)&lt;br /&gt;
&lt;br /&gt;
== OSX Preparation: creating a FAT16 partition on microSD ==&lt;br /&gt;
&lt;br /&gt;
To create a FAT16 partition with OSX, use the diskutil program and a USB microSD card reader (I used an older version of this: https://www.bestbuy.com/site/insignia-usb-3-0-memory-card-reader/5787406.p?skuId=5787406).&lt;br /&gt;
&lt;br /&gt;
Put the microSD card in the reader. Connect the reader to a USB port and type &amp;lt;code&amp;gt;ls -1 /Volumes&amp;lt;/code&amp;gt; in a terminal.  Note the name of the microSD volume; for example, VOL1 in the output below:&lt;br /&gt;
  $ ls -1 /Volumes&lt;br /&gt;
  Macintosh HD&lt;br /&gt;
  Preboot&lt;br /&gt;
  VOL1&lt;br /&gt;
  $&lt;br /&gt;
&lt;br /&gt;
Unmount the reader. Disconnect it and re-run &amp;lt;code&amp;gt;ls -1 /Volumes&amp;lt;/code&amp;gt;.  Verify the microSD volume name is no longer listed, then re-insert the USB reader.&lt;br /&gt;
&lt;br /&gt;
Find the mount point of your microSD volume. For example, disk3 in the output below:&lt;br /&gt;
  $ diskutil list VOL1&lt;br /&gt;
  /dev/disk3 (external, physical):&lt;br /&gt;
     #:                       TYPE NAME                    SIZE       IDENTIFIER&lt;br /&gt;
     0:     FDisk_partition_scheme                        *31.4 GB    disk3&lt;br /&gt;
     1:                 DOS_FAT_16 VOL1                    256.0 MB   disk3s1&lt;br /&gt;
     2:                      Linux                         30.0 GB    disk3s2&lt;br /&gt;
     3:                 Linux_Swap                         1.2 GB     disk3s3&lt;br /&gt;
  $&lt;br /&gt;
&lt;br /&gt;
(For help with the diskutil command, type &amp;lt;code&amp;gt;diskutil&amp;lt;/code&amp;gt; to list all command verbs.  For help on a specific verb, add the verb. For example, &amp;lt;code&amp;gt;diskutil partitionDisk&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Destroy all the existing partitions on the microSD card and create two new ones: &lt;br /&gt;
# a 256MB, FAT16, DOS-compatible partition and &lt;br /&gt;
# a free space gap for the rest of the card&lt;br /&gt;
&lt;br /&gt;
  $ diskutil partitionDisk disk3 MBR   &amp;quot;MS-DOS FAT16&amp;quot; VOL1 256MB    &amp;quot;Free Space&amp;quot; VOL2 R&lt;br /&gt;
  Started partitioning on disk3&lt;br /&gt;
  Unmounting disk&lt;br /&gt;
  Creating the partition map&lt;br /&gt;
  Waiting for partitions to activate&lt;br /&gt;
  Formatting disk3s1 as MS-DOS (FAT16) with name VOL1&lt;br /&gt;
  512 bytes per physical sector&lt;br /&gt;
  /dev/rdisk3s1: 499472 sectors in 62434 FAT16 clusters (4096 bytes/cluster)&lt;br /&gt;
  bps=512 spc=8 res=1 nft=2 rde=512 mid=0xf8 spf=244 spt=32 hds=32 hid=2 drv=0x80 bsec=500000&lt;br /&gt;
  Mounting disk&lt;br /&gt;
  Finished partitioning on disk3&lt;br /&gt;
  /dev/disk3 (external, physical):&lt;br /&gt;
    #:                       TYPE NAME                    SIZE       IDENTIFIER&lt;br /&gt;
    0:     FDisk_partition_scheme                        *31.4 GB    disk3&lt;br /&gt;
    1:                 DOS_FAT_16 VOL1                    256.0 MB   disk3s1&lt;br /&gt;
  $ &lt;br /&gt;
&lt;br /&gt;
Change your current working directory to the new FAT16 partition then continue with the untar instruction in the parent prep section.&lt;br /&gt;
&lt;br /&gt;
  $ cd /Volumes/VOL1/&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
Execute the following commands. Make sure there is an internet connection available otherwise setting up the apk mirrors will fail.&lt;br /&gt;
&lt;br /&gt;
 setup-alpine &lt;br /&gt;
&lt;br /&gt;
Set the keyboard map, the timezone, how to connect to the network (&#039;&#039;&#039;dhcp&#039;&#039;&#039; is the best method), say &#039;&#039;&#039;none&#039;&#039;&#039; at &amp;lt;code&amp;gt;save config&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;save cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 apk update&lt;br /&gt;
&lt;br /&gt;
If the extra space in the sd card was left empty, a partition must be created now:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|cfdisk|arch=*}} {{pkg|e2fsprogs|arch=*}}  # or the tool of your choice&lt;br /&gt;
 cfdisk /dev/mmcblk0       # create the new partition with the free space&lt;br /&gt;
 mkfs.ext4 /dev/mmcblk0p2  # create the ext4 filesystem in the new partition&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi has no hardware clock, so synchronize with an ntp server:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|chrony|arch=a*}}&lt;br /&gt;
 service chronyd restart&lt;br /&gt;
&lt;br /&gt;
{{warning | 22 June 2021 - There is a bug in Alpine 3.12.x and older that causes setup-disk to fail on ext4 mounts on Raspberry Pi. The work around is marked in the instructions below. &amp;lt;br /&amp;gt;{{Issue|12353}} }}&lt;br /&gt;
&lt;br /&gt;
 mount /dev/mmcblk0p2 /mnt             # The second partition, in ext4 format, where Alpine Linux is installing in sys mode&lt;br /&gt;
 export FORCE_BOOTFS=1                 # work around for issue 12353&lt;br /&gt;
 setup-disk -m sys /mnt&lt;br /&gt;
 mount -o remount,rw /media/mmcblk0p1  # An update in the first partition is required for the next reboot.&lt;br /&gt;
&lt;br /&gt;
You may get some warning about syslinux when you run setup-disk.  You can safely ignore this.&lt;br /&gt;
&lt;br /&gt;
== Update boot partition (keep alpine-rpi* image layout) ==&lt;br /&gt;
Clean up the boot folder in the first partition to drop unused files:&lt;br /&gt;
&lt;br /&gt;
 rm -f /media/mmcblk0p1/boot/*  &lt;br /&gt;
 cd /mnt       # We are in the second partition &lt;br /&gt;
 rm boot/boot  # Drop the unused symbolic link&lt;br /&gt;
&lt;br /&gt;
Move the image and initramfs for Alpine Linux into the right place:&lt;br /&gt;
&lt;br /&gt;
 mv boot/* /media/mmcblk0p1/boot/  &lt;br /&gt;
 rm -Rf boot&lt;br /&gt;
 mkdir media/mmcblk0p1   # It&#039;s the mount point for the first partition on the next reboot&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry about the error when you execute the following:&lt;br /&gt;
&lt;br /&gt;
 ln -s media/mmcblk0p1/boot boot&lt;br /&gt;
&lt;br /&gt;
== Update boot partition (keep system partition/setup-alpine layout) ==&lt;br /&gt;
It turns out that the system partition created by setup-alpine has a working boot layout. To keep this, perform the following steps &#039;&#039;&#039;instead&#039;&#039;&#039; of the steps in the previous chapter.&lt;br /&gt;
&lt;br /&gt;
Clean up the boot / first partition to drop unused files:&lt;br /&gt;
&lt;br /&gt;
 rm -f /media/mmcblk0p1/*&lt;br /&gt;
 cd /mnt       # We are in the second partition &lt;br /&gt;
 rm boot/boot  # Drop the unused symbolink link&lt;br /&gt;
&lt;br /&gt;
Move the boot folder created by setup-alpine into the right place:&lt;br /&gt;
&lt;br /&gt;
 mv boot/* /media/mmcblk0p1/  &lt;br /&gt;
 rm -Rf boot&lt;br /&gt;
 mkdir media/mmcblk0p1   # It&#039;s the mount point for the first partition on the next reboot&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry about the error when you execute the following:&lt;br /&gt;
&lt;br /&gt;
 ln -s media/mmcblk0p1 boot&lt;br /&gt;
&lt;br /&gt;
== End of update boot partition - continue here in both cases ==&lt;br /&gt;
&lt;br /&gt;
Update &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0&amp;quot; &amp;gt;&amp;gt; etc/fstab&lt;br /&gt;
 sed -i &#039;/cdrom/d&#039; etc/fstab   # Of course, you don&#039;t have any cdrom or floppy on the Raspberry Pi&lt;br /&gt;
 sed -i &#039;/floppy/d&#039; etc/fstab&lt;br /&gt;
 cd /media/mmcblk0p1&lt;br /&gt;
&lt;br /&gt;
If you want to activate the edge repository:&lt;br /&gt;
 sed -i &#039;/edge/s/^#//&#039; etc/apk/repositories   # But enable the repository for community if you want vim, mc, php, apache, nginx, etc.&lt;br /&gt;
&lt;br /&gt;
For the next boot, indicate that the root filesystem is on the second partition.  If the cmdline.txt file&lt;br /&gt;
contains a line that starts with &amp;lt;code&amp;gt;/root&amp;lt;/code&amp;gt;, then use sed:&lt;br /&gt;
&lt;br /&gt;
 sed -i &#039;s/$/ root=\/dev\/mmcblk0p2 /&#039; /media/mmcblk0p1/cmdline.txt  &lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
That works on &#039;&#039;&#039;Raspberry Pi 3B&#039;&#039;&#039; and &#039;&#039;&#039;1B&#039;&#039;&#039;, but if you have the &#039;&#039;&#039;1B&#039;&#039;&#039; version, you&#039;ll need to be very, very patient (several tens of minutes).&lt;br /&gt;
&lt;br /&gt;
If a hard disk is connected via &#039;&#039;&#039;usb&#039;&#039;&#039;, you can replace the &amp;lt;code&amp;gt;/dev/mmcblk0p2&amp;lt;/code&amp;gt; above with &amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;, for example.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to use &#039;&#039;&#039;sed&#039;&#039;&#039;, you can use the nano editor instead, after executing the following command:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|nano|arch=a*}}&lt;br /&gt;
&lt;br /&gt;
= Post-installation =&lt;br /&gt;
&lt;br /&gt;
See the [[Raspberry_Pi#Post_Installation]] for common post-installation steps.&lt;br /&gt;
&lt;br /&gt;
Additionally, the following may be of value on a sys mode installation:&lt;br /&gt;
&lt;br /&gt;
If you want a cool editor ({{Pkg|vim}}), a file manager ({{Pkg|mc}}), and to determine which tasks are running and which services are starting on boot ({{Pkg|htop}}), install the packages with this command:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|vim|arch=a*}} {{pkg|mc|arch=a*}} {{pkg|htop|arch=a*}}&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;RPI 3B&#039;&#039;&#039; has wifi on board. To start the service for the encrypted key using wpa2 protocol:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|wpa_supplicant|arch=a*}}&lt;br /&gt;
 rc-update add wpa_supplicant boot&lt;br /&gt;
 service wpa_supplicant start&lt;br /&gt;
 setup-interfaces &lt;br /&gt;
Replace the IP address by dhcp for all the interfaces if necessary;  select the SSID network for wifi, add the password.&lt;br /&gt;
 ip addr    # to find the IP address for all interfaces&lt;br /&gt;
&lt;br /&gt;
If you want to connect to your RPI via &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;, an additional user (&#039;&#039;foo&#039;&#039;) and the {{Pkg|sudo|arch=*}} package are required because it&#039;s forbidden to connect as root:&lt;br /&gt;
&lt;br /&gt;
 apk add sudo&lt;br /&gt;
 adduser foo&lt;br /&gt;
 adduser foo wheel&lt;br /&gt;
 visudo &lt;br /&gt;
&lt;br /&gt;
Uncomment line #82 with &amp;lt;code&amp;gt;wheel ALL=(ALL) ALL&amp;lt;/code&amp;gt;. If {{Pkg|vim}} is installed, save the changes by typing &#039;&#039;&#039;Esc :x&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Following the preparation instructions for setting up the boot partition as outlined, using the armv7 image (3.10.3), my rpi2 would not even boot, and I was trapped at the dreaded rainbow screen, with the green led blinking a few times in a row, repeatedly.&lt;br /&gt;
&lt;br /&gt;
The rpi2 I had appears to require &#039;&#039;&#039;fat32&#039;&#039;&#039; for the boot partition, NOT &#039;&#039;&#039;fat16&#039;&#039;&#039; as suggested in the instructions.  Use linux fdisk to set the boot partition type as &amp;quot;c&amp;quot; (for fat32/lba) amd set the &#039;&#039;&#039;lba&#039;&#039;&#039; and &#039;&#039;&#039;boot&#039;&#039;&#039; flags for the partition as suggested.  Create the boot partition filesystem as fat32 with:&lt;br /&gt;
&lt;br /&gt;
 mkdosfs -F 32 /dev/sdX1 &lt;br /&gt;
&lt;br /&gt;
Mount and unpacke the tarball to that, and everything should work as documented after the prep instructions.&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect.  Currently the Pi requires a minimum of 32 megs of memory for the gpu, to boot unless you have the cut down boot loader installed, in which case you can use 16.  However, you may find more gpu memory is still being used, even if you configure it for less, if you enable audio or camera support.  To find out how your system is actually split:&lt;br /&gt;
&lt;br /&gt;
{{Note|Directions below are for Alpine versions older than 3.18... Help wanted: Is there something equivalent in current versions?}} &lt;br /&gt;
 apk add {{pkg|raspberrypi|arch=*|branch=v3.17}}&lt;br /&gt;
 /opt/vc/bin/vcgencmd get_mem gpu&lt;br /&gt;
 /opt/vc/bin/vcgencmd get_mem arm&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [[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;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Wowaname</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26284</id>
		<title>Classic install or sys mode on Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26284"/>
		<updated>2024-01-18T03:42:42Z</updated>

		<summary type="html">&lt;p&gt;Wowaname: /* Update boot partition (keep alpine-rpi* image layout) */ copyediting&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
A how-to for classic (&amp;quot;sys mode&amp;quot;) installation.&lt;br /&gt;
&lt;br /&gt;
This method works with a desktop PC under Ubuntu and other Linuxes.&lt;br /&gt;
&lt;br /&gt;
= Preparation =&lt;br /&gt;
&lt;br /&gt;
Download the archive from the &#039;&#039;&#039;Raspberry Pi armhf&#039;&#039;&#039; link  [https://alpinelinux.org/downloads/ here].&lt;br /&gt;
&#039;&#039;&#039;Sha256&#039;&#039;&#039; and &#039;&#039;&#039;GPG&#039;&#039;&#039; links appear next to the link to check the download.&lt;br /&gt;
&lt;br /&gt;
Create an MBR partition table with two partitions on an 8 GB (or larger) class 10 sd-card:&lt;br /&gt;
* First one, a &#039;&#039;&#039;fat16&#039;&#039;&#039; type, of 256MB. You may have to set &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lba&amp;lt;/code&amp;gt; flags&lt;br /&gt;
* The second one, an &#039;&#039;&#039;ext4&#039;&#039;&#039; type, occupying the remaining space on the media&lt;br /&gt;
&lt;br /&gt;
Eject and re-insert your SD card to ensure recognition of all the partitions.&lt;br /&gt;
&lt;br /&gt;
Go into the first partition (&#039;&#039;&#039;fat16&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Untar the archive with {{pkg|tar}}:&lt;br /&gt;
 tar zxvf ~/Download/alpine-rpi-*-armhf.tar.gz&lt;br /&gt;
&lt;br /&gt;
Due to a bug, it is recommended to add a file named &amp;lt;code&amp;gt;usercfg.txt&amp;lt;/code&amp;gt; into the partition.  The file should contain the following single line:&lt;br /&gt;
&lt;br /&gt;
 enable_uart=1&lt;br /&gt;
&lt;br /&gt;
For headless use, you can add the following parameters to maximize available memory (32 megs is required for the rpi bootloader):&lt;br /&gt;
&lt;br /&gt;
 gpu_mem=32&lt;br /&gt;
&lt;br /&gt;
to enable audio support:&lt;br /&gt;
&lt;br /&gt;
 dtparam=audio=on&lt;br /&gt;
&lt;br /&gt;
Eject the SD card properly. Insert it into the Raspberry Pi. Plug in a usb keyboard as well as the HDMI and network cables. Power on.&lt;br /&gt;
&lt;br /&gt;
When the command prompt displays, log in as root. (no password)&lt;br /&gt;
&lt;br /&gt;
== OSX Preparation: creating a FAT16 partition on microSD ==&lt;br /&gt;
&lt;br /&gt;
To create a FAT16 partition with OSX, use the diskutil program and a USB microSD card reader (I used an older version of this: https://www.bestbuy.com/site/insignia-usb-3-0-memory-card-reader/5787406.p?skuId=5787406).&lt;br /&gt;
&lt;br /&gt;
Put the microSD card in the reader. Connect the reader to a USB port and type &amp;lt;code&amp;gt;ls -1 /Volumes&amp;lt;/code&amp;gt; in a terminal.  Note the name of the microSD volume; for example, VOL1 in the output below:&lt;br /&gt;
  $ ls -1 /Volumes&lt;br /&gt;
  Macintosh HD&lt;br /&gt;
  Preboot&lt;br /&gt;
  VOL1&lt;br /&gt;
  $&lt;br /&gt;
&lt;br /&gt;
Unmount the reader. Disconnect it and re-run &amp;lt;code&amp;gt;ls -1 /Volumes&amp;lt;/code&amp;gt;.  Verify the microSD volume name is no longer listed, then re-insert the USB reader.&lt;br /&gt;
&lt;br /&gt;
Find the mount point of your microSD volume. For example, disk3 in the output below:&lt;br /&gt;
  $ diskutil list VOL1&lt;br /&gt;
  /dev/disk3 (external, physical):&lt;br /&gt;
     #:                       TYPE NAME                    SIZE       IDENTIFIER&lt;br /&gt;
     0:     FDisk_partition_scheme                        *31.4 GB    disk3&lt;br /&gt;
     1:                 DOS_FAT_16 VOL1                    256.0 MB   disk3s1&lt;br /&gt;
     2:                      Linux                         30.0 GB    disk3s2&lt;br /&gt;
     3:                 Linux_Swap                         1.2 GB     disk3s3&lt;br /&gt;
  $&lt;br /&gt;
&lt;br /&gt;
(For help with the diskutil command, type &amp;lt;code&amp;gt;diskutil&amp;lt;/code&amp;gt; to list all command verbs.  For help on a specific verb, add the verb. For example, &amp;lt;code&amp;gt;diskutil partitionDisk&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Destroy all the existing partitions on the microSD card and create two new ones: &lt;br /&gt;
# a 256MB, FAT16, DOS-compatible partition and &lt;br /&gt;
# a free space gap for the rest of the card&lt;br /&gt;
&lt;br /&gt;
  $ diskutil partitionDisk disk3 MBR   &amp;quot;MS-DOS FAT16&amp;quot; VOL1 256MB    &amp;quot;Free Space&amp;quot; VOL2 R&lt;br /&gt;
  Started partitioning on disk3&lt;br /&gt;
  Unmounting disk&lt;br /&gt;
  Creating the partition map&lt;br /&gt;
  Waiting for partitions to activate&lt;br /&gt;
  Formatting disk3s1 as MS-DOS (FAT16) with name VOL1&lt;br /&gt;
  512 bytes per physical sector&lt;br /&gt;
  /dev/rdisk3s1: 499472 sectors in 62434 FAT16 clusters (4096 bytes/cluster)&lt;br /&gt;
  bps=512 spc=8 res=1 nft=2 rde=512 mid=0xf8 spf=244 spt=32 hds=32 hid=2 drv=0x80 bsec=500000&lt;br /&gt;
  Mounting disk&lt;br /&gt;
  Finished partitioning on disk3&lt;br /&gt;
  /dev/disk3 (external, physical):&lt;br /&gt;
    #:                       TYPE NAME                    SIZE       IDENTIFIER&lt;br /&gt;
    0:     FDisk_partition_scheme                        *31.4 GB    disk3&lt;br /&gt;
    1:                 DOS_FAT_16 VOL1                    256.0 MB   disk3s1&lt;br /&gt;
  $ &lt;br /&gt;
&lt;br /&gt;
Change your current working directory to the new FAT16 partition then continue with the untar instruction in the parent prep section.&lt;br /&gt;
&lt;br /&gt;
  $ cd /Volumes/VOL1/&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
Execute the following commands. Make sure there is an internet connection available otherwise setting up the apk mirrors will fail.&lt;br /&gt;
&lt;br /&gt;
 setup-alpine &lt;br /&gt;
&lt;br /&gt;
Set the keyboard map, the timezone, how to connect to the network (&#039;&#039;&#039;dhcp&#039;&#039;&#039; is the best method), say &#039;&#039;&#039;none&#039;&#039;&#039; at &amp;lt;code&amp;gt;save config&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;save cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 apk update&lt;br /&gt;
&lt;br /&gt;
If the extra space in the sd card was left empty, a partition must be created now:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|cfdisk|arch=*}} {{pkg|e2fsprogs|arch=*}}  # or the tool of your choice&lt;br /&gt;
 cfdisk /dev/mmcblk0       # create the new partition with the free space&lt;br /&gt;
 mkfs.ext4 /dev/mmcblk0p2  # create the ext4 filesystem in the new partition&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi has no hardware clock, so synchronize with an ntp server:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|chrony|arch=a*}}&lt;br /&gt;
 service chronyd restart&lt;br /&gt;
&lt;br /&gt;
{{warning | 22 June 2021 - There is a bug in Alpine 3.12.x and older that causes setup-disk to fail on ext4 mounts on Raspberry Pi. The work around is marked in the instructions below. &amp;lt;br /&amp;gt;{{Issue|12353}} }}&lt;br /&gt;
&lt;br /&gt;
 mount /dev/mmcblk0p2 /mnt             # The second partition, in ext4 format, where Alpine Linux is installing in sys mode&lt;br /&gt;
 export FORCE_BOOTFS=1                 # work around for issue 12353&lt;br /&gt;
 setup-disk -m sys /mnt&lt;br /&gt;
 mount -o remount,rw /media/mmcblk0p1  # An update in the first partition is required for the next reboot.&lt;br /&gt;
&lt;br /&gt;
You may get some warning about syslinux when you run setup-disk.  You can safely ignore this.&lt;br /&gt;
&lt;br /&gt;
== Update boot partition (keep alpine-rpi* image layout) ==&lt;br /&gt;
Clean up the boot folder in the first partition to drop unused files:&lt;br /&gt;
&lt;br /&gt;
 rm -f /media/mmcblk0p1/boot/*  &lt;br /&gt;
 cd /mnt       # We are in the second partition &lt;br /&gt;
 rm boot/boot  # Drop the unused symbolic link&lt;br /&gt;
&lt;br /&gt;
Move the image and initramfs for Alpine Linux into the right place:&lt;br /&gt;
&lt;br /&gt;
 mv boot/* /media/mmcblk0p1/boot/  &lt;br /&gt;
 rm -Rf boot&lt;br /&gt;
 mkdir media/mmcblk0p1   # It&#039;s the mount point for the first partition on the next reboot&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry about the error when you execute the following:&lt;br /&gt;
&lt;br /&gt;
 ln -s media/mmcblk0p1/boot boot&lt;br /&gt;
&lt;br /&gt;
== Update boot partition (keep system partition/setup-alpine layout) ==&lt;br /&gt;
It turns out that the system partition created by setup-alpine has a working boot layout. To keep this, perform the following steps &#039;&#039;&#039;instead&#039;&#039;&#039; of the steps in the previous chapter.&lt;br /&gt;
&lt;br /&gt;
Clean up the boot / first partition to drop unused files:&lt;br /&gt;
&lt;br /&gt;
 rm -f /media/mmcblk0p1/*&lt;br /&gt;
 cd /mnt       # We are in the second partition &lt;br /&gt;
 rm boot/boot  # Drop the unused symbolink link&lt;br /&gt;
&lt;br /&gt;
Move the boot folder created by setup-alpine into the right place:&lt;br /&gt;
&lt;br /&gt;
 mv boot/* /media/mmcblk0p1/  &lt;br /&gt;
 rm -Rf boot&lt;br /&gt;
 mkdir media/mmcblk0p1   # It&#039;s the mount point for the first partition on the next reboot&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry about the error when you execute the following:&lt;br /&gt;
&lt;br /&gt;
 ln -s media/mmcblk0p1 boot&lt;br /&gt;
&lt;br /&gt;
== End of update boot partition - continue here in both cases ==&lt;br /&gt;
&lt;br /&gt;
Update &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0&amp;quot; &amp;gt;&amp;gt; etc/fstab&lt;br /&gt;
 sed -i &#039;/cdrom/d&#039; etc/fstab   # Of course, you don&#039;t have any cdrom or floppy on the Raspberry Pi&lt;br /&gt;
 sed -i &#039;/floppy/d&#039; etc/fstab&lt;br /&gt;
 cd /media/mmcblk0p1&lt;br /&gt;
&lt;br /&gt;
If you want to activate the edge repository:&lt;br /&gt;
 sed -i &#039;/edge/s/^#//&#039; etc/apk/repositories   # But enable the repository for community if you want vim, mc, php, apache, nginx, etc.&lt;br /&gt;
&lt;br /&gt;
For the next boot, indicate that the root filesystem is on the second partition.  If the cmdline.txt file&lt;br /&gt;
contains a line that starts with &amp;lt;code&amp;gt;/root&amp;lt;/code&amp;gt;, then use sed:&lt;br /&gt;
&lt;br /&gt;
 sed -i &#039;s/$/ root=\/dev\/mmcblk0p2 /&#039; /media/mmcblk0p1/cmdline.txt  &lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
That works on &#039;&#039;&#039;Raspberry Pi 3B&#039;&#039;&#039; and &#039;&#039;&#039;1B&#039;&#039;&#039;, but if you have the &#039;&#039;&#039;1B&#039;&#039;&#039; version, you&#039;ll need to be very, very patient (several tens of minutes).&lt;br /&gt;
&lt;br /&gt;
If a hard disk is connected via &#039;&#039;&#039;usb&#039;&#039;&#039;, you can replace the &amp;lt;code&amp;gt;/dev/mmcblk0p2&amp;lt;/code&amp;gt; above with &amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;, for example.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to use &#039;&#039;&#039;sed&#039;&#039;&#039;, you can use the nano editor instead, after executing the following command:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|nano|arch=a*}}&lt;br /&gt;
&lt;br /&gt;
= Post-installation =&lt;br /&gt;
&lt;br /&gt;
See the [[Raspberry_Pi#Post_Installation]] for common post-installation steps.&lt;br /&gt;
&lt;br /&gt;
Additionally, the following may be of value on a sys mode installation:&lt;br /&gt;
&lt;br /&gt;
If you want a cool editor ({{Pkg|vim}}), a file manager ({{Pkg|mc}}), and to determine which tasks are running and which services are starting on boot ({{Pkg|htop}}), add the the following packages:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|vim|arch=a*}} {{pkg|mc|arch=a*}} {{pkg|htop|arch=a*}}&lt;br /&gt;
 htop&lt;br /&gt;
 rc-update&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;RPI 3B&#039;&#039;&#039; has wifi on board. To start the service for the encrypted key using wpa2 protocol:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|wpa_supplicant|arch=a*}}&lt;br /&gt;
 rc-update add wpa_supplicant boot&lt;br /&gt;
 service wpa_supplicant start&lt;br /&gt;
 setup-interfaces &lt;br /&gt;
Replace the IP address by dhcp for all the interfaces if necessary;  select the SSID network for wifi, add the password.&lt;br /&gt;
 ip addr    # to find the IP address for all interfaces&lt;br /&gt;
&lt;br /&gt;
If you want to connect to your RPI via &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;, an additional user (&#039;&#039;foo&#039;&#039;) and the {{Pkg|sudo|arch=*}} package are required because it&#039;s forbidden to connect as root:&lt;br /&gt;
&lt;br /&gt;
 apk add sudo&lt;br /&gt;
 adduser foo&lt;br /&gt;
 adduser foo wheel&lt;br /&gt;
 visudo &lt;br /&gt;
&lt;br /&gt;
Uncomment line #82 with &amp;lt;code&amp;gt;wheel ALL=(ALL) ALL&amp;lt;/code&amp;gt;. If {{Pkg|vim}} is installed, save the changes by typing &#039;&#039;&#039;Esc :x&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Following the preparation instructions for setting up the boot partition as outlined, using the armv7 image (3.10.3), my rpi2 would not even boot, and I was trapped at the dreaded rainbow screen, with the green led blinking a few times in a row, repeatedly.&lt;br /&gt;
&lt;br /&gt;
The rpi2 I had appears to require &#039;&#039;&#039;fat32&#039;&#039;&#039; for the boot partition, NOT &#039;&#039;&#039;fat16&#039;&#039;&#039; as suggested in the instructions.  Use linux fdisk to set the boot partition type as &amp;quot;c&amp;quot; (for fat32/lba) amd set the &#039;&#039;&#039;lba&#039;&#039;&#039; and &#039;&#039;&#039;boot&#039;&#039;&#039; flags for the partition as suggested.  Create the boot partition filesystem as fat32 with:&lt;br /&gt;
&lt;br /&gt;
 mkdosfs -F 32 /dev/sdX1 &lt;br /&gt;
&lt;br /&gt;
Mount and unpacke the tarball to that, and everything should work as documented after the prep instructions.&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect.  Currently the Pi requires a minimum of 32 megs of memory for the gpu, to boot unless you have the cut down boot loader installed, in which case you can use 16.  However, you may find more gpu memory is still being used, even if you configure it for less, if you enable audio or camera support.  To find out how your system is actually split:&lt;br /&gt;
&lt;br /&gt;
{{Note|Directions below are for Alpine versions older than 3.18... Help wanted: Is there something equivalent in current versions?}} &lt;br /&gt;
 apk add {{pkg|raspberrypi|arch=*|branch=v3.17}}&lt;br /&gt;
 /opt/vc/bin/vcgencmd get_mem gpu&lt;br /&gt;
 /opt/vc/bin/vcgencmd get_mem arm&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [[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;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Wowaname</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26282</id>
		<title>Classic install or sys mode on Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26282"/>
		<updated>2024-01-18T03:32:11Z</updated>

		<summary type="html">&lt;p&gt;Wowaname: /* Preparation */ fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
A how-to for classic (&amp;quot;sys mode&amp;quot;) installation.&lt;br /&gt;
&lt;br /&gt;
This method works with a desktop PC under Ubuntu and other Linuxes.&lt;br /&gt;
&lt;br /&gt;
= Preparation =&lt;br /&gt;
&lt;br /&gt;
Download the archive from the &#039;&#039;&#039;Raspberry Pi armhf&#039;&#039;&#039; link  [https://alpinelinux.org/downloads/ here].&lt;br /&gt;
&#039;&#039;&#039;Sha256&#039;&#039;&#039; and &#039;&#039;&#039;GPG&#039;&#039;&#039; links appear next to the link to check the download.&lt;br /&gt;
&lt;br /&gt;
Create an MBR partition table with two partitions on an 8 GB (or larger) class 10 sd-card:&lt;br /&gt;
* First one, a &#039;&#039;&#039;fat16&#039;&#039;&#039; type, of 256MB. You may have to set &amp;lt;code&amp;gt;boot&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;lba&amp;lt;/code&amp;gt; flags&lt;br /&gt;
* The second one, an &#039;&#039;&#039;ext4&#039;&#039;&#039; type, occupying the remaining space on the media&lt;br /&gt;
&lt;br /&gt;
Eject and re-insert your SD card to ensure recognition of all the partitions.&lt;br /&gt;
&lt;br /&gt;
Go into the first partition (&#039;&#039;&#039;fat16&#039;&#039;&#039;).&lt;br /&gt;
&lt;br /&gt;
Untar the archive with {{pkg|tar}}:&lt;br /&gt;
 tar zxvf ~/Download/alpine-rpi-*-armhf.tar.gz&lt;br /&gt;
&lt;br /&gt;
Due to a bug, it is recommended to add a file named &amp;lt;code&amp;gt;usercfg.txt&amp;lt;/code&amp;gt; into the partition.  The file should contain the following single line:&lt;br /&gt;
&lt;br /&gt;
 enable_uart=1&lt;br /&gt;
&lt;br /&gt;
For headless use, you can add the following parameters to maximize available memory (32 megs is required for the rpi bootloader):&lt;br /&gt;
&lt;br /&gt;
 gpu_mem=32&lt;br /&gt;
&lt;br /&gt;
to enable audio support:&lt;br /&gt;
&lt;br /&gt;
 dtparam=audio=on&lt;br /&gt;
&lt;br /&gt;
Eject the SD card properly. Insert it into the Raspberry Pi. Plug in a usb keyboard as well as the HDMI and network cables. Power on.&lt;br /&gt;
&lt;br /&gt;
When the command prompt displays, log in as root. (no password)&lt;br /&gt;
&lt;br /&gt;
== OSX Preparation: creating a FAT16 partition on microSD ==&lt;br /&gt;
&lt;br /&gt;
To create a FAT16 partition with OSX, use the diskutil program and a USB microSD card reader (I used an older version of this: https://www.bestbuy.com/site/insignia-usb-3-0-memory-card-reader/5787406.p?skuId=5787406).&lt;br /&gt;
&lt;br /&gt;
Put the microSD card in the reader. Connect the reader to a USB port and type &amp;lt;code&amp;gt;ls -1 /Volumes&amp;lt;/code&amp;gt; in a terminal.  Note the name of the microSD volume; for example, VOL1 in the output below:&lt;br /&gt;
  $ ls -1 /Volumes&lt;br /&gt;
  Macintosh HD&lt;br /&gt;
  Preboot&lt;br /&gt;
  VOL1&lt;br /&gt;
  $&lt;br /&gt;
&lt;br /&gt;
Unmount the reader. Disconnect it and re-run &amp;lt;code&amp;gt;ls -1 /Volumes&amp;lt;/code&amp;gt;.  Verify the microSD volume name is no longer listed, then re-insert the USB reader.&lt;br /&gt;
&lt;br /&gt;
Find the mount point of your microSD volume. For example, disk3 in the output below:&lt;br /&gt;
  $ diskutil list VOL1&lt;br /&gt;
  /dev/disk3 (external, physical):&lt;br /&gt;
     #:                       TYPE NAME                    SIZE       IDENTIFIER&lt;br /&gt;
     0:     FDisk_partition_scheme                        *31.4 GB    disk3&lt;br /&gt;
     1:                 DOS_FAT_16 VOL1                    256.0 MB   disk3s1&lt;br /&gt;
     2:                      Linux                         30.0 GB    disk3s2&lt;br /&gt;
     3:                 Linux_Swap                         1.2 GB     disk3s3&lt;br /&gt;
  $&lt;br /&gt;
&lt;br /&gt;
(For help with the diskutil command, type &amp;lt;code&amp;gt;diskutil&amp;lt;/code&amp;gt; to list all command verbs.  For help on a specific verb, add the verb. For example, &amp;lt;code&amp;gt;diskutil partitionDisk&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
Destroy all the existing partitions on the microSD card and create two new ones: &lt;br /&gt;
# a 256MB, FAT16, DOS-compatible partition and &lt;br /&gt;
# a free space gap for the rest of the card&lt;br /&gt;
&lt;br /&gt;
  $ diskutil partitionDisk disk3 MBR   &amp;quot;MS-DOS FAT16&amp;quot; VOL1 256MB    &amp;quot;Free Space&amp;quot; VOL2 R&lt;br /&gt;
  Started partitioning on disk3&lt;br /&gt;
  Unmounting disk&lt;br /&gt;
  Creating the partition map&lt;br /&gt;
  Waiting for partitions to activate&lt;br /&gt;
  Formatting disk3s1 as MS-DOS (FAT16) with name VOL1&lt;br /&gt;
  512 bytes per physical sector&lt;br /&gt;
  /dev/rdisk3s1: 499472 sectors in 62434 FAT16 clusters (4096 bytes/cluster)&lt;br /&gt;
  bps=512 spc=8 res=1 nft=2 rde=512 mid=0xf8 spf=244 spt=32 hds=32 hid=2 drv=0x80 bsec=500000&lt;br /&gt;
  Mounting disk&lt;br /&gt;
  Finished partitioning on disk3&lt;br /&gt;
  /dev/disk3 (external, physical):&lt;br /&gt;
    #:                       TYPE NAME                    SIZE       IDENTIFIER&lt;br /&gt;
    0:     FDisk_partition_scheme                        *31.4 GB    disk3&lt;br /&gt;
    1:                 DOS_FAT_16 VOL1                    256.0 MB   disk3s1&lt;br /&gt;
  $ &lt;br /&gt;
&lt;br /&gt;
Change your current working directory to the new FAT16 partition then continue with the untar instruction in the parent prep section.&lt;br /&gt;
&lt;br /&gt;
  $ cd /Volumes/VOL1/&lt;br /&gt;
&lt;br /&gt;
= Installation =&lt;br /&gt;
&lt;br /&gt;
Execute the following commands. Make sure there is an internet connection available otherwise setting up the apk mirrors will fail.&lt;br /&gt;
&lt;br /&gt;
 setup-alpine &lt;br /&gt;
&lt;br /&gt;
Set the keyboard map, the timezone, how to connect to the network (&#039;&#039;&#039;dhcp&#039;&#039;&#039; is the best method), say &#039;&#039;&#039;none&#039;&#039;&#039; at &amp;lt;code&amp;gt;save config&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;save cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
 apk update&lt;br /&gt;
&lt;br /&gt;
If the extra space in the sd card was left empty, a partition must be created now:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|cfdisk|arch=*}} {{pkg|e2fsprogs|arch=*}}  # or the tool of your choice&lt;br /&gt;
 cfdisk /dev/mmcblk0       # create the new partition with the free space&lt;br /&gt;
 mkfs.ext4 /dev/mmcblk0p2  # create the ext4 filesystem in the new partition&lt;br /&gt;
&lt;br /&gt;
Raspberry Pi has no hardware clock, so synchronize with an ntp server:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|chrony|arch=a*}}&lt;br /&gt;
 service chronyd restart&lt;br /&gt;
&lt;br /&gt;
{{warning | 22 June 2021 - There is a bug in Alpine 3.12.x and older that causes setup-disk to fail on ext4 mounts on Raspberry Pi. The work around is marked in the instructions below. &amp;lt;br /&amp;gt;{{Issue|12353}} }}&lt;br /&gt;
&lt;br /&gt;
 mount /dev/mmcblk0p2 /mnt             # The second partition, in ext4 format, where Alpine Linux is installing in sys mode&lt;br /&gt;
 export FORCE_BOOTFS=1                 # work around for issue 12353&lt;br /&gt;
 setup-disk -m sys /mnt&lt;br /&gt;
 mount -o remount,rw /media/mmcblk0p1  # An update in the first partition is required for the next reboot.&lt;br /&gt;
&lt;br /&gt;
You may get some warning about syslinux when you run setup-disk.  You can safely ignore this.&lt;br /&gt;
&lt;br /&gt;
== Update boot partition (keep alpine-rpi* image layout) ==&lt;br /&gt;
Clean up the boot folder in the first partition to drop unused files:&lt;br /&gt;
&lt;br /&gt;
 rm -f /media/mmcblk0p1/boot/*  &lt;br /&gt;
 cd /mnt       # We are in the second partition &lt;br /&gt;
 rm boot/boot  # Drop the unused symbolink link&lt;br /&gt;
&lt;br /&gt;
Move the image and &amp;lt;code&amp;gt;init ram&amp;lt;/code&amp;gt; for Alpine Linux into the right place:&lt;br /&gt;
&lt;br /&gt;
 mv boot/* /media/mmcblk0p1/boot/  &lt;br /&gt;
 rm -Rf boot&lt;br /&gt;
 mkdir media/mmcblk0p1   # It&#039;s the mount point for the first partition on the next reboot&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry about the error when you execute the following:&lt;br /&gt;
&lt;br /&gt;
 ln -s media/mmcblk0p1/boot boot&lt;br /&gt;
&lt;br /&gt;
== Update boot partition (keep system partition/setup-alpine layout) ==&lt;br /&gt;
It turns out that the system partition created by setup-alpine has a working boot layout. To keep this, perform the following steps &#039;&#039;&#039;instead&#039;&#039;&#039; of the steps in the previous chapter.&lt;br /&gt;
&lt;br /&gt;
Clean up the boot / first partition to drop unused files:&lt;br /&gt;
&lt;br /&gt;
 rm -f /media/mmcblk0p1/*&lt;br /&gt;
 cd /mnt       # We are in the second partition &lt;br /&gt;
 rm boot/boot  # Drop the unused symbolink link&lt;br /&gt;
&lt;br /&gt;
Move the boot folder created by setup-alpine into the right place:&lt;br /&gt;
&lt;br /&gt;
 mv boot/* /media/mmcblk0p1/  &lt;br /&gt;
 rm -Rf boot&lt;br /&gt;
 mkdir media/mmcblk0p1   # It&#039;s the mount point for the first partition on the next reboot&lt;br /&gt;
&lt;br /&gt;
Don&#039;t worry about the error when you execute the following:&lt;br /&gt;
&lt;br /&gt;
 ln -s media/mmcblk0p1 boot&lt;br /&gt;
&lt;br /&gt;
== End of update boot partition - continue here in both cases ==&lt;br /&gt;
&lt;br /&gt;
Update &amp;lt;code&amp;gt;/etc/fstab&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0&amp;quot; &amp;gt;&amp;gt; etc/fstab&lt;br /&gt;
 sed -i &#039;/cdrom/d&#039; etc/fstab   # Of course, you don&#039;t have any cdrom or floppy on the Raspberry Pi&lt;br /&gt;
 sed -i &#039;/floppy/d&#039; etc/fstab&lt;br /&gt;
 cd /media/mmcblk0p1&lt;br /&gt;
&lt;br /&gt;
If you want to activate the edge repository:&lt;br /&gt;
 sed -i &#039;/edge/s/^#//&#039; etc/apk/repositories   # But enable the repository for community if you want vim, mc, php, apache, nginx, etc.&lt;br /&gt;
&lt;br /&gt;
For the next boot, indicate that the root filesystem is on the second partition.  If the cmdline.txt file&lt;br /&gt;
contains a line that starts with &amp;lt;code&amp;gt;/root&amp;lt;/code&amp;gt;, then use sed:&lt;br /&gt;
&lt;br /&gt;
 sed -i &#039;s/$/ root=\/dev\/mmcblk0p2 /&#039; /media/mmcblk0p1/cmdline.txt  &lt;br /&gt;
 reboot&lt;br /&gt;
&lt;br /&gt;
That works on &#039;&#039;&#039;Raspberry Pi 3B&#039;&#039;&#039; and &#039;&#039;&#039;1B&#039;&#039;&#039;, but if you have the &#039;&#039;&#039;1B&#039;&#039;&#039; version, you&#039;ll need to be very, very patient (several tens of minutes).&lt;br /&gt;
&lt;br /&gt;
If a hard disk is connected via &#039;&#039;&#039;usb&#039;&#039;&#039;, you can replace the &amp;lt;code&amp;gt;/dev/mmcblk0p2&amp;lt;/code&amp;gt; above with &amp;lt;code&amp;gt;/dev/sda1&amp;lt;/code&amp;gt;, for example.&lt;br /&gt;
&lt;br /&gt;
If you don&#039;t want to use &#039;&#039;&#039;sed&#039;&#039;&#039;, you can use the nano editor instead, after executing the following command:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|nano|arch=a*}}&lt;br /&gt;
&lt;br /&gt;
= Post-installation =&lt;br /&gt;
&lt;br /&gt;
See the [[Raspberry_Pi#Post_Installation]] for common post-installation steps.&lt;br /&gt;
&lt;br /&gt;
Additionally, the following may be of value on a sys mode installation:&lt;br /&gt;
&lt;br /&gt;
If you want a cool editor ({{Pkg|vim}}), a file manager ({{Pkg|mc}}), and to determine which tasks are running and which services are starting on boot ({{Pkg|htop}}), add the the following packages:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|vim|arch=a*}} {{pkg|mc|arch=a*}} {{pkg|htop|arch=a*}}&lt;br /&gt;
 htop&lt;br /&gt;
 rc-update&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;&#039;RPI 3B&#039;&#039;&#039; has wifi on board. To start the service for the encrypted key using wpa2 protocol:&lt;br /&gt;
&lt;br /&gt;
 apk add {{pkg|wpa_supplicant|arch=a*}}&lt;br /&gt;
 rc-update add wpa_supplicant boot&lt;br /&gt;
 service wpa_supplicant start&lt;br /&gt;
 setup-interfaces &lt;br /&gt;
Replace the IP address by dhcp for all the interfaces if necessary;  select the SSID network for wifi, add the password.&lt;br /&gt;
 ip addr    # to find the IP address for all interfaces&lt;br /&gt;
&lt;br /&gt;
If you want to connect to your RPI via &amp;lt;code&amp;gt;ssh&amp;lt;/code&amp;gt;, an additional user (&#039;&#039;foo&#039;&#039;) and the {{Pkg|sudo|arch=*}} package are required because it&#039;s forbidden to connect as root:&lt;br /&gt;
&lt;br /&gt;
 apk add sudo&lt;br /&gt;
 adduser foo&lt;br /&gt;
 adduser foo wheel&lt;br /&gt;
 visudo &lt;br /&gt;
&lt;br /&gt;
Uncomment line #82 with &amp;lt;code&amp;gt;wheel ALL=(ALL) ALL&amp;lt;/code&amp;gt;. If {{Pkg|vim}} is installed, save the changes by typing &#039;&#039;&#039;Esc :x&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= Troubleshooting =&lt;br /&gt;
&lt;br /&gt;
Following the preparation instructions for setting up the boot partition as outlined, using the armv7 image (3.10.3), my rpi2 would not even boot, and I was trapped at the dreaded rainbow screen, with the green led blinking a few times in a row, repeatedly.&lt;br /&gt;
&lt;br /&gt;
The rpi2 I had appears to require &#039;&#039;&#039;fat32&#039;&#039;&#039; for the boot partition, NOT &#039;&#039;&#039;fat16&#039;&#039;&#039; as suggested in the instructions.  Use linux fdisk to set the boot partition type as &amp;quot;c&amp;quot; (for fat32/lba) amd set the &#039;&#039;&#039;lba&#039;&#039;&#039; and &#039;&#039;&#039;boot&#039;&#039;&#039; flags for the partition as suggested.  Create the boot partition filesystem as fat32 with:&lt;br /&gt;
&lt;br /&gt;
 mkdosfs -F 32 /dev/sdX1 &lt;br /&gt;
&lt;br /&gt;
Mount and unpacke the tarball to that, and everything should work as documented after the prep instructions.&lt;br /&gt;
&lt;br /&gt;
After booting, you may find less system memory available than you expect.  Currently the Pi requires a minimum of 32 megs of memory for the gpu, to boot unless you have the cut down boot loader installed, in which case you can use 16.  However, you may find more gpu memory is still being used, even if you configure it for less, if you enable audio or camera support.  To find out how your system is actually split:&lt;br /&gt;
&lt;br /&gt;
{{Note|Directions below are for Alpine versions older than 3.18... Help wanted: Is there something equivalent in current versions?}} &lt;br /&gt;
 apk add {{pkg|raspberrypi|arch=*|branch=v3.17}}&lt;br /&gt;
 /opt/vc/bin/vcgencmd get_mem gpu&lt;br /&gt;
 /opt/vc/bin/vcgencmd get_mem arm&lt;br /&gt;
&lt;br /&gt;
= See also =&lt;br /&gt;
&lt;br /&gt;
* [[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;
* [[Linux Router with VPN on a Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Wowaname</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Porting_GHC_to_Alpine&amp;diff=17795</id>
		<title>Porting GHC to Alpine</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Porting_GHC_to_Alpine&amp;diff=17795"/>
		<updated>2020-07-07T21:44:59Z</updated>

		<summary type="html">&lt;p&gt;Wowaname: fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Obsolete|{{pkg|ghc}} is now available in aports; also these instructions target an older version of ghc (which is at [https://www.haskell.org/ghc/ v8.0.2 as of Jan 2017])}}&lt;br /&gt;
&lt;br /&gt;
I wanted to port the [http://www.haskell.org/ghc/ Glasgow Haskell Compiler] to Alpine, and to do that, you need to start with some already-compiled GHC binary. So that means cross-compiling from some system where the binaries were already available.&lt;br /&gt;
&lt;br /&gt;
After this is done once for each of Alpine&#039;s target architectures, other users can use those existing Alpine binaries to compile newer versions of GHC directly on Alpine, much more easily than is detailed below. (It does still take a long time.) But I am recording the steps necessary to port to Alpine in the first place, so that others can verify or reproduce my work. This may also help others porting GHC to other systems.&lt;br /&gt;
&lt;br /&gt;
I assume anyone following these directions has already setup a cross-compiler targeting Alpine inside a chroot holding an existing Linux system where GHC binaries are available. These pages explain how to do that:&lt;br /&gt;
&lt;br /&gt;
* [[Installing ArchLinux inside an Alpine chroot]]&lt;br /&gt;
* [[Cross-Compiler targeting Alpine]]&lt;br /&gt;
&lt;br /&gt;
So here&#039;s how we use Arch&#039;s GHC to cross-compile a version of GHC we can run on Alpine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;OL&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
In your &#039;&#039;&#039;outside Alpine system&#039;&#039;&#039;, do this. I assume that &amp;lt;code&amp;gt;$ARCH_ROOT&amp;lt;/code&amp;gt; contains the absolute path &#039;&#039;on your Alpine system&#039;&#039; of the Arch chroot&#039;s {{Path|/}}. I assume also that &amp;lt;code&amp;gt;$ARCH_HOME&amp;lt;/code&amp;gt; contains the absolute path &#039;&#039;on your Arch system&#039;&#039; of the home directory of the non-root Arch user you&#039;ll be using to build GHC. (On the other hand, the plain &amp;lt;code&amp;gt;$ARCH&amp;lt;/code&amp;gt; variable we set below indicates your machine architecture---nothing to do with ArchLinux.)&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;sudo apk add paxctl libedit-dev libiconv-dev gmp-dev&lt;br /&gt;
&lt;br /&gt;
mkdir -p $HOME/alien-scripts&lt;br /&gt;
ln -s $ARCH_ROOT/$ARCH_HOME/ghc-7.6.3 $HOME/ghc-7.6.3&lt;br /&gt;
mkdir /tmp/ghc-bootstrap $ARCH_ROOT/tmp/ghc-bootstrap&lt;br /&gt;
sudo mount --bind /tmp/ghc-bootstrap $ARCH_ROOT/tmp/ghc-bootstrap&lt;br /&gt;
&lt;br /&gt;
case `uname -m` in&lt;br /&gt;
x86_64) ARCH=x86_64; T=$ARCH;;&lt;br /&gt;
i?86) ARCH=x86 T=i486;;&lt;br /&gt;
*) echo Unknown architecture;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
mkdir -p $HOME/buildroot-$ARCH/host/usr/bin/&lt;br /&gt;
cat &amp;lt;&amp;lt; &amp;quot;__EOF__&amp;quot; &amp;gt; $HOME/buildroot-$ARCH/host/usr/bin/$T-buildroot-linux-uclibc-gcc&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
/usr/bin/gcc -nopie &amp;quot;$@&amp;quot;&lt;br /&gt;
__EOF__&lt;br /&gt;
chmod +x $HOME/buildroot-$ARCH/host/usr/bin/$T-buildroot-linux-uclibc-gcc&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;Inside the Arch chroot&#039;&#039;&#039;, as the non-root user, do this:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|sudo pacman -S base-devel python2 wget ghc openssh&lt;br /&gt;
ssh-keygen&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
You can give the ssh key a passphrase, but it&#039;s not necessary.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
Back in the &#039;&#039;&#039;outside Alpine system&#039;&#039;&#039;, do this:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;cat $ARCH_ROOT/$ARCH_HOME/.ssh/id_rsa.pub &amp;gt;&amp;gt; $HOME/.ssh/authorized_keys&lt;br /&gt;
sudo paxctl -cm $ARCH_ROOT/usr/lib/ghc-7.6.3/ghc&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
Returning again to &#039;&#039;&#039;the Arch chroot&#039;&#039;&#039;, do:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|eval `ssh-agent`&lt;br /&gt;
ssh-add}}&lt;br /&gt;
&lt;br /&gt;
and unlock your ssh key if you gave it a passphrase. Now from this Arch session, we can do a password-less ssh or scp to the outside Alpine system.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
Still inside the Arch chroot, do:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;mkdir -p sources &amp;amp;&amp;amp; cd sources&lt;br /&gt;
&lt;br /&gt;
wget -N http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-src.tar.bz2&lt;br /&gt;
wget -N http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-testsuite.tar.bz2&lt;br /&gt;
&lt;br /&gt;
mkdir -p patches/ghc/7.6.3 &amp;amp;&amp;amp; cd patches/ghc/7.6.3&lt;br /&gt;
GIST_BASE=https://gist.github.com/dubiousjim/5607734/raw&lt;br /&gt;
wget -N $GIST_BASE/configure.patch&lt;br /&gt;
wget -N $GIST_BASE/libraries-configure.patch&lt;br /&gt;
wget -N $GIST_BASE/h_wcwidth.patch&lt;br /&gt;
&lt;br /&gt;
cd $HOME/sources&lt;br /&gt;
cat &amp;lt;&amp;lt; &amp;quot;__EOF__&amp;quot; &amp;gt; alien&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
PORT=22 # change if you use different ssh port on your Alpine system&lt;br /&gt;
CMD=$2; shift 2&lt;br /&gt;
set -x&lt;br /&gt;
scp -P$PORT &amp;quot;$CMD&amp;quot; $USER@localhost:alien-scripts/ || exit 1&lt;br /&gt;
ssh -p$PORT $USER@localhost alien-scripts/&amp;quot;${CMD##*/}&amp;quot; &amp;quot;$@&amp;quot;&lt;br /&gt;
__EOF__&lt;br /&gt;
cat &amp;lt;&amp;lt; &amp;quot;__EOF__&amp;quot; &amp;gt; alien-ghc&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
PORT=22 # change if you use different ssh port on your Alpine system&lt;br /&gt;
set -x&lt;br /&gt;
ssh -p$PORT $USER@localhost &amp;quot;sh -c &#039;cd $PWD; $0.exe $*&#039;&amp;quot;&lt;br /&gt;
__EOF__&lt;br /&gt;
chmod +x alien alien-ghc&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
The two alien scripts assume that you&#039;re working with the same username on both the Alpine and Arch systems; if that&#039;s incorrect, then replace &amp;lt;code&amp;gt;$USER&amp;lt;/code&amp;gt; with the relevant Alpine username. The alien-ghc script also assumes that you won&#039;t be working underneath any directories whose names need escaping for the shell.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
Still inside the Arch chroot, do this:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;cd&lt;br /&gt;
case `uname -m` in&lt;br /&gt;
x86_64) ARCH=x86_64; T=$ARCH;;&lt;br /&gt;
i?86) ARCH=x86 T=i486;;&lt;br /&gt;
*) echo Unknown architecture;;&lt;br /&gt;
esac&lt;br /&gt;
&lt;br /&gt;
tar -xjf sources/ghc-7.6.3-src.tar.bz2&lt;br /&gt;
# next is optional, if you want to ...&lt;br /&gt;
# tar -xjf sources/ghc-7.6.3-testsuite.tar.bz2&lt;br /&gt;
BUILDROOT=$HOME/buildroot-$ARCH&lt;br /&gt;
export PATH=$HOME/python2-path:$PATH:$BUILDROOT/host/usr/bin&lt;br /&gt;
cd ghc-7.6.3&lt;br /&gt;
sed -e &#039;s/^#BuildFlavour = unreg/BuildFlavour = unreg/&#039; mk/build.mk.sample &amp;gt; mk/build.mk&lt;br /&gt;
patch -p1 -i $HOME/sources/patches/ghc/7.6.3/configure.patch&lt;br /&gt;
patch -p1 -i $HOME/sources/patches/ghc/7.6.3/libraries-configure.patch&lt;br /&gt;
patch -p1 -i $HOME/sources/patches/ghc/7.6.3/h_wcwidth.patch&lt;br /&gt;
&lt;br /&gt;
./configure --prefix=/tmp/ghc-bootstrap \&lt;br /&gt;
  --host=$T-buildroot-linux-uclibc \&lt;br /&gt;
  --target=$T-buildroot-linux-uclibc \&lt;br /&gt;
  --with-alien=$HOME/sources/alien 2&amp;gt;&amp;amp;1 | tee build.log&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
The [http://hackage.haskell.org/trac/ghc/wiki/Building/CrossCompiling GHC wiki page on cross-compiling] seems to suggest that you should omit the &amp;lt;code&amp;gt;--host=...&amp;lt;/code&amp;gt;, but if you compare the 7.6 and (at this point, pre-release) 7.7 GHC build system sources, you&#039;ll see that this is true (if at all) only post-7.6.&lt;br /&gt;
&lt;br /&gt;
Continue with:&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;make 2&amp;gt;&amp;amp;1 | tee -a build.log&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
The build will eventually fail with this error message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;.../buildroot-x86_64/host/usr/bin/x86_64-buildroot-linux-uclibc-gcc&amp;quot;  -fno-stack-protector   libraries/integer-gmp/cbits/mkGmpDerivedConstants.c -o libraries/integer-gmp/cbits/mkGmpDerivedConstants&lt;br /&gt;
libraries/integer-gmp/cbits/mkGmpDerivedConstants &amp;gt; libraries/integer-gmp/cbits/GmpDerivedConstants.h&lt;br /&gt;
/bin/sh: libraries/integer-gmp/cbits/mkGmpDerivedConstants: No such file or directory&lt;br /&gt;
make[1]: *** [libraries/integer-gmp/cbits/GmpDerivedConstants.h] Error 127&lt;br /&gt;
make[1]: *** Deleting file `libraries/integer-gmp/cbits/GmpDerivedConstants.h&#039;&lt;br /&gt;
make: *** [all] Error 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type this to continue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;$HOME/sources/alien run libraries/integer-gmp/cbits/mkGmpDerivedConstants \&lt;br /&gt;
  &amp;gt; libraries/integer-gmp/cbits/GmpDerivedConstants.h&lt;br /&gt;
make 2&amp;gt;&amp;amp;1 | tee -a build.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
A bit later, the build will again fail with this error message:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  HC [stage 1] libraries/base/dist-install/build/Foreign/C/Types.o&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:162:25:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_FLOAT&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:162:215:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_FLOAT&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:162:290:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_FLOAT&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:162:398:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_FLOAT&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:162:470:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_FLOAT&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:162:548:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_FLOAT&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:164:27:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_DOUBLE&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:164:219:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_DOUBLE&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:164:295:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_DOUBLE&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:164:405:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_DOUBLE&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:164:478:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_DOUBLE&#039;&lt;br /&gt;
&lt;br /&gt;
libraries/base/Foreign/C/Types.hs:164:557:&lt;br /&gt;
    Not in scope: type constructor or class `HTYPE_DOUBLE&#039;&lt;br /&gt;
make[1]: *** [libraries/base/dist-install/build/Foreign/C/Types.o] Error 1&lt;br /&gt;
make: *** [all] Error 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type this to continue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;cat &amp;lt;&amp;lt; __EOF__ &amp;gt;&amp;gt; libraries/base/include/HsBaseConfig.h&lt;br /&gt;
#define HTYPE_DOUBLE Double&lt;br /&gt;
#define HTYPE_FLOAT Float&lt;br /&gt;
__EOF__&lt;br /&gt;
make 2&amp;gt;&amp;amp;1 | tee -a build.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
The {{Path|HsBaseConfig.h}} file is only generated during the build, so you can&#039;t make this change ahead&lt;br /&gt;
of time; you have to wait for the build to fail, make the change, and then reissue &amp;lt;code&amp;gt;make&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Finally, the build will fail a third time with this error:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  HC [stage 2] utils/ghctags/dist-install/build/Main.o&lt;br /&gt;
inplace/bin/ghc-stage2: line 7: .../ghc-7.6.3/inplace/lib/ghc-stage2: No such file or directory&lt;br /&gt;
make[1]: *** [utils/ghctags/dist-install/build/Main.o] Error 127&lt;br /&gt;
make: *** [all] Error 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type this to continue:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;mv inplace/lib/ghc-stage2 inplace/lib/ghc-stage2.exe&lt;br /&gt;
cp $HOME/sources/alien-ghc inplace/lib/ghc-stage2&lt;br /&gt;
make 2&amp;gt;&amp;amp;1 | tee -a build.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After this, the build should complete. We still have to do a bit of work to get it to install properly, though. Do this:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;mkdir -p /tmp/ghc-bootstrap/lib/ghc-7.6.3&lt;br /&gt;
mv ghc/stage2/build/tmp/ghc-stage2 /tmp/ghc-bootstrap/lib/ghc-7.6.3/ghc.exe&lt;br /&gt;
mv utils/ghc-pkg/dist-install/build/tmp/ghc-pkg /tmp/ghc-bootstrap/lib/ghc-7.6.3/ghc-pkg.exe&lt;br /&gt;
cp $HOME/sources/alien-ghc ghc/stage2/build/tmp/ghc-stage2&lt;br /&gt;
cp $HOME/sources/alien-ghc utils/ghc-pkg/dist-install/build/tmp/ghc-pkg&lt;br /&gt;
make install 2&amp;gt;&amp;amp;1 | tee -a build.log&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Once the installation finishes, clean up with:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;cd /tmp/ghc-bootstrap&lt;br /&gt;
mv lib/ghc-7.6.3/ghc.exe lib/ghc-7.6.3/ghc&lt;br /&gt;
mv lib/ghc-7.6.3/ghc-pkg.exe lib/ghc-7.6.3/ghc-pkg&lt;br /&gt;
for f in bin/*-buildroot-linux-uclibc-*; do mv $f bin/${f#*-uclibc-}; done&lt;br /&gt;
ln -sf ghc-7.6.3 bin/ghc&lt;br /&gt;
ln -sf ghc-pkg-7.6.3 bin/ghc-pkg&lt;br /&gt;
cd -&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt;&amp;lt;div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now switch back to your &#039;&#039;&#039;outside Alpine system&#039;&#039;&#039; and do this:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|&amp;lt;nowiki&amp;gt;paxctl -cm /tmp/ghc-bootstrap/lib/ghc-7.6.3/ghc&lt;br /&gt;
sudo umount $ARCH_ROOT/tmp/ghc-bootstrap&lt;br /&gt;
sed -i -e &#039;s|&amp;quot;C compiler command&amp;quot;,.*|&amp;quot;C compiler command&amp;quot;, &amp;quot;/usr/bin/gcc&amp;quot;),|&#039; \&lt;br /&gt;
       -e &#039;s|&amp;quot;C compiler flags&amp;quot;, &amp;quot;|&amp;quot;C compiler flags&amp;quot;, &amp;quot; -nopie |&#039; /tmp/ghc-bootstrap/lib/ghc-7.6.3/settings&lt;br /&gt;
rm -r $HOME/alien-scripts $HOME/buildroot-$ARCH&lt;br /&gt;
rm $HOME/ghc-7.6.3&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Now everything in your Alpine system is cleaned up, and you&#039;ve got a working GHC installation in {{Path|/tmp/ghc-bootstrap}}, which the Alpine APKBUILD for ghc will recognize and use. You can delete the {{Path|$ARCH_HOME/ghc-7.6.3}} folder inside your Arch chroot now, and close that session.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/OL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
(I will prepare an Alpine APKBUILD for ghc, and arrange with the dev team how to make the initial binaries available, soon.)&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Wowaname</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=17793</id>
		<title>Raspberry Pi</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Raspberry_Pi&amp;diff=17793"/>
		<updated>2020-07-07T07:23:14Z</updated>

		<summary type="html">&lt;p&gt;Wowaname: /* Preparation */ make wiki link internal&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{TOC right}}&lt;br /&gt;
&lt;br /&gt;
This tutorial will help you install Alpine Linux on your Raspberry Pi.&lt;br /&gt;
&lt;br /&gt;
== Preparation ==&lt;br /&gt;
&lt;br /&gt;
# [http://alpinelinux.org/downloads/ Download] the Alpine for Raspberry Pi tarball. You should be safe using the &#039;&#039;&#039;armhf&#039;&#039;&#039; build on all versions of Raspberry Pi (including Pi Zero and Compute Modules); but it may perform less optimally on recent versions of Raspberry Pi. The &#039;&#039;&#039;armv7&#039;&#039;&#039; build is compatible with Raspberry Pi 2 Model B. The &#039;&#039;&#039;aarch64&#039;&#039;&#039; build should be compatible with Raspberry Pi 2 Model v1.2, Raspberry Pi 3 and Compute Module 3, and Raspberry Pi 4 model B.&lt;br /&gt;
# [[Create a Bootable USB#Format USB stick|Create a bootable FAT32 partition on your SD card.]] You can use a partitioning tool such as [https://en.wikipedia.org/wiki/GNOME_Disks gnome-disks] or [http://linux.die.net/man/8/fdisk fdisk].&lt;br /&gt;
# Create a filesystem on the partition with &amp;lt;code&amp;gt;mkdosfs -F 32 /dev/sdX1&amp;lt;/code&amp;gt; (Replace sdX1 with the correct reference to the partition you just created.)&lt;br /&gt;
# Mount the partition and extract the tarball contents unto it.&lt;br /&gt;
&lt;br /&gt;
Optionally create a &#039;&#039;&#039;usercfg.txt&#039;&#039;&#039; file on the partition to configure low-level system settings. Specifications can be found [https://www.raspberrypi.org/documentation/configuration/config-txt here]. Some interesting values include:&lt;br /&gt;
* To enable audio: &amp;lt;code&amp;gt;dtparam=audio=on&amp;lt;/code&amp;gt;&lt;br /&gt;
* 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;&lt;br /&gt;
&lt;br /&gt;
Recent versions include Broadcom firmware files. If you&#039;re using an older Alpine version, see [[#Wireless_support_with_older_Alpine_images|section below]].&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Alpine Linux will be installed as [[Installation#Installation_Handbook|diskless mode]], hence you need to use [[Alpine local backup|Alpine Local Backup (lbu)]] to save your modifications between reboots.  Follow these steps to install Alpine Linux:&lt;br /&gt;
&lt;br /&gt;
# Insert the SD card into the Raspberry Pi and turn it on&lt;br /&gt;
# Login into the Alpine system as root.  Leave the password empty.&lt;br /&gt;
# Type &amp;lt;code&amp;gt;setup-alpine&amp;lt;/code&amp;gt;&lt;br /&gt;
# Once the installation is complete, commit the changes by typing &amp;lt;code&amp;gt;lbu commit -d&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Type &amp;lt;code&amp;gt;reboot&amp;lt;/code&amp;gt; to verify that the installation was indeed successful.&lt;br /&gt;
&lt;br /&gt;
== Post Installation ==&lt;br /&gt;
&lt;br /&gt;
=== Update the System ===&lt;br /&gt;
&lt;br /&gt;
Upon installation, make sure that your system is up-to-date:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk update&lt;br /&gt;
apk upgrade}}&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to save the changes:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d}}&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.  The Raspberry Pi does not have&lt;br /&gt;
a hardware clock and therefore you need to disable the hwclock daemon and enable swclock:&lt;br /&gt;
&lt;br /&gt;
{{cmd|rc-update add swclock boot    # enable the software clock&lt;br /&gt;
rc-update del hwclock boot    # disable the hardware clock}}&lt;br /&gt;
&lt;br /&gt;
Since Raspberry Pi does not have a clock, the Alpine Linux needs to know what the time is by using a&lt;br /&gt;
[https://en.wikipedia.org/wiki/Network_Time_Protocol Network Time Protocol (NTP)] daemon.  Make sure that you a&lt;br /&gt;
NTP daemon installed and running.  If you are not sure, then you can install NTP client by running the following&lt;br /&gt;
command:&lt;br /&gt;
&lt;br /&gt;
{{cmd|setup-ntp}}&lt;br /&gt;
&lt;br /&gt;
The Busybox NTP client might be the most lightweight solution.  Save the changes and reboot, once the NTP software is&lt;br /&gt;
installed and running:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu commit -d&lt;br /&gt;
reboot}}&lt;br /&gt;
&lt;br /&gt;
After reboot, make sure that the &amp;lt;code&amp;gt;date&amp;lt;/code&amp;gt; command outputs the correct date and time.&lt;br /&gt;
&lt;br /&gt;
=== WiFi on boot ===&lt;br /&gt;
If you have already [[Connecting_to_a_wireless_access_point|configured WiFi]] during the setup, the connection will not return on reboot.&lt;br /&gt;
You will need to start up a service to automatically connect to the wireless access point.&lt;br /&gt;
# Run &amp;lt;code&amp;gt;rc-update add wpa_supplicant boot&amp;lt;/code&amp;gt; to connect to the wireless access point on boot.&lt;br /&gt;
# Run it manually with &amp;lt;code&amp;gt;/etc/init.d/wpa_supplicant start&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Enable OpenGL (Raspberry Pi 3) ===&lt;br /&gt;
&lt;br /&gt;
Remount the boot partition writeable (ie. /media/mmcblk0p1):&lt;br /&gt;
&lt;br /&gt;
{{cmd|mount -o remount,rw /media/mmcblk0p1}}&lt;br /&gt;
&lt;br /&gt;
Add the following lines to /media/mmcblk0p1/config.txt &lt;br /&gt;
&lt;br /&gt;
 dtoverlay=vc4-kms-v3d&lt;br /&gt;
 gpu_mem=128&lt;br /&gt;
&lt;br /&gt;
256MB gpu_mem is also possible&lt;br /&gt;
&lt;br /&gt;
Install mesa-dri-vc4:&lt;br /&gt;
{{cmd|apk add mesa-dri-vc4}}&lt;br /&gt;
&lt;br /&gt;
Reboot:&lt;br /&gt;
&lt;br /&gt;
{{cmd|lbu_commit -d; reboot}}&lt;br /&gt;
&lt;br /&gt;
== Persistent storage ==&lt;br /&gt;
&lt;br /&gt;
=== Loopback image with overlayfs ===&lt;br /&gt;
&lt;br /&gt;
The install is in diskless mode and forces everything into memory, if you want additional storage we need to create loop-back storage onto the SD mounted with overlayfs.&lt;br /&gt;
&lt;br /&gt;
First make the SD card writable again and change fstab to always do so:&lt;br /&gt;
{{cmd|mount /media/mmcblk0p1 -o rw,remount&lt;br /&gt;
sed -i &#039;s/vfat\ ro,/vfat\ rw,/&#039; /etc/fstab}}&lt;br /&gt;
&lt;br /&gt;
Create the loop-back file, this example is 1 GB:&lt;br /&gt;
&lt;br /&gt;
{{cmd|dd if&amp;amp;#61;/dev/zero of&amp;amp;#61;/media/mmcblk0p1/persist.img bs&amp;amp;#61;1024 count&amp;amp;#61;0 seek&amp;amp;#61;1048576}}&lt;br /&gt;
&lt;br /&gt;
Install the ext utilities:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs}}&lt;br /&gt;
&lt;br /&gt;
Format the loop-back file:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkfs.ext4 /media/mmcblk0p1/persist.img}}&lt;br /&gt;
&lt;br /&gt;
Mount the storage: &lt;br /&gt;
&lt;br /&gt;
{{cmd|echo &amp;quot;/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mkdir /media/persist &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Make the overlay folders, we are doing /usr here, but you can do /home or anything else:&lt;br /&gt;
&lt;br /&gt;
{{cmd|mkdir /media/persist/usr &lt;br /&gt;
mkdir /media/persist/.work &lt;br /&gt;
echo &amp;quot;overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab &lt;br /&gt;
mount -a}}&lt;br /&gt;
&lt;br /&gt;
Your /etc/fstab should look something like this:&lt;br /&gt;
{{Cmd|/dev/cdrom      /media/cdrom    iso9660 noauto,ro 0 0&lt;br /&gt;
/dev/usbdisk    /media/usb      vfat    noauto,ro 0 0&lt;br /&gt;
/dev/mmcblk0p1 /media/mmcblk0p1 vfat rw,relatime,fmask&amp;amp;#61;0022,dmask&amp;amp;#61;0022,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
/media/mmcblk0p1/persist.img /media/persist ext4 rw,relatime,errors&amp;amp;#61;remount-ro 0 0&lt;br /&gt;
overlay /usr overlay lowerdir&amp;amp;#61;/usr,upperdir&amp;amp;#61;/media/persist/usr,workdir&amp;amp;#61;/media/persist/.work 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now commit the changes: (optionally remove the e2fsprogs, but it does contain repair tools)&lt;br /&gt;
{{cmd|lbu_commit -d}}&lt;br /&gt;
&lt;br /&gt;
Remember with this setup, if you install things and you have done this overlay for /usr, you must not commit the &#039;apk add&#039;, otherwise while it boots it will try and install it to memory and not to the persist storage.&lt;br /&gt;
&lt;br /&gt;
If you do want to install something small at boot you can use `apk add` and `lbu commit -d`.&lt;br /&gt;
&lt;br /&gt;
If it is something a bit bigger then you can use `apk add` but then not commit it, it will be persistent (in /user), but do check everything you need is in that directory and not in folders you have not made persistent.&lt;br /&gt;
&lt;br /&gt;
=== Traditional disk-based (sys) installation ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|This isn&#039;t yet supported by the Alpine setup scripts for Raspberry Pi. It requires manual intervention, and might break.}}&lt;br /&gt;
&lt;br /&gt;
It is also possible to switch to a fully disk-based installation: this is not yet formally supported, but can be done somewhat manually. This frees all the memory otherwise needed for the root filesystem, allowing more installed packages.&lt;br /&gt;
&lt;br /&gt;
Split your SD card into two partitions: the FAT32 boot partition described above (in this example it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p1&amp;lt;/code&amp;gt;) , and a second partition to hold the root filesystem (here it&#039;ll be &amp;lt;code&amp;gt;mmcblk0p2&amp;lt;/code&amp;gt;). Boot and configure your diskless system as above, then create a root filesystem:&lt;br /&gt;
&lt;br /&gt;
{{cmd|apk add e2fsprogs&lt;br /&gt;
mkfs.ext4 /dev/mmcblk0p2}}&lt;br /&gt;
&lt;br /&gt;
Now do a disk install via a mountpoint. The &amp;lt;code&amp;gt;setup-disk&amp;lt;/code&amp;gt; script will give some errors about syslinux/extlinux, but you can ignore these: the Raspberry Pi doesn&#039;t need this to boot anyway.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mkdir /stage&lt;br /&gt;
mount /dev/mmcblk0p2 /stage&lt;br /&gt;
setup-disk -o /media/mmcblk0p1/MYHOSTNAME.apkovl.tar.gz /stage&lt;br /&gt;
# (ignore errors about syslinux/extlinux)&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Add a line to &amp;lt;code&amp;gt;/stage/etc/fstab&amp;lt;/code&amp;gt; to mount the Pi&#039;s boot partition again:&lt;br /&gt;
&lt;br /&gt;
{{cmd|/dev/mmcblk0p1 /media/mmcblk0p1 vfat defaults 0 0}}&lt;br /&gt;
&lt;br /&gt;
Now add a &amp;lt;code&amp;gt;root=/dev/mmcblk0p2&amp;lt;/code&amp;gt; parameter to the Pi&#039;s boot command line, either &amp;lt;code&amp;gt;cmdline-rpi2.txt&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;cmdline-rpi.txt&amp;lt;/code&amp;gt; depending on model:&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;mount -o remount,rw /media/mmcblk0p1&lt;br /&gt;
sed -i &#039;$ s/$/ root=\/dev\/mmcblk0p2/&#039; /media/mmcblk0p1/cmdline-rpi2.txt&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
You might also consider &amp;lt;code&amp;gt;overlaytmpfs=yes&amp;lt;/code&amp;gt; here, which will cause the underlying SD card root filesystem to be mounted read-only, with an overlayed tmpfs for modifications which will be discarded on shutdown.&lt;br /&gt;
&lt;br /&gt;
Beware, though, that &amp;lt;b&amp;gt;the contents of /boot will be ignored when the Pi boots&amp;lt;/b&amp;gt;: it will use the kernel, initramfs, and modloop images from the FAT32 boot partition. To update the kernel, initfs or modules, you will need to manually (generate and) copy these to the boot partition or you could use bind mount so that manually copy the files to boot partition is not needed.&lt;br /&gt;
&lt;br /&gt;
{{cmd|&amp;lt;nowiki&amp;gt;echo /media/mmcblk0p1/boot /boot none defaults,bind 0 0 &amp;gt;&amp;gt; /etc/fstab&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
=== Persistent Installation on Raspberry Pi 3 ===&lt;br /&gt;
&lt;br /&gt;
See this page : https://wiki.alpinelinux.org/wiki/Classic_install_or_sys_mode_on_Raspberry_Pi&lt;br /&gt;
&lt;br /&gt;
See https://web.archive.org/web/20171125115835/https://forum.alpinelinux.org/comment/1084#comment-1084&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&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.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Alternatively&#039;&#039;&#039;, installing haveged, the random numbers generator, would speed up the process : &lt;br /&gt;
&lt;br /&gt;
  apk update &lt;br /&gt;
  apk add haveged&lt;br /&gt;
  rc-update add haveged boot&lt;br /&gt;
  lbu commit -d&lt;br /&gt;
  service haveged start&lt;br /&gt;
&lt;br /&gt;
(Tested on a raspberry pi zero W headless mode, no USB connected, Alpine 3.10.3)&lt;br /&gt;
&lt;br /&gt;
=== apk indicating &#039;No space left on device&#039; ===&lt;br /&gt;
&lt;br /&gt;
Note some models of the Raspberry Pi such as the 3A+ only have 512M of RAM, which on fresh Alpine deployment will only leave around 200M for tmpfs root. It&#039;s important to keep this limitation in mind when using these boards.&lt;br /&gt;
&lt;br /&gt;
=== Wireless support with older Alpine images ===&lt;br /&gt;
&lt;br /&gt;
If you need WiFi to work, you have to [https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm download] the latest Broadcom drivers to your SD card. (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]] - a variant.&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;
* [[Create a bootable SDHC from a Mac]]&lt;br /&gt;
* Build custom Raspberry Pi images based on Alpine via [https://github.com/tolstoyevsky/pieman Pieman]&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials_and_Howtos#Raspberry_Pi]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
[[Category: Raspberry]]&lt;/div&gt;</summary>
		<author><name>Wowaname</name></author>
	</entry>
</feed>