<?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=Ferneu</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=Ferneu"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Ferneu"/>
	<updated>2026-05-10T13:04:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_make_a_custom_ISO_image_with_mkimage&amp;diff=17959</id>
		<title>How to make a custom ISO image with mkimage</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_make_a_custom_ISO_image_with_mkimage&amp;diff=17959"/>
		<updated>2020-08-02T22:37:17Z</updated>

		<summary type="html">&lt;p&gt;Ferneu: /* Create the ISO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document explains how to build a custom ISO image using the new mkimage scripts located in [[aports]] directory.&lt;br /&gt;
&lt;br /&gt;
== Prerequisite ==&lt;br /&gt;
&lt;br /&gt;
First make sure we have the needed tools&lt;br /&gt;
{{Cmd|apk add alpine-sdk build-base apk-tools alpine-conf busybox fakeroot syslinux xorriso squashfs-tools}}&lt;br /&gt;
For efi you should add&lt;br /&gt;
{{Cmd|mtools dosfstools grub-efi}}&lt;br /&gt;
&lt;br /&gt;
Create a user (e.g. build) and add it to abuild group:&lt;br /&gt;
{{Cmd|adduser build -G abuild}}&lt;br /&gt;
&lt;br /&gt;
Then create signing keys (-i installs them in /etc/apk/keys which is required for later)&lt;br /&gt;
{{Cmd|abuild-keygen -i -a}}&lt;br /&gt;
&lt;br /&gt;
{{Tip| Make sure your public keys are placed in /etc/apk/keys/ (example: build-xxxxxxxx.rsa.pub)}}&lt;br /&gt;
{{Cmd|ls /etc/apk/keys/}}&lt;br /&gt;
&lt;br /&gt;
Clone (or update) the [http://git.alpinelinux.org/cgit/aports/ git repository].&lt;br /&gt;
{{Cmd|git clone git://git.alpinelinux.org/aports}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure the apk index is up to date (so apk finds the packages):&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The mkimg scripts are shipped with pre-configured profiles.&lt;br /&gt;
&lt;br /&gt;
The format is &#039;&#039;&#039;mkimg.$PROFILENAME.sh&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So, in order to have a custom ISO, you should create your own &#039;&#039;&#039;mkimg.$PROFILENAME.sh&#039;&#039;&#039; script.&lt;br /&gt;
&lt;br /&gt;
This is an example used to have ZFS module, overlayfs (which allows to have /lib/modules in r/w), a serial console output and some other useful apks to build a simple NAS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;export PROFILENAME=nas&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ~/aports/scripts/mkimg.$PROFILENAME.sh&lt;br /&gt;
profile_$PROFILENAME() {&lt;br /&gt;
        profile_standard&lt;br /&gt;
        kernel_cmdline=&amp;quot;unionfs_size=512M console=tty0 console=ttyS0,115200&amp;quot;&lt;br /&gt;
        syslinux_serial=&amp;quot;0 115200&amp;quot;&lt;br /&gt;
        kernel_addons=&amp;quot;zfs spl&amp;quot;&lt;br /&gt;
        apks=&amp;quot;\$apks iscsi-scst zfs-scripts zfs zfs-utils-py&lt;br /&gt;
                cciss_vol_status lvm2 mdadm mkinitfs mtools nfs-utils&lt;br /&gt;
                parted rsync sfdisk syslinux unrar util-linux xfsprogs&lt;br /&gt;
                dosfstools ntfs-3g&lt;br /&gt;
                &amp;quot;&lt;br /&gt;
        local _k _a&lt;br /&gt;
        for _k in \$kernel_flavors; do&lt;br /&gt;
                apks=&amp;quot;\$apks linux-\$_k&amp;quot;&lt;br /&gt;
                for _a in \$kernel_addons; do&lt;br /&gt;
                        apks=&amp;quot;\$apks \$_a-\$_k&amp;quot;&lt;br /&gt;
                done&lt;br /&gt;
        done&lt;br /&gt;
        apks=&amp;quot;\$apks linux-firmware&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the script as executable:&lt;br /&gt;
{{Cmd|chmod +x mkimg.$PROFILENAME.sh}}&lt;br /&gt;
&lt;br /&gt;
== Making packages available on boot ==&lt;br /&gt;
&lt;br /&gt;
A package may be made available in the live system by defining the generation of an apkovl which contains a corresponding /etc/apk/world file, and adding that overlay definition to the mkimg-profile, e.g. with `apkovl=&amp;quot;genapkovl-mkimgoverlay.sh&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
The definition may be done as in the [https://git.alpinelinux.org/aports/tree/scripts/genapkovl-dhcp.sh genapkovl-dhcp.sh] example.&lt;br /&gt;
Copy the relevant parts (including the rc_add lines) into a `genapkovl-mkimgoverlay.sh` file and add the package(s) that should be installed in the live system on separate lines in the file contents for /etc/apk/world.&lt;br /&gt;
&lt;br /&gt;
== Create the ISO ==&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkimage.sh	[--tag RELEASE] [--outdir OUTDIR] [--workdir WORKDIR]&lt;br /&gt;
		[--arch ARCH] [--profile PROFILE] [--hostkeys] [--simulate]&lt;br /&gt;
		[--repository REPO] [--extra-repository REPO] [--yaml FILE]&lt;br /&gt;
mkimage.sh	--help&lt;br /&gt;
&lt;br /&gt;
options:&lt;br /&gt;
--arch			Specify which architecture images to build&lt;br /&gt;
			(default: x86_64)&lt;br /&gt;
--hostkeys		Copy system apk signing keys to created images&lt;br /&gt;
--outdir		Specify directory for the created images&lt;br /&gt;
--profile		Specify which profiles to build&lt;br /&gt;
--repository		Package repository to use for the image create&lt;br /&gt;
--extra-repository	Add repository to search packages from&lt;br /&gt;
--simulate		Don&#039;t execute commands&lt;br /&gt;
--tag			Build images for tag RELEASE&lt;br /&gt;
--workdir		Specify temporary working directory (cache)&lt;br /&gt;
--yaml&lt;br /&gt;
&lt;br /&gt;
known profiles: ali rpi uboot base minirootfs standard vanilla extended virt xen}}&lt;br /&gt;
&lt;br /&gt;
{{Tip| You can use the --repository option multiple times, which is very useful when mixing local and official repositories. The --extra-repository option is only there for backward-compatibility.}}&lt;br /&gt;
&lt;br /&gt;
Create a iso directory in your home dir:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir -p ~/iso}}&lt;br /&gt;
&lt;br /&gt;
Then create the actual ISO.&lt;br /&gt;
In this example we will use the edge version x86_64:&lt;br /&gt;
{{Cmd|sh mkimage.sh --tag edge \&lt;br /&gt;
	--outdir ~/iso \&lt;br /&gt;
	--arch x86_64 \&lt;br /&gt;
	--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \&lt;br /&gt;
	--profile $PROFILENAME&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Of course, several passages of this doc can be automated with a script, like the repository/arch/outdir settings.&lt;br /&gt;
This steps are left to you and to your imagination :)&lt;br /&gt;
&lt;br /&gt;
== Testing your ISO image ==&lt;br /&gt;
&lt;br /&gt;
[[Qemu#Live_mode| Qemu]] is useful for a quick test of your created ISO image.&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
[[Category:ISO]]&lt;/div&gt;</summary>
		<author><name>Ferneu</name></author>
	</entry>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=How_to_make_a_custom_ISO_image_with_mkimage&amp;diff=17958</id>
		<title>How to make a custom ISO image with mkimage</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=How_to_make_a_custom_ISO_image_with_mkimage&amp;diff=17958"/>
		<updated>2020-08-02T22:36:05Z</updated>

		<summary type="html">&lt;p&gt;Ferneu: /* Create the ISO */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document explains how to build a custom ISO image using the new mkimage scripts located in [[aports]] directory.&lt;br /&gt;
&lt;br /&gt;
== Prerequisite ==&lt;br /&gt;
&lt;br /&gt;
First make sure we have the needed tools&lt;br /&gt;
{{Cmd|apk add alpine-sdk build-base apk-tools alpine-conf busybox fakeroot syslinux xorriso squashfs-tools}}&lt;br /&gt;
For efi you should add&lt;br /&gt;
{{Cmd|mtools dosfstools grub-efi}}&lt;br /&gt;
&lt;br /&gt;
Create a user (e.g. build) and add it to abuild group:&lt;br /&gt;
{{Cmd|adduser build -G abuild}}&lt;br /&gt;
&lt;br /&gt;
Then create signing keys (-i installs them in /etc/apk/keys which is required for later)&lt;br /&gt;
{{Cmd|abuild-keygen -i -a}}&lt;br /&gt;
&lt;br /&gt;
{{Tip| Make sure your public keys are placed in /etc/apk/keys/ (example: build-xxxxxxxx.rsa.pub)}}&lt;br /&gt;
{{Cmd|ls /etc/apk/keys/}}&lt;br /&gt;
&lt;br /&gt;
Clone (or update) the [http://git.alpinelinux.org/cgit/aports/ git repository].&lt;br /&gt;
{{Cmd|git clone git://git.alpinelinux.org/aports}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure the apk index is up to date (so apk finds the packages):&lt;br /&gt;
{{Cmd|apk update}}&lt;br /&gt;
&lt;br /&gt;
== Configuration ==&lt;br /&gt;
&lt;br /&gt;
The mkimg scripts are shipped with pre-configured profiles.&lt;br /&gt;
&lt;br /&gt;
The format is &#039;&#039;&#039;mkimg.$PROFILENAME.sh&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
So, in order to have a custom ISO, you should create your own &#039;&#039;&#039;mkimg.$PROFILENAME.sh&#039;&#039;&#039; script.&lt;br /&gt;
&lt;br /&gt;
This is an example used to have ZFS module, overlayfs (which allows to have /lib/modules in r/w), a serial console output and some other useful apks to build a simple NAS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;export PROFILENAME=nas&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; ~/aports/scripts/mkimg.$PROFILENAME.sh&lt;br /&gt;
profile_$PROFILENAME() {&lt;br /&gt;
        profile_standard&lt;br /&gt;
        kernel_cmdline=&amp;quot;unionfs_size=512M console=tty0 console=ttyS0,115200&amp;quot;&lt;br /&gt;
        syslinux_serial=&amp;quot;0 115200&amp;quot;&lt;br /&gt;
        kernel_addons=&amp;quot;zfs spl&amp;quot;&lt;br /&gt;
        apks=&amp;quot;\$apks iscsi-scst zfs-scripts zfs zfs-utils-py&lt;br /&gt;
                cciss_vol_status lvm2 mdadm mkinitfs mtools nfs-utils&lt;br /&gt;
                parted rsync sfdisk syslinux unrar util-linux xfsprogs&lt;br /&gt;
                dosfstools ntfs-3g&lt;br /&gt;
                &amp;quot;&lt;br /&gt;
        local _k _a&lt;br /&gt;
        for _k in \$kernel_flavors; do&lt;br /&gt;
                apks=&amp;quot;\$apks linux-\$_k&amp;quot;&lt;br /&gt;
                for _a in \$kernel_addons; do&lt;br /&gt;
                        apks=&amp;quot;\$apks \$_a-\$_k&amp;quot;&lt;br /&gt;
                done&lt;br /&gt;
        done&lt;br /&gt;
        apks=&amp;quot;\$apks linux-firmware&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the script as executable:&lt;br /&gt;
{{Cmd|chmod +x mkimg.$PROFILENAME.sh}}&lt;br /&gt;
&lt;br /&gt;
== Making packages available on boot ==&lt;br /&gt;
&lt;br /&gt;
A package may be made available in the live system by defining the generation of an apkovl which contains a corresponding /etc/apk/world file, and adding that overlay definition to the mkimg-profile, e.g. with `apkovl=&amp;quot;genapkovl-mkimgoverlay.sh&amp;quot;`&lt;br /&gt;
&lt;br /&gt;
The definition may be done as in the [https://git.alpinelinux.org/aports/tree/scripts/genapkovl-dhcp.sh genapkovl-dhcp.sh] example.&lt;br /&gt;
Copy the relevant parts (including the rc_add lines) into a `genapkovl-mkimgoverlay.sh` file and add the package(s) that should be installed in the live system on separate lines in the file contents for /etc/apk/world.&lt;br /&gt;
&lt;br /&gt;
== Create the ISO ==&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkimage.sh	[--tag RELEASE] [--outdir OUTDIR] [--workdir WORKDIR]&lt;br /&gt;
		[--arch ARCH] [--profile PROFILE] [--hostkeys] [--simulate]&lt;br /&gt;
		[--repository REPO] [--extra-repository REPO] [--yaml FILE]&lt;br /&gt;
mkimage.sh	--help&lt;br /&gt;
&lt;br /&gt;
options:&lt;br /&gt;
--arch			Specify which architecture images to build&lt;br /&gt;
			(default: x86_64)&lt;br /&gt;
--hostkeys		Copy system apk signing keys to created images&lt;br /&gt;
--outdir		Specify directory for the created images&lt;br /&gt;
--profile		Specify which profiles to build&lt;br /&gt;
--repository		Package repository to use for the image create&lt;br /&gt;
--extra-repository	Add repository to search packages from&lt;br /&gt;
--simulate		Don&#039;t execute commands&lt;br /&gt;
--tag			Build images for tag RELEASE&lt;br /&gt;
--workdir		Specify temporary working directory (cache)&lt;br /&gt;
--yaml&lt;br /&gt;
&lt;br /&gt;
known profiles: ali rpi uboot base minirootfs standard vanilla extended virt xen}}&lt;br /&gt;
&lt;br /&gt;
You can use the --repository option multiple times, which is very useful when mixing local and official repositories. The --extra-repository option is only there for backward-compatibility.&lt;br /&gt;
&lt;br /&gt;
Create a iso directory in your home dir:&lt;br /&gt;
&lt;br /&gt;
{{Cmd|mkdir -p ~/iso}}&lt;br /&gt;
&lt;br /&gt;
Then create the actual ISO.&lt;br /&gt;
In this example we will use the edge version x86_64:&lt;br /&gt;
{{Cmd|sh mkimage.sh --tag edge \&lt;br /&gt;
	--outdir ~/iso \&lt;br /&gt;
	--arch x86_64 \&lt;br /&gt;
	--repository http://dl-cdn.alpinelinux.org/alpine/edge/main \&lt;br /&gt;
	--profile $PROFILENAME&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Notes:&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Of course, several passages of this doc can be automated with a script, like the repository/arch/outdir settings.&lt;br /&gt;
This steps are left to you and to your imagination :)&lt;br /&gt;
&lt;br /&gt;
== Testing your ISO image ==&lt;br /&gt;
&lt;br /&gt;
[[Qemu#Live_mode| Qemu]] is useful for a quick test of your created ISO image.&lt;br /&gt;
&lt;br /&gt;
[[Category:Package Manager]]&lt;br /&gt;
[[Category:ISO]]&lt;/div&gt;</summary>
		<author><name>Ferneu</name></author>
	</entry>
</feed>