You are not logged in.

#1 2021-05-15 13:49:36

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

SOLVED Creating a custom ArchISO with LTS kernel?

There are many of us who need to build custom ISO images which run on the LTS kernel. In my case I also need ZFS which complicates things because the latest kernel and zfs packages are incompatible. It looks to me like the archiso and syslinux packages are both hard-wired to work with the linux kernel only. There is no option to specfy any other kernel. With help from qinohe I am part way to having a solution. I have an ISO which will boot into the LTS kernel on my BIOS system but not on my EFI system. Its a total hack and I can't help but think there is a better way. In short I tried to locate all the places where the linux kernel is specified and change it to linux-lts. As I said I am only part way there. If you know of a way to build an Arch Linux ISO with full support for the LTS kernel please share.   

(my original script was removed because it did not work ... see below)

SOLUTION:

It is possible to modify the archiso and syslinux configuration files to create a custom ISO with the LTS kernel and ZFS. I have not tested the ISO extensively but all indications are that it functions as designed. I am posting what I came up with here for anyone interested. If you can make improvements please share.

custom_archiso_with_lts_and_zfs

#!/usr/bin/env bash

set -e

#
# print messages
#
function print {
  echo -e '\n\t\033[0;32m' "$1" '\033[0m\n'
}

#
# kernel of choice
#
kernel=linux-lts

#
# working directory
#
function wkng_dir {
	src_dir=$PWD
	name=archzfsiso
	build="$HOME"/"$name"
	[ -d "$build" ] && cd "$HOME" ; sudo rm -rf "$name"
	cp -r /usr/share/archiso/configs/releng "$build"
	iso_bin="$build"/airootfs/usr/local/bin/ 
	rm "$iso_bin"/*
	cp "$src_dir"/* "$iso_bin"
}

#
# packages to be added to the default iso list
#
pkg_add=(
zfs-dkms
"$kernel-headers"
)
function add_pkgs {
	sed -i "s/^linux$/$kernel/" "$build"/packages.x86_64 
	for a in "${pkg_add[@]}" ; do
		echo "$a" >> "$build"/packages.x86_64 
	done
	cd "$build"/airootfs/etc/mkinitcpio.d
	mv linux.preset "$kernel".preset
	sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" "$kernel".preset
	sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" "$kernel".preset
}

#
# packages to be removed from the default iso list
#
# broadcom-wl will pull in the linux package
#
pkg_rmv=(
broadcom-wl
b43-fwcutter
)
function rmv_pkgs {
	for a in "${pkg_rmv[@]}" ; do
		sed -i "/$a/d" "$build"/packages.x86_64 
	done
}

#
# syslinux changes
#
function syslinux_config {
	cd "$build"/syslinux
	sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" archiso_sys-linux.cfg
	sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" archiso_sys-linux.cfg
	sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" archiso_pxe-linux.cfg
	sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" archiso_pxe-linux.cfg
}

#
# efiboot changes
#
function efiboot_config {
	cd "$build"/efiboot/loader/entries
	sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" archiso-x86_64-linux.conf
	sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" archiso-x86_64-linux.conf
	sed -i "s/vmlinuz-linux/vmlinuz-$kernel/" archiso-x86_64-speech-linux.conf
	sed -i "s/initramfs-linux.img/initramfs-$kernel.img/" archiso-x86_64-speech-linux.conf
}

#
# enable the archzfs repo
# NOTE: only enable one server/mirror
# Source: https://wiki.archlinux.org/title/unofficial_user_repositories#archzfs
#
function pacman_config {
	echo -e "\n[archzfs]\nServer = https://zxcvfdsa.com/archzfs/\$repo/x86_64" >> "$build"/pacman.conf
}

#
# iso configuration files
#
# NOTE: replace archonzfs and chroot_config with the tools you need
#
function iso_config {
	echo -e '\n\t\033[1m' 'Welcome to the Arch Linux on OpenZFS ISO' '\033[0m\n' > "$build"/airootfs/etc/motd
	profile="$build"/profiledef.sh
	sed -i "s/iso_name=\"archlinux\"/iso_name=\"archlinux-zfs\"/" "$profile"
	sed -i "s/iso_label=\"ARCH_\$(date +%Y%m)\"/iso_label=\"ArchZFS_\$(date +%Y-%m-%d)\"/" "$profile" 
	sed -i "s/Installation_guide/archonzfs/" "$profile"
	sed -i "s/livecd-sound/chroot_config/" "$profile"
	sed -i "/choose-mirror/d" "$profile"
}

#
# build the iso
#
function build_iso { 
	[ -d /tmp/"$name" ] && cd /tmp ; sudo rm -rf "$name"
	sudo mkarchiso -v -w /tmp/"$name" -o "$build"/out "$build" && print "Arch Linux on OpenZFS ISO build complete" 
}

#### ---- MAIN ---- ####

#
# verify userid
#
[ "$(id -u)" == 0 ] && print "run this script as a user with sudo access" && exit 1

#
# deps
#
[ ! "$(pacman -Q archiso)" ] && sudo pacman -S --noconfirm archiso

wkng_dir
add_pkgs
rmv_pkgs
syslinux_config
efiboot_config
pacman_config
iso_config
build_iso

Last edited by lenhuppe (2021-05-18 13:22:36)


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#2 2021-05-15 14:35:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,300

Re: SOLVED Creating a custom ArchISO with LTS kernel?

EFI boot uses systemd-boot and the relevant files are under configs/releng/efiboot/loader/entries . Should be trivial to adjust your existing script to also sed through those.

Offline

#3 2021-05-15 15:59:07

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Creating a custom ArchISO with LTS kernel?

V1del wrote:

EFI boot uses systemd-boot and the relevant files are under configs/releng/efiboot/loader/entries . Should be trivial to adjust your existing script to also sed through those.

Yep it was very easy to do. Also nl6720 provided a heads up on the  broadcom-wl package. I will post what I have here for anyone interested. Adding or removing zfs support is now easy.


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#4 2021-05-15 16:17:40

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: SOLVED Creating a custom ArchISO with LTS kernel?

lenhuppe wrote:

nl6720 provided a heads up on the  broadcom-wl package. I will post what I have here for anyone interested. Adding or removing zfs support is now easy.

Sorry about that, forgot to mention it if you don't want to also install linux kernel!
Have you tried to use 'run_archiso' for UEFI? I copied '/usr/bin/run_archiso' to my ~/bin and edited it to my liking.
It also provides '-u' , it pulls in the UEFI files needed so you don't need to tweak the ISO for that, it just works.

edit: NVM. this would only work for QEMU not an ISO you would run  standalone.

Last edited by qinohe (2021-05-15 17:22:13)

Offline

#5 2021-05-15 19:33:14

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Creating a custom ArchISO with LTS kernel?

qinohe wrote:
lenhuppe wrote:

nl6720 provided a heads up on the  broadcom-wl package. I will post what I have here for anyone interested. Adding or removing zfs support is now easy.

Sorry about that, forgot to mention it if you don't want to also install linux kernel!
Have you tried to use 'run_archiso' for UEFI? I copied '/usr/bin/run_archiso' to my ~/bin and edited it to my liking.
It also provides '-u' , it pulls in the UEFI files needed so you don't need to tweak the ISO for that, it just works.

edit: NVM. this would only work for QEMU not an ISO you would run  standalone.

Yes I have used 'run_archiso' for testing my ISO images. Thank you for the heads up on that one. In the end it looks like the broadcom-wl package was the wrench in the works. Funny thing is that early on I created a list of unused packages and removed them from the ISO including the one in question. I then decided to not take any chances on removing something critical.


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#6 2021-05-15 20:41:35

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: SOLVED Creating a custom ArchISO with LTS kernel?

Glad you solved it;)
I know it comes 'after the fact' but I added a tip to the wiki.
If you want to you can add a wiki page to your user page and link to it from https://wiki.archlinux.org/title/Archiso#See_also
Users that like to create this ZFS troubleshoot ISO would be happy I think.

Offline

#7 2021-05-15 22:08:27

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Creating a custom ArchISO with LTS kernel?

qinohe wrote:

Glad you solved it;)
I know it comes 'after the fact' but I added a tip to the wiki.
If you want to you can add a wiki page to your user page and link to it from https://wiki.archlinux.org/title/Archiso#See_also
Users that like to create this ZFS troubleshoot ISO would be happy I think.

Thank you for your guidance and updating the wiki. We are all in this together. When I am not crazy busy with work and grad school I would like to do that wiki. You are right about ZFS users needing what we all came up with today. When you say user page are you referring to my forum user profile? I am looking now for where I can do that wiki. If you have information on how I can create a wiki I would appreciate the opportunity to give back.

Last edited by lenhuppe (2021-05-15 22:17:45)


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#8 2021-05-15 22:56:21

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: SOLVED Creating a custom ArchISO with LTS kernel?

Well, create an account to edit wiki pages if you haven't already got one;)
Than you head to your own users page which be something like: https://wiki.archlinux.org/title/User:lenhuppe
If you visit that page for the first time it's just an Arch wiki page without content, mine still is BTW.
You can start editing that page right away, it's not hard or difficult to start right away;-)
If you like to know more about editing a mediawiki page, which is what Arch uses, head to https://wiki.archlinux.org/title/ArchWiki:Contributing it contains links that show you how to do it, like: https://wiki.archlinux.org/title/Help:Editing
Installing mediawiki local can help you use it, you can even import 'Templates' from Arch to practice with them so you can see how it works. Have fun;)

Tip: start with an index page so it will be easier to add future content to it!

edit: If you decide it's too much work you can send me the files and will create that page for you, send it back to you than you can still put it on your own page!

Last edited by qinohe (2021-05-15 23:10:56)

Offline

#9 2021-05-16 00:38:07

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Creating a custom ArchISO with LTS kernel?

qinohe wrote:

Well, create an account to edit wiki pages if you haven't already got one;)
Than you head to your own users page which be something like: https://wiki.archlinux.org/title/User:lenhuppe
If you visit that page for the first time it's just an Arch wiki page without content, mine still is BTW.
You can start editing that page right away, it's not hard or difficult to start right away;-)
If you like to know more about editing a mediawiki page, which is what Arch uses, head to https://wiki.archlinux.org/title/ArchWiki:Contributing it contains links that show you how to do it, like: https://wiki.archlinux.org/title/Help:Editing
Installing mediawiki local can help you use it, you can even import 'Templates' from Arch to practice with them so you can see how it works. Have fun;)

Tip: start with an index page so it will be easier to add future content to it!

edit: If you decide it's too much work you can send me the files and will create that page for you, send it back to you than you can still put it on your own page!

For the sake of efficiency that would be a smart way to begin. I have created an account  page at https://wiki.archlinux.org/title/User:LenHuppe which is ready to go. Feel free to create an index page so that I can add to it from time to time. Once that is in place I will learn how to do proper wikis. How would you like me to send you my script file?


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#10 2021-05-16 01:35:45

qinohe
Member
From: Netherlands
Registered: 2012-06-20
Posts: 1,494

Re: SOLVED Creating a custom ArchISO with LTS kernel?

Have a look at this 2 user pages they are open so I think it's no problem linking them.
This page from AdamT has some personal info on it:
https://wiki.archlinux.org/title/User:AdamT
If this is not what you want have a look at the next page.
This page from Jadelord only contains a few links:
https://wiki.archlinux.org/title/User:Jadelord
Creating some sort of index is useful as it can be filled with links to new pages not yet created like the ZFS one or existing ones already in the wiki

What do you want? and everything you want on it you must send me, I won't think it up myself.
All you want on the page to create the ZFS ISO must be written in detail. Otherwise what would be be point of a wiki-page. I can read it and edit it and even add some missing details but the text should be yours.
I don't know(yet) if I have direct access to your user page but if I do I paste the result there and you can edit it yourself afterwards.
You can send me the text by using my avatar, click the envelope;)

Offline

#11 2021-05-16 01:53:09

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Creating a custom ArchISO with LTS kernel?

qinohe wrote:

Have a look at this 2 user pages they are open so I think it's no problem linking them.
This page from AdamT has some personal info on it:
https://wiki.archlinux.org/title/User:AdamT
If this is not what you want have a look at the next page.
This page from Jadelord only contains a few links:
https://wiki.archlinux.org/title/User:Jadelord
Creating some sort of index is useful as it can be filled with links to new pages not yet created like the ZFS one or existing ones already in the wiki

What do you want? and everything you want on it you must send me, I won't think it up myself.
All you want on the page to create the ZFS ISO must be written in detail. Otherwise what would be be point of a wiki-page. I can read it and edit it and even add some missing details but the text should be yours.
I don't know(yet) if I have direct access to your user page but if I do I paste the result there and you can edit it yourself afterwards.
You can send me the text by using my avatar, click the envelope;)

I like the AdamT page and will get to work providing you with some content to get started. There are a number of things I want to talk about over time so an index of posts is definitety in order. I am very vicarious so once I see what you did I will be able to understand how the wiki system works. I look forward to introducing myself to the community and getting to know people.


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

#12 2024-11-17 15:07:31

r-maerz
Member
Registered: 2024-11-17
Posts: 1
Website

Re: SOLVED Creating a custom ArchISO with LTS kernel?

For anyone interested, I have converted lenhuppe's excellent script into a GitHub Workflow which produces a new archlinux iso on the 4th day of every month. It includes the LTS kernel as well as the OpenZFS modules for it and can be found here.

Offline

#13 2024-11-17 23:20:19

lenhuppe
Member
From: New Hampshire USA
Registered: 2018-12-10
Posts: 282
Website

Re: SOLVED Creating a custom ArchISO with LTS kernel?

r-maerz wrote:

For anyone interested, I have converted lenhuppe's excellent script into a GitHub Workflow which produces a new archlinux iso on the 4th day of every month. It includes the LTS kernel as well as the OpenZFS modules for it and can be found here.

Your timing is impeccable. I have been wondering how to incorporate a Git account into the process of creating custom ISO images. I will definitely have a look at what you created. Happy to see that someone found one of my creations useful.


"I'm suspicious of people who don't like dogs, but I trust a dog when it doesn't like a person."  -- Bill Murray

Offline

Board footer

Powered by FluxBB