Initramfs init: Difference between revisions

From Alpine Linux
m (→‎Usage: cmd and path templates used.)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{draft}}
[https://gitlab.alpinelinux.org/alpine/mkinitfs '''mkinitfs'''] is a tool to create initramfs images. Initramfs images are small images which contain a small filesystem with everything required to boot Alpine. For example, when booting a setup with [[Setting up encrypted volumes with LUKS|full disk encryption]], the initramfs contains the binaries required to prompt for a password and mount the encrypted disk.
==Usage==
 
== Usage ==
Under a running alpine machine, the following command can be used if for some reason the initramfs has not been created properly for a new kernel.  
Under a running alpine machine, the following command can be used if for some reason the initramfs has not been created properly for a new kernel.  
  {{cmd|mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>}}
  {{cmd|mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>}}
The script is located in {{path|/sbin/}} and is created with ash. It expects {{path|/lib/modules}} to be populated with the <kernelvers> listed. For variations on this command (e.g. for chroot) Search "mkinitfs".
The script is located in {{path|/sbin/}} and is created with ash. It expects {{path|/lib/modules}} to be populated with the <code><kernelvers></code> listed. For variations on this command (e.g. for chroot) Search "mkinitfs".


== initramfs init cmdline options (work in progress) ==
== initramfs init cmdline options ==


In addition to the [https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html kernel boot parameters] are a number of parameters that the init script understands.
In addition to the [https://www.kernel.org/doc/html/v4.14/admin-guide/kernel-parameters.html kernel boot parameters] are a number of parameters that the init script understands. These are documented in the <code>mkinitfs-bootparam(7)</code> man page.


Although you may specify your own init script when building an initramfs, these parameters allow for extensive control over the initial startup of an Alpine Linux system.
Although you may specify your own init script when building an initramfs, these parameters allow for extensive control over the initial startup of an Alpine Linux system.


<code>quiet</code> : less verbose init script execution
== See Also ==
 
* [https://wiki.postmarketos.org/wiki/The_initramfs PostmarketOS Wiki]
<code>debug_init</code> : sets '-x' in the init script and -d for mdev
* [https://wiki.archlinux.org/title/Arch_boot_process#initramfs ArchWiki boot process]
 
<code>chart</code> : Enables bootchartd for measuring system startup speed.
 
<code>ip=dhcp</code> : use DHCP for network configuration.
 
<code>ip=client-ip:server-ip:gw-ip:netmask:hostname:device:autoconf:dns1:dns2</code> : use static IP configuration, each field is separated by a colon <code>:</code>
* <code>client-ip</code> ip address of the guest VM where we are going to run the installer
* <code>server-ip</code> not used, leave blank or fill with <code>none</code>
* <code>gw-ip</code>    the gateway ip address
* <code>netmask</code>  the netmask
* <code>hostname</code>  not used, leave blank or fill with <code>none</code>
* <code>device</code>    the network interface of the guest VM, default is <code>eth0</code> if left blank
* <code>autoconf</code>  not used, leave blank or fill with <code>none</code> or <code>off</code>
* <code>dns1</code>      address of the DNS server
* <code>dns2</code>      address of the 2nd DNS server
 
<code>modloop=URL</code> : the remote location of the image containing kernel's modules, required for LVM and raid setup.
 
:The remote location of the <code>modloop</code> image is the same as the kernel and initramfs (see below).
 
<code>blacklist=MODULE{,MODULE}</code> : This comma-separated list names kernel modules that modprobe will reject to load.
 
<code>alpine_repo=URL</code> : the location of the Alpine repository from which packages are downloaded.
 
:For stable release, use <code>http://dl-cdn.alpinelinux.org/alpine/v3.9/main</code>
 
:For rolling release, use <code>http://dl-cdn.alpinelinux.org/alpine/edge/main</code>
 
<code>ssh_key=URL</code> : the remote location of your SSH public key. It will be added to root's authorized_keys. Also triggers OpenSSH-server to be installed and started.
 
<code>apkovl=URL</code> : Unpack the APK Overlay file from this URL. Happens immediately after network is up . This option will set the default  for service install and setup to false. (see .default_boot_services).
 
(work in progress)
 
* init=
* init_args=
 
* dasd=
* s390x_net=
* rootfstype=
* modules=
* crytptroot=
* cryptdm=
* cryptheader=
* cryptoffset=
* cryptkey=
* nbd=
* root=
* resume
* rootflags
* usbdelay
* pkgs=
* ssh_key=
* keep_apk_new
* splash=
* ...
 


[[category:Kernel]]
[[category:Kernel]]
[[Category:Booting]]

Latest revision as of 05:48, 12 November 2024

mkinitfs is a tool to create initramfs images. Initramfs images are small images which contain a small filesystem with everything required to boot Alpine. For example, when booting a setup with full disk encryption, the initramfs contains the binaries required to prompt for a password and mount the encrypted disk.

Usage

Under a running alpine machine, the following command can be used if for some reason the initramfs has not been created properly for a new kernel.

mkinitfs -c /etc/mkinitfs/mkinitfs.conf -b / <kernelvers>

The script is located in /sbin/ and is created with ash. It expects /lib/modules to be populated with the <kernelvers> listed. For variations on this command (e.g. for chroot) Search "mkinitfs".

initramfs init cmdline options

In addition to the kernel boot parameters are a number of parameters that the init script understands. These are documented in the mkinitfs-bootparam(7) man page.

Although you may specify your own init script when building an initramfs, these parameters allow for extensive control over the initial startup of an Alpine Linux system.

See Also