Architecture: Difference between revisions

From Alpine Linux
m (Categorized: Hardware)
m (support for riscv)
 
(24 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{TOC right}}
{{draft}}
== Alpine Hardware Architecture ("arch") Support ==
== Alpine Hardware Architecture ("arch") Support ==
=== x86 Based ===
=== x86 Based ===
* [[x86]] - 32 bit x86 (ia32)
* [[x86]] - 32 bit x86 (ia32)
Line 5: Line 9:


=== ARM Based ===
=== ARM Based ===
* [[armhf]] - 32 bit ARM (hard-float ABI)
 
* [[aarch64]] - 64 bit ARM
See [[Alpine on ARM]].
 
* [[armhf]] - 32 bit ARM (hard-float ABI) - ARMv6
* [[armv7]] - 32 bit ARMv7
* [[aarch64]] - 64 bit ARM - ARMv8


=== PowerPC Based ===
=== PowerPC Based ===
Line 13: Line 21:
=== IBM System Z Based ===
=== IBM System Z Based ===
* [[s390x]]
* [[s390x]]
=== RISC V Based ===
* [[riscv64]] - 64 bit RISC V
=== LoongArch Based (planned) ===
* [[loongarch64]] - 64 bit LoongArch


== Alpine Packaging ==
== Alpine Packaging ==
Line 19: Line 33:


==== Alpine Package Building Ports ====
==== Alpine Package Building Ports ====
* [[APKBUILD]] - Package build scripts
* [[APKBUILD Reference|APKBUILD]] - Package build scripts
* [[aports]] - Official Alpine ports git repository
* [[Aports tree|aports]] - Official Alpine ports git repository


==== Package Building Tools ====
==== Package Building Tools ====
* [[abuild]]
* [[Abuild and Helpers|abuild]]
 


=== Package Format ===
=== Package Format ===
Alpine uses packages in the [[.apk file format]].
Alpine uses packages in the [[Apk_spec#Package_Format_V2|.apk file format]].


=== Package Management Tools ===
=== Package Management Tools ===
* [[apk]] - Alpine Package Keeper (see [[apk internals]] for more detail)
* [[Alpine Package Keeper|apk]] - Alpine Package Keeper (see [[Apk spec]] for more detail)


== Boot Process ==
== Boot Process ==


=== Boot Loader ===
=== Boot Loader ===
The bootloader is responsible for finding the initfs, cmdline and kernel, and handling execution over to the kernel.
Some bootloaders allow the user to interactively pick which OS or kernel to use (if more than one is available).
==== See also ====
* [https://wiki.archlinux.org/title/Boot%20loader Boot loader - Arch Wiki]
* [https://wiki.gentoo.org/wiki/Bootloader Bootloader - Gentoo Wiki]
==== EFI ====
==== EFI ====
* The default setup uses GRUB2.
* See also [[UEFI Secure Boot]]
==== BIOS ====
==== BIOS ====
* The default setup uses GRUB2.
==== Other ====
==== Other ====


Line 42: Line 72:
==== Versioning ====
==== Versioning ====
===== Flavors =====
===== Flavors =====
* vanilla
* lts - long-term support kernel, general purpose
* hardened
* virt - for running under virtual machines
* virthardened
* edge - Latest stable kernel
* rpi
* rpi - Raspberry Pi
* rpi2 - Raspberry Pi 2 (Alpine ≤v3.18 only, merged with rpi in current versions)
* rpi4 - Raspberry Pi 4 (Alpine ≤v3.18 only, merged with rpi in current versions)
* ashai - Apple M1


==== Signing ====
==== Signing ====
Line 56: Line 89:


==== '/init' Script ====
==== '/init' Script ====
Not to be confused with '/sbin/init', the '/init' script in the root of the 'rootfs' is called by the kernel upon completion of its boot process, and is responsible for doing whatever steps are necessary to mount the real root file system to '/' and transfer control to '/sbin/init'.
Not to be confused with <code>/sbin/init</code>([[#Init|see below]])
 
This script is in the root of the initfs filesystem and is called by the kernel upon completion of its boot process. It is responsible for doing whatever steps are necessary to mount the real root file system to <code>/</code> and hand over control to <code>/sbin/init</code>.


* Parses kernel command line options.
* Parses kernel command line options.
* Uses [[nlplug-findfs]] to discover devices.
* Uses [[nlplug-findfs]] to discover devices.
* [Optionally] prompts for disk encryption secrets and unlocked encrypted partitions.


==== Initfs Module Handling ====
==== Initfs Module Handling ====
Modules required to mount the root filesystem and boot must either built into the kernel or available from with the initramfs filesystem through use of appended initrd cpio.gz files provided by the [[bootloader]].
Modules required to mount the root filesystem and boot must either built into the kernel or available from with the initramfs filesystem through use of appended initrd cpio.gz files provided by the [[Bootloaders|bootloader]].


The /init script will first [[modprobe]] the modules specified by the modules= kernel command line option and by the name of the specified rootfs type. It will then load the contents of /etc/modules, which may include module options.
The /init script will first [[modprobe]] the modules specified by the modules= kernel command line option and by the name of the specified rootfs type. It will then load the contents of /etc/modules, which may include module options.
Line 68: Line 104:


==== Minimal Required Set ====
==== Minimal Required Set ====
{{todo|{{path|/media}} is not required even tough it is included in the {{pkg|alpine-baselayout}}}}
===== Directory Structure =====
===== Directory Structure =====
* / /bin /boot /dev /etc /lib /lib/modules /media /media/cdrom /media/usb /mnt /proc /sbin /sys /usr /usr/bin /usr/sbin
* / /bin /boot /dev /etc /lib /lib/modules /media /media/cdrom /media/usb /mnt /proc /sbin /sys /usr /usr/bin /usr/sbin
Line 93: Line 131:


=== Init ===
=== Init ===
Not to be confused with the '/init' script in the initramfs, '/sbin/init' is the first process to be started in the live system after the initramfs completes its work.
<code>/sbin/init</code> is the first process to be started in the live system after the initramfs completes its work. It is part of the [https://www.busybox.net/ Busybox] package and should not be confused with the <code>/init</code> script [[Architecture#'/init'_Script|mentioned above]].


==== Module Loading ====
==== Loading of Kernel Modules ====
'/etc/init.d/modules' loads all modules specified in '/etc/modules' and '/(etc|run|usr/lib|lib)/modules-load.d/*.conf'
<code>/etc/init.d/modules</code> loads all modules specified in <code>/etc/modules</code> and <code>/(etc|run|usr/lib|lib)/modules-load.d/*.conf</code>


[[Category:Hardware]]
[[Category:Hardware]]
[[Category:Newbie]]

Latest revision as of 21:53, 22 May 2024

This material is work-in-progress ...

Do not follow instructions here until this notice is removed.
(Last edited by Fossdd on 22 May 2024.)

Alpine Hardware Architecture ("arch") Support

x86 Based

  • x86 - 32 bit x86 (ia32)
  • x86_64 - 64 bit x86 (amd64)

ARM Based

See Alpine on ARM.

  • armhf - 32 bit ARM (hard-float ABI) - ARMv6
  • armv7 - 32 bit ARMv7
  • aarch64 - 64 bit ARM - ARMv8

PowerPC Based

  • ppc64le - 64 bit PowerPC (little-endian)

IBM System Z Based

RISC V Based

LoongArch Based (planned)

Alpine Packaging

Package Building

Alpine Package Building Ports

  • APKBUILD - Package build scripts
  • aports - Official Alpine ports git repository

Package Building Tools

Package Format

Alpine uses packages in the .apk file format.

Package Management Tools

  • apk - Alpine Package Keeper (see Apk spec for more detail)

Boot Process

Boot Loader

The bootloader is responsible for finding the initfs, cmdline and kernel, and handling execution over to the kernel.

Some bootloaders allow the user to interactively pick which OS or kernel to use (if more than one is available).

See also

EFI

BIOS

  • The default setup uses GRUB2.

Other

Kernel

Versioning

Flavors
  • lts - long-term support kernel, general purpose
  • virt - for running under virtual machines
  • edge - Latest stable kernel
  • rpi - Raspberry Pi
  • rpi2 - Raspberry Pi 2 (Alpine ≤v3.18 only, merged with rpi in current versions)
  • rpi4 - Raspberry Pi 4 (Alpine ≤v3.18 only, merged with rpi in current versions)
  • ashai - Apple M1

Signing

Command line options

  • modules="<modules>" - specify list of modules to be loaded by initramfs /init needed to mount real root filesystem.

Initfs

The kernel will decompress the stream of compressed cpio archives passed to it by the 'append' bootloader option to the root of 'rootfs', a tmpfs automatically mounted at '/' by the kernel at boot.

'/init' Script

Not to be confused with /sbin/init(see below)

This script is in the root of the initfs filesystem and is called by the kernel upon completion of its boot process. It is responsible for doing whatever steps are necessary to mount the real root file system to / and hand over control to /sbin/init.

  • Parses kernel command line options.
  • Uses nlplug-findfs to discover devices.
  • [Optionally] prompts for disk encryption secrets and unlocked encrypted partitions.

Initfs Module Handling

Modules required to mount the root filesystem and boot must either built into the kernel or available from with the initramfs filesystem through use of appended initrd cpio.gz files provided by the bootloader.

The /init script will first modprobe the modules specified by the modules= kernel command line option and by the name of the specified rootfs type. It will then load the contents of /etc/modules, which may include module options. Modules may be blacklisted from autoprobing (but NOT explicit insertion!) using the blacklist= kernel command line option which appends blacklist entries to '/etc/modprobe.d/boot-opt-blacklist.conf'.

Minimal Required Set

Todo: /media is not required even tough it is included in the alpine-baselayout


Directory Structure
  • / /bin /boot /dev /etc /lib /lib/modules /media /media/cdrom /media/usb /mnt /proc /sbin /sys /usr /usr/bin /usr/sbin
Devices
  • /dev/null
  • /dev/console
  • /dev/kmsg
Mounts
  • /proc
  • /sys
  • /dev (can be disabled?)
Configuration
  • /etc/passwd
  • /etc/group
  • /etc/fstab
Binaries

Feature Sets

Feature sets consist of lists for the set of modules and files that need to be included in a final initramfs to support the indicated feature.

Init

/sbin/init is the first process to be started in the live system after the initramfs completes its work. It is part of the Busybox package and should not be confused with the /init script mentioned above.

Loading of Kernel Modules

/etc/init.d/modules loads all modules specified in /etc/modules and /(etc|run|usr/lib|lib)/modules-load.d/*.conf