<?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=Liliace</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=Liliace"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Liliace"/>
	<updated>2026-04-25T20:07:32Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Podman&amp;diff=30489</id>
		<title>Podman</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Podman&amp;diff=30489"/>
		<updated>2025-07-20T01:44:13Z</updated>

		<summary type="html">&lt;p&gt;Liliace: Add how to get podman socket&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[https://podman.io/ Podman] is a utility provided as part of the libpod library. It can be used to create and maintain containers. Podman (Pod Manager) is a fully featured container engine that is a simple daemonless tool. &lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
&lt;br /&gt;
Podman can be installed via {{Pkg|podman}} package in the community repository: {{Cmd|# apk add podman}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
To run podman you&#039;ll need to enable the &amp;lt;code&amp;gt;cgroups&amp;lt;/code&amp;gt; service. {{Cmd|&amp;lt;nowiki&amp;gt;# rc-update add cgroups&lt;br /&gt;
# rc-service cgroups start&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
In the past cgroups v2 needs to be enabled in OpenRC. Currently this is the default setting in [[OpenRC#cgroups v2|cgroups v2]].&lt;br /&gt;
&lt;br /&gt;
If you are running on top of [[Btrfs]], consider setting storage driver to &amp;lt;code&amp;gt;btrfs&amp;lt;/code&amp;gt;: {{Cmd|$ cat /etc/containers/storage.conf | grep &#039;driver =&#039;}}&lt;br /&gt;
 driver = &amp;quot;btrfs&amp;quot;&lt;br /&gt;
If you&#039;re running podman inside a container, change the storage driver to &amp;lt;code&amp;gt;vfs&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might need to restart your machine at this stage for the above changes to work properly.&lt;br /&gt;
&lt;br /&gt;
=== Running as root ===&lt;br /&gt;
&lt;br /&gt;
No further steps are required to run as root. Run an example container to verify everything works: {{Cmd|# podman run --rm hello-world}}&lt;br /&gt;
&lt;br /&gt;
=== Running in rootless mode ===&lt;br /&gt;
&lt;br /&gt;
To run podman in rootless mode, run the following commands. Replace &amp;lt;USER&amp;gt; with your username in the following commands: {{Cmd|&amp;lt;nowiki&amp;gt;# modprobe tun&lt;br /&gt;
# echo tun &amp;gt;&amp;gt;/etc/modules&lt;br /&gt;
# echo &amp;lt;USER&amp;gt;:100000:65536 &amp;gt;/etc/subuid&lt;br /&gt;
# echo &amp;lt;USER&amp;gt;:100000:65536 &amp;gt;/etc/subgid &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Run an example container to verify everything works: {{Cmd|$ podman run --rm hello-world}}&lt;br /&gt;
&lt;br /&gt;
=== Getting socket ===&lt;br /&gt;
You do not need the socket if you are only using the podman CLI locally.&lt;br /&gt;
If you want to use the podman API or use podman remotely, you need the podman socket.&lt;br /&gt;
You can get it by starting the podman service: {{Cmd|rc-service podman start}}&lt;br /&gt;
The default location of the socket is {{Path|/run/podman/podman.sock}}.&lt;br /&gt;
&lt;br /&gt;
=== Shared mount ===&lt;br /&gt;
&lt;br /&gt;
Containers on linux might require filesystems to be mounted with different propagation than the kernel default of &#039;private&#039;.  &lt;br /&gt;
{{Cmd|$ findmnt -o PROPAGATION /}} will produce the following output:&lt;br /&gt;
 PROPAGATION&lt;br /&gt;
 private&lt;br /&gt;
&lt;br /&gt;
This section explains few ways to mount your root(&#039;&#039;&#039;/&#039;&#039;&#039;) as shared for Distrobox to function. This is not needed when running in rootless mode. &lt;br /&gt;
&lt;br /&gt;
Method1:&lt;br /&gt;
Fill in the file {{path|/etc/local.d/mount-rshared.start}} as follows:{{Cat|/etc/local.d/mount-rshared.start|&amp;lt;nowiki&amp;gt;#!/bin/sh&lt;br /&gt;
mount --make-rshared /&amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Mark it as executable:  {{cmd|# chmod +x /etc/local.d/mount-rshared.start}}&lt;br /&gt;
&lt;br /&gt;
Then enable the service to autostart through [[OpenRC]]. {{cmd|&amp;lt;nowiki&amp;gt;# rc-update add local default&lt;br /&gt;
# rc-service local start &amp;lt;/nowiki&amp;gt;}}&lt;br /&gt;
&lt;br /&gt;
Method2: &lt;br /&gt;
An alternate solution with OpenRC v0.54.2-r1 onwards, edit the file {{path|/etc/fstab}} and add {{ic|shared}} option to the root partition such that:{{Cat|/etc/fstab|...&lt;br /&gt;
/dev/sda2 / ext4 rw,relatime,shared 0 1&lt;br /&gt;
...}}&lt;br /&gt;
&lt;br /&gt;
For both the above cases, after a reboot test the working of shared &#039;&#039;&#039;/&#039;&#039;&#039; mount using the command: {{Cmd|# findmnt -o PROPAGATION /}} which will produce the following output:&lt;br /&gt;
 PROPAGATION&lt;br /&gt;
 shared&lt;br /&gt;
&lt;br /&gt;
=== Docker compose ===&lt;br /&gt;
&lt;br /&gt;
The {{Pkg|podman-compose}} package from provides a drop-in replacement for docker compose.  Each time a docker compose is used, a warning will remind that this is using podman under the hood. This warning can be squelched permanently by running: {{cmd|# touch /etc/containers/nodocker}}&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting == &lt;br /&gt;
&lt;br /&gt;
===  &amp;quot;/&amp;quot; is not a shared mount ===&lt;br /&gt;
&lt;br /&gt;
If you see a warning:&lt;br /&gt;
: WARN[0000] &amp;quot;/&amp;quot; is not a shared mount, this could cause issues or missing mounts with rootless containers &lt;br /&gt;
&lt;br /&gt;
You might want to fix this temporarily, for currently running system by issuing the command:{{ic|# mount --make-rshared /}}&lt;br /&gt;
Alternately, refer to [[#Shared mount|Shared mount]] section for permanent solution(s).&lt;br /&gt;
&lt;br /&gt;
[[Category:Virtualization]]&lt;/div&gt;</summary>
		<author><name>Liliace</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26679</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=26679"/>
		<updated>2024-05-05T06:28:50Z</updated>

		<summary type="html">&lt;p&gt;Liliace: say we only need one of the two configurations before giving instructions on the first configuration&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;
[https://alpinelinux.org/downloads/ Download] the Alpine for Raspberry Pi tarball. Use the [[Raspberry_Pi#Compability_list|compatibility list]] when choosing image/file to download.&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;
If using the UART is required, add a file named &amp;lt;code&amp;gt;usercfg.txt&amp;lt;/code&amp;gt; into the partition containing 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;
From here we can either update boot partition to keep the alpine-rpi* image layout&lt;br /&gt;
or to keep the system partition/setup-alpine&#039;s layout (see next section).&lt;br /&gt;
We only need one of the two. Not both.&lt;br /&gt;
&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;
 cd /media/mmcblk0p1&lt;br /&gt;
 mkdir boot&lt;br /&gt;
 cd ..&lt;br /&gt;
 cd boot &lt;br /&gt;
 mv boot/* /media/mmcblk0p1/  &lt;br /&gt;
 cd ..&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) and 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>Liliace</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Classic_install_or_sys_mode_on_Raspberry_Pi&amp;diff=26678</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=26678"/>
		<updated>2024-05-05T06:11:08Z</updated>

		<summary type="html">&lt;p&gt;Liliace: fix formatting and 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;
[https://alpinelinux.org/downloads/ Download] the Alpine for Raspberry Pi tarball. Use the [[Raspberry_Pi#Compability_list|compatibility list]] when choosing image/file to download.&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;
If using the UART is required, add a file named &amp;lt;code&amp;gt;usercfg.txt&amp;lt;/code&amp;gt; into the partition containing 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;
 cd /media/mmcblk0p1&lt;br /&gt;
 mkdir boot&lt;br /&gt;
 cd ..&lt;br /&gt;
 cd boot &lt;br /&gt;
 mv boot/* /media/mmcblk0p1/  &lt;br /&gt;
 cd ..&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) and 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>Liliace</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Custom_Kernel&amp;diff=22974</id>
		<title>Custom Kernel</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Custom_Kernel&amp;diff=22974"/>
		<updated>2023-02-16T07:28:30Z</updated>

		<summary type="html">&lt;p&gt;Liliace: fix typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Draft}}&lt;br /&gt;
&lt;br /&gt;
This process of building a &#039;&#039;&#039;custom configured kernel&#039;&#039;&#039; assumes you are running on Alpine Linux utilizing abuild &amp;amp; aports.&lt;br /&gt;
&lt;br /&gt;
== But why? ==&lt;br /&gt;
&lt;br /&gt;
You want to build a custom kernel to enable experimental hardware or features or outdated hardware, to reduce bloat further, to tune the kernel to the hardware.&lt;br /&gt;
&lt;br /&gt;
The lts kernel for most Alpine ARCHs uses defaults to balance throughput at the expense of some responsiveness, and support for many devices.  You can tweak the kernel for desktop use and low latency and responsiveness.&lt;br /&gt;
&lt;br /&gt;
You should disable modules to increase security.  By default, Alpine will install modules but not disable most of them.  Disabling modules will reduce an DMA attack but not eliminate it completely.  If you have a newer processor with VT-d, you can mitigate as long as you:&lt;br /&gt;
&lt;br /&gt;
Leave CONFIG_INTEL_IOMMU_DEFAULT_ON=y or pass intel_iommu=on as a kernel parameter and disable kernel logging so the attacker doesn&#039;t gain DMAR address information through dmesg.[http://blog.frizk.net/2016/11/disable-virtualization-based-security.html]  Also remove references to the kernel version to calculate the IOMMU addresses.[https://link.springer.com/content/pdf/10.1186/s13173-017-0066-7.pdf]&lt;br /&gt;
&lt;br /&gt;
To increase the security of the boot process, if you have a TPM, you could set CONFIG_INTEL_TXT=y (Enable Intel(R) Trusted Execution Technology (Intel(R) TXT)) (which is not enabled in the hardened kernel by default), then you would need the SINIT module (provided only by Intel)[https://software.intel.com/en-us/articles/intel-trusted-execution-technology], a possibly compiled TrustedGrub2[https://github.com/Rohde-Schwarz-Cybersecurity/TrustedGRUB2], trousers[https://sourceforge.net/projects/trousers/?source=navbar], tboot[https://sourceforge.net/projects/tboot/].  These packages are not in aports and it is unknown if these tools work on musl.  It&#039;s not recommended for Edge.  Also, there would be trigger packages to generate hashes for the kernel and the mkinitfs updates.&lt;br /&gt;
&lt;br /&gt;
== Setting up the Alpine Build System ==&lt;br /&gt;
&lt;br /&gt;
First, you need to follow the steps in [[Creating_an_Alpine_package#Setup_your_system_and_account|Setup your system and account for building packages]].  You also need to configure your /etc/apk/repositories so that they search locally for your apks.  See [[Creating_an_Alpine_package#Testing_the_package_locally|Testing the package locally]] for details.&lt;br /&gt;
&lt;br /&gt;
After setting up accounts and repos, change your shell&#039;s current working directory to &#039;&#039;&#039;aports&#039;&#039;&#039; that you just cloned.&lt;br /&gt;
&lt;br /&gt;
    cd aports&lt;br /&gt;
&lt;br /&gt;
== Working with aports ==&lt;br /&gt;
&lt;br /&gt;
We will try using an existing lts kernel just tweaking the lts.ARCH.config file.  &lt;br /&gt;
&lt;br /&gt;
=== Switching to the proper release version ===&lt;br /&gt;
&lt;br /&gt;
You need to switch to the proper branch that matches the release so that the kernel compiles against the dependencies properly.&lt;br /&gt;
&lt;br /&gt;
{| cellpadding=&amp;quot;5&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|- &lt;br /&gt;
! Alpine version&lt;br /&gt;
! Remote branch&lt;br /&gt;
|-&lt;br /&gt;
| Edge&lt;br /&gt;
| master&lt;br /&gt;
|-&lt;br /&gt;
| 3.7.0&lt;br /&gt;
| 3.7-stable&lt;br /&gt;
|- &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The following is required to get access to the APKBUILD released for that version of Alpine and which you will create a commit for.&lt;br /&gt;
&lt;br /&gt;
If you are on 3.7 do:&lt;br /&gt;
&lt;br /&gt;
  git checkout -b 3.7-stable origin/3.7-stable&lt;br /&gt;
&lt;br /&gt;
If you are on Edge do:&lt;br /&gt;
&lt;br /&gt;
  git checkout master&lt;br /&gt;
&lt;br /&gt;
=== Creating your config ===&lt;br /&gt;
&lt;br /&gt;
You can use linux-lts but what you should do is create a local branch by doing:&lt;br /&gt;
&lt;br /&gt;
For Alpine Edge:&lt;br /&gt;
&lt;br /&gt;
  git checkout -b my-custom-kernel&lt;br /&gt;
&lt;br /&gt;
For Alpine 3.7:&lt;br /&gt;
&lt;br /&gt;
  git checkout -b my-custom-kernel origin/3.7-stable&lt;br /&gt;
&lt;br /&gt;
Doing it this way, you do less work in maintaining.  All you need to do is keep &#039;&#039;master&#039;&#039; or &#039;&#039;3.7-stable&#039;&#039; in sync[https://help.github.com/articles/syncing-a-fork/][https://help.github.com/articles/configuring-a-remote-for-a-fork/] and merge any conflicts.  &lt;br /&gt;
&lt;br /&gt;
First switch to the branch by doing &amp;lt;code&amp;gt;git checkout my-custom-kernel&amp;lt;/code&amp;gt;.  Then, you need to navigate to the &#039;&#039;main/linux-lts&#039;&#039; folder where you should see a APKBUILD and some config- files.  When you are done with your edits either by editing directly the APKBUILD and copying the lts.ARCH.config as .config in the linux-4.15 folder.  You will then move the .config back overriding the lts.ARCH.config generated by &amp;lt;code&amp;gt;make menuconfig&amp;lt;/code&amp;gt; (discussed below in the &#039;&#039;Configuring kernel&#039;&#039; section).  After generating your config, you need to &amp;lt;code&amp;gt;abuild checksum&amp;lt;/code&amp;gt;.  Then, do &amp;lt;code&amp;gt;git add APKBUILD lts.ARCH.config&amp;lt;/code&amp;gt; where ARCH is whatever architecture (x86, x86_64, ...) you use.  Then, you need to do &amp;lt;code&amp;gt;git commit APKBUILD config-NAME.ARCH -m &amp;quot;Enabled these options ....&amp;quot;&amp;lt;/code&amp;gt; for your customization the ARCHitecture of your system.  You do this so that git can keep your code separate from Alpine&#039;s and so your changes float forward between kernel updates.&lt;br /&gt;
&lt;br /&gt;
== Adding custom patches ==&lt;br /&gt;
&lt;br /&gt;
Custom patches should be added to &#039;&#039;sources=&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
After you added the URL, you need to produce a checksum by doing &amp;lt;code&amp;gt;abuild checksum&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The custom patches may not be autopatched, due to being distributed as an archive or different patch level, so you need to define what to do with it in the prepare().&lt;br /&gt;
&lt;br /&gt;
== Configuring kernel ==&lt;br /&gt;
&lt;br /&gt;
Attempt to build the kernel first.  To do that, you do abuild -rK to install most of the dependencies.  If it complains about a dependency like elfutils-dev use -rKd.  Then, when it prompts for values for new found config options just hold enter till it starts compiling the kernel.  There should be two sets one for -lts and the other for the -virt.  Just Ctrl+C out of the compilation process after the second set so you can further customize the config.  Then you go into the src/linux-VER and edit the config file.  Copy the .config file overriding the lts.ARCH.config in the srcdir.&lt;br /&gt;
&lt;br /&gt;
The alternative is to use the kernel configuration menu in the build-NAME folder, but before yo do that you need to &amp;lt;code&amp;gt;sudo apk add ncurses-dev&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you are done using the menu in the build-NAME folder by doing &amp;lt;code&amp;gt;make menuconfig&amp;lt;/code&amp;gt;, you want to remove &amp;lt;code&amp;gt;ncurses-dev&amp;lt;/code&amp;gt;.  When you are done, it will be stored in &#039;&#039;.config&#039;&#039; which you need to again override the lts.ARCH.config file.  When you are done updating the config-NAME.ARCH, you need to do &amp;lt;code&amp;gt;abuild checksum&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The options in the kernel config are typically defaults.  If your device is old, it may be set to n by default.&lt;br /&gt;
&lt;br /&gt;
=== Vanilla targets and tuning ===&lt;br /&gt;
&lt;br /&gt;
{|cellpadding=&amp;quot;5&amp;quot; border=&amp;quot;1&amp;quot; class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!ARCH&lt;br /&gt;
!Processor Type / CPU Selection / System Type&lt;br /&gt;
!Code Generation / Instruction Extensions&lt;br /&gt;
!Timer Frequency&lt;br /&gt;
!Preemption Model&lt;br /&gt;
!Bitness&lt;br /&gt;
|-&lt;br /&gt;
|s390x&lt;br /&gt;
|IBM zEnterprise 114 and 196&lt;br /&gt;
|IBM zBC12 and zEC12 (&amp;lt;code&amp;gt;-march=zEC12 -mtune=zEC12&amp;lt;/code&amp;gt;)&lt;br /&gt;
|100 Hz&lt;br /&gt;
|No Forced Preemption (Server)&lt;br /&gt;
|64&lt;br /&gt;
|-&lt;br /&gt;
|ppc64le&lt;br /&gt;
|Server processors&lt;br /&gt;
|POWER8 (&amp;lt;code&amp;gt;-mcpu=power8&amp;lt;/code&amp;gt;), AltiVec (&amp;lt;code&amp;gt;-Wa,-maltivec&amp;lt;/code&amp;gt; to assembler or &amp;lt;code&amp;gt;-maltivec -mabi=altivec&amp;lt;/code&amp;gt;), VSX&lt;br /&gt;
|100 HZ&lt;br /&gt;
|No Forced Preemption (Server)&lt;br /&gt;
|64&lt;br /&gt;
|-&lt;br /&gt;
|ppc&lt;br /&gt;
|&lt;br /&gt;
512x/52xx/6xx/7xx/74xx/82xx/83xx/86xx&lt;br /&gt;
* Apple PowerMac based machines&lt;br /&gt;
|AltiVec (&amp;lt;code&amp;gt;-Wa,-maltivec&amp;lt;/code&amp;gt; to assembler or &amp;lt;code&amp;gt;-maltivec -mabi=altivec&amp;lt;/code&amp;gt;) on &amp;gt;=74xx&lt;br /&gt;
|250 HZ&lt;br /&gt;
|No Forced Preemption (Server)&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
|x86_64&lt;br /&gt;
|Generic-x86-64&lt;br /&gt;
|(-mtune=generic ; SIMD assembly modules enabled based on simple compile test and/or presence of CPU flag)&lt;br /&gt;
|300 HZ&lt;br /&gt;
|Voluntary Kernel Preemption (Desktop)&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
|x86&lt;br /&gt;
|586/K5/5x86/6x86/6x86MX&lt;br /&gt;
|(-mtune=generic ; SIMD assembly modules enabled based on simple compile test and/or presence of CPU flag)&lt;br /&gt;
|300 HZ&lt;br /&gt;
|Voluntary Kernel Preemption (Desktop)&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
|armhf&lt;br /&gt;
|&lt;br /&gt;
* ARMv7 based platforms (Cortex-A, PJ4, Scorpion, Krait)&lt;br /&gt;
* Freescale i.MX family -- Cortex A (i.MX51, i.MX53, i.MX6 Quad/DualLite, i.MX6 SoloLite, i.MX6 SoloX, i.MX6 UltraLite, i.MX7 Dual)&lt;br /&gt;
* Qualcomm -- (MSM8X60, MSM8960, MSM8974)&lt;br /&gt;
* Allwinner SoCs -- (A10 (sun4i), A10s / A13 (sun5i), A31 (sun6i), A20 (sun7i), sun8i Family, (sun9i))&lt;br /&gt;
* ARM Ldt Versatile Express family -- &lt;br /&gt;
|Either &amp;lt;code&amp;gt;-march=armv7-a&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-march=armv5t -Wa,-march=armv7-a&amp;lt;/code&amp;gt; based on a compile test. &amp;lt;code&amp;gt;-mfpu=vfp&amp;lt;/code&amp;gt;&lt;br /&gt;
|100 Hz&lt;br /&gt;
|Voluntary Kernel Preemption (Desktop)&lt;br /&gt;
|32&lt;br /&gt;
|-&lt;br /&gt;
|aarch64&lt;br /&gt;
|&lt;br /&gt;
* Allwinner sunxi 64-bit SoC Family&lt;br /&gt;
* Broadcom BCM2835 family&lt;br /&gt;
* Marvell Berlin SoC Family&lt;br /&gt;
* ARMv8 based Samsung Exynos SoC family&lt;br /&gt;
* ARMv8 based Freescale Layerscape SoC family&lt;br /&gt;
* Hisilicon SoC Family&lt;br /&gt;
* Mediatek MT65xx &amp;amp; MT81xx ARMv8 SoC&lt;br /&gt;
* Marvell EBU SoC Family&lt;br /&gt;
* Qualcomm Platforms&lt;br /&gt;
* Rockchip Platforms&lt;br /&gt;
* AMD Seattle SoC Family&lt;br /&gt;
* Altera&#039;s Stratix 10 SoCFPGA Family&lt;br /&gt;
* NVIDIA Tegra SoC Family&lt;br /&gt;
* Spreadtrum SoC platform&lt;br /&gt;
* Cavium Inc. Thunder SoC Family&lt;br /&gt;
* ARMv8 software model (Versatile Express)&lt;br /&gt;
* AppliedMicro X-Gene SOC Family&lt;br /&gt;
* Xilinx ZynqMP Family&lt;br /&gt;
|&lt;br /&gt;
|300 HZ&lt;br /&gt;
|Voluntary Kernel Preemption (Desktop)&lt;br /&gt;
|64&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
If you do desktop multitasking, you may want to switch to Voluntary Kernel Preemption (Desktop) or Preemptible Kernel (Low-Latency Desktop) and up the Timer Frequency.  If you run a dedicated render farm node or a dedicated bitcoin miner use No Forced Preemption (Server) and decrease the Timer Frequency.&lt;br /&gt;
&lt;br /&gt;
Optimized modules (most are already compiled as modules):&lt;br /&gt;
* raid6 -- altivec, avx512, ssse3, avx2, mmx, sse, sse2, neon&lt;br /&gt;
* some operations of raid5 -- mmx (32 bit), sse (64 bit), avx&lt;br /&gt;
For Kernel API:&lt;br /&gt;
* 32-bit memcpy -- 3dnow&lt;br /&gt;
* 32-bit memory page clearing and copying -- sse (Athlon/K7 only), mmx&lt;br /&gt;
From x86/crypto, arm/crypto, powerpc/crypto:&lt;br /&gt;
* CAMELLIA -- avx2, avx, aes-ni&lt;br /&gt;
* CHACHA20 -- avx2, neon&lt;br /&gt;
* CAST5 -- avx&lt;br /&gt;
* CAST6 -- avx&lt;br /&gt;
* TWOFISH -- avx&lt;br /&gt;
* SERPENT -- avx2, avx, sse2&lt;br /&gt;
* SHA1 -- avx2, ssse3, neon, spe&lt;br /&gt;
* SHA2 -- avx2&lt;br /&gt;
* SHA256 -- ssse3, neon, spe&lt;br /&gt;
* SHA512 -- avx2, ssse3, neon&lt;br /&gt;
* POLY1305 -- avx2&lt;br /&gt;
* GHASH -- pclmulqdq (part of aes-ni), vmx (power8)&lt;br /&gt;
* AES -- aes-ni, neon, vmx (power8), spe&lt;br /&gt;
* CRC32 -- pclmulqdq, sse, neon, vmx (power8)&lt;br /&gt;
* CRCT10DIF -- pclmulqdq, sse, neon, vmx (power8)&lt;br /&gt;
&lt;br /&gt;
=== Fast reboots with kexec ===&lt;br /&gt;
&lt;br /&gt;
If you want to reboot the kernel fast avoiding the POST test, you need &amp;lt;code&amp;gt;sudo apk add kexec-tools&amp;lt;/code&amp;gt; and enable kexec in the kernel:&lt;br /&gt;
&lt;br /&gt;
  Processor type and features&lt;br /&gt;
    [*] kexec system call&lt;br /&gt;
&lt;br /&gt;
=== Hibernation to prevent data loss ===&lt;br /&gt;
&lt;br /&gt;
  Power management and ACPI options&lt;br /&gt;
    [*] Hibernation (aka &#039;suspend to disk&#039;)&lt;br /&gt;
&lt;br /&gt;
Hibernation should be used if you have a laptop.  You don&#039;t want the laptop to suddenly shut off resulting in data loss, you want it to save your work based on a percentage of battery life (this requires special script).  When you do hibernation and when it restores back, it should lock down the computer and ask for prompt.  Depending on your needs, the hibernated image can be encrypted/decrypted which again requires additional customization to scripts.&lt;br /&gt;
&lt;br /&gt;
Hibernation with an unsanitized swap file is generally insecure because data and unlocked memory pages is swapped out in plaintext.  To increase the security either disable swap (Alpine default) or use an encrypted swap.  The swap file/partition is typically used as a dump of the hibernated image.&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Before building, you may want to remove as many modules as possible.  This will reduce the time to compile greatly.  Also, you may want to use cache for faster recompiles especially if you are searching for the minimal set of options or modules to use or include.&lt;br /&gt;
&lt;br /&gt;
You should then do an &amp;lt;code&amp;gt;abuild -r&amp;lt;/code&amp;gt; to attempt to build it.&lt;br /&gt;
&lt;br /&gt;
== Installing ==&lt;br /&gt;
&lt;br /&gt;
To install it you do a &amp;lt;code&amp;gt;sudo apk add linux-NAME&amp;lt;/code&amp;gt; where NAME is your custom kernel name.&lt;br /&gt;
&lt;br /&gt;
== Testing ==&lt;br /&gt;
&lt;br /&gt;
Before you test, you should install the lts kernel too, using &amp;lt;code&amp;gt;sudo apk add linux-hardened&amp;lt;/code&amp;gt;.  You may be missing a module and can&#039;t boot, so you use the other kernel as the fallback boot kernel.  Don&#039;t forget to update your bootloader configuration.&lt;br /&gt;
&lt;br /&gt;
To test, first you should make a bootable Alpine USB image.  Then, when you have your rescue USB done, you &amp;lt;code&amp;gt;doas reboot&amp;lt;/code&amp;gt; the computer.&lt;br /&gt;
&lt;br /&gt;
To test it, you basically do trial and error.  Sometimes your config is missing something if you want to have a bare minimum setting.&lt;br /&gt;
&lt;br /&gt;
If you are curious about correctness testing, some kernel modules or components do preform self tests at the beginning of the boot process.  The tools may have test suites that you run with the make command.&lt;br /&gt;
&lt;br /&gt;
[[Category:Kernel]]&lt;/div&gt;</summary>
		<author><name>Liliace</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Include:Setup_your_system_and_account_for_building_packages&amp;diff=22973</id>
		<title>Include:Setup your system and account for building packages</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Include:Setup_your_system_and_account_for_building_packages&amp;diff=22973"/>
		<updated>2023-02-15T23:36:01Z</updated>

		<summary type="html">&lt;p&gt;Liliace: provide more precise location of abuild.conf&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The {{Pkg|alpine-sdk}} is a metapackage that pulls in the most essential packages used to build new packages. Also install and configure a way to elevate privileges, such as sudo or doas, and an editor, such as vi, nano, micro.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# apk add alpine-sdk}}&lt;br /&gt;
&lt;br /&gt;
This would be a good time to [[Setting_up_a_new_user|create a normal user account for you to work in]]. To make life easier later, it&#039;s a good idea to add this user to the wheel group; operations that require superuser privileges can now be done with sudo or doas.&lt;br /&gt;
&lt;br /&gt;
The [[Aports_tree|aports tree]] is in git so before we clone it, let&#039;s configure git.&lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ git config --global user.name &amp;quot;Your Full Name&amp;quot;&lt;br /&gt;
$ git config --global user.email &amp;quot;your@email.address&amp;quot;}}&lt;br /&gt;
&lt;br /&gt;
Read carefully [[Development using git]] to grasp basic Git operations and how to configure for sending email patches.&lt;br /&gt;
&lt;br /&gt;
Now we can clone the [[Aports_tree|aports tree]]. &lt;br /&gt;
&lt;br /&gt;
{{Cmd|$ git clone https://gitlab.alpinelinux.org/alpine/aports}}&lt;br /&gt;
&lt;br /&gt;
Before we start creating or modifying [[APKBUILD_Reference|APKBUILD]] files, we need to setup abuild for our system and user. Edit the file {{Path|/etc/abuild.conf}} to your requirements.&lt;br /&gt;
&lt;br /&gt;
Most of the defaults can be left alone, unless you are developing for a custom platform, in which case the comments in the file should guide you. The one field to edit is PACKAGER, so that you can get credit (or blame) for packages you create.&lt;br /&gt;
&lt;br /&gt;
To use &#039;abuild -r&#039; command to install dependency packages automatically.&lt;br /&gt;
{{Cmd|# addgroup &amp;lt;yourusername&amp;gt; abuild}}&lt;br /&gt;
&lt;br /&gt;
We also need to prepare the location where the build process caches files when they are downloaded. By default this is {{Path|/var/cache/distfiles/}}. To create this directory and ensure that it is writeable, enter the following commands:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# mkdir -p /var/cache/distfiles}}&lt;br /&gt;
{{Cmd|# chmod a+w /var/cache/distfiles}}&lt;br /&gt;
&lt;br /&gt;
As an alternative to the second command, you can add yourself to the abuild group:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# chgrp abuild /var/cache/distfiles}}&lt;br /&gt;
{{Cmd|# chmod g+w /var/cache/distfiles}}&lt;br /&gt;
&lt;br /&gt;
{{Note|Remember to logout and login again for the group change to have effect.}}&lt;br /&gt;
&lt;br /&gt;
The last step is to configure the security keys with the [[Abuild-keygen|abuild-keygen]] script for [[Abuild|abuild]] with the command:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|# abuild-keygen -a -i}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Development]]&lt;/div&gt;</summary>
		<author><name>Liliace</name></author>
	</entry>
</feed>