Build NoX KLV mini; single script

Very small KL Linux variants


Moderator: Forum moderators

Post Reply
User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Build NoX KLV mini; single script

Post by wiak »

Attached is a single script for completely building a FR minimal Void Linux ready for booting (user/password: root/root); internally uses rockedge f_plug, and a huge-kernel (currently from old upup)/modules/firmware and FR initrd.gz are also auto-downloaded by the script.

In fact all you need to do is remove the dummy tar, make this script executable and run it (as root user) from an empty directory on partition you want to boot from (e.g. /KLV_minimal). i.e. using a terminal opened at that directory:

Code: Select all

./FR_minimal_noX_void.sh

To understand FR building just read the comments alongside the simple (very very short) wget/fetch code below (which is the attached script contents). It is very easy ;-) :

Code: Select all

#!/bin/bash
# General Build Instructions:
# Create an empty directory at root of partition you want to bootfrom
# For example: /KLV_minimal
# In a terminal opened at that bootfrom directory simply run this single script!!! ;-)

# Fetch the build_firstrib_rootfs build parts:
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/build_firstrib_rootfs.sh && chmod +x build_firstrib_rootfs.sh

# rockedge minimal Void Linux build plugin used during the build (you can add to this plugin for whatever extras you want in your build)
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/noX_f_plugs/f_00_Void_amd64_noXsimple00_rockedge-120rc2.plug

# Download the boot components:
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/initrd-latest.gz -O initrd.gz  # FR skeleton initrd
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/huge_kernels/upup_22_04/vmlinuz
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/huge_kernels/upup22_04/00zdrv_upup_22.04.sfs  # modules
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/huge_kernels/upup22_04/01fdrv_upup_22.04.sfs  # firmware

# Some useful FirstRib utilities in case you want to modify the initrd or the 07firstrib_rootfs
# All these utilities have a --help option
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/wd_grubconfig && chmod +x wd_grubconfig  # When run finds correct grub menu stanza for your system
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/modify_initrd_gz.sh && chmod +x modify_initrd_gz.sh  # For 'experts' to modify initrd.gz
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/mount_chroot.sh && chmod +x mount_chroot.sh  # To enter rootfs in a chroot
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/umount_chroot.sh && chmod +x umount_chroot.sh  # to 'clean up mounts used by above mount_chroot.sh'

# Optional addon layers

# Main KL addon containing the likes of gtkdialog, filemnt, UExtract, gxmessage, save2flash and more
# save2flash works with command-line-only distros too
wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/12KL_gtkdialogGTK3filemnt64.sfs

# Build the Void Linux root filesystem to firstrib_rootfs directory
# NOTE WELL: If you have an alternative f_plugin in your bootfrom directory (name must start with f_),
# simply alter below command to use it
./build_firstrib_rootfs.sh void default amd64 f_00_Void_amd64_noXsimple00_rockedge-120rc2.plug

# Number the layer ready for booting
mv firstrib_rootfs 07firstrib_rootfs

# The only thing now to do is find correct grub stanza for your system
printf "\nPress any key to run utility wd_grubconfig
which will output suitable exact grub stanzas
Use one of these with your pre-installed grub
Press enter to finish\n"
read choice
./wd_grubconfig
exit 0

NOTE1: @rockedge can provide full XFCE desktop producing f_00 build plugins that can be used with the above script instead (or some other commandline only distro f_ plugs that provide more features than the above). He probably has some Zoneminder-related Void Linux f_00 build plugins as well... and alternatives that use the likes of JWM or the Spectrwm tiling window manager with Rox as primary file manager. These larger builds generally also install Network Manager and its associated desktop applet for connecting to internet via ethernet or wifi.
NOTE2: I believe even KLV minimal can use save-on-demand (when using FirstRib kernel line boot mode: w_changes=RAM2). However since yad not installed, current save2flash won't work, but directly calling snapmergepuppy should.
NOTE3: FirstRib builds can alternatively use upstream distro official kernel (i.e. doesn't need huge-style-kernel). Doing that requires using another FR build utility (FRmake_initrd.sh; not included above) which automatically modifies the FR skeleton initrd.gz to include all boot modules. Some time in the future I will show how to do that by posting a similar single script to build the above, but using Void Linux official kernel, modules, and firmware instead of huge-kernel combination.
NOTE4:If you add wpa_supplicant to the f_00 xbps-install then simplistic wiakwifi (it's in 12KL addon as is wd_mount) should be available for connecting to your wifi. Better would be to install NetworkManager for ethernet or wifi connection (e.g. via nmtui command).
NOTE5:@The default rockedge f_00 plugin used above also provides Midnight Commander (mc) file manager, which includes mcedit text editor.
NOTE6: If you also create an (optional) text file named (exactly!) addons_f.plug and put that in the build directory prior to building, any commands you put in there will occur after the main build is complete. For example, you could include commands to make an iso or for copying other bits and pieces directly into 07firstrib_rootfs (e.g. EFI boot stuff). Note that f_00...plugin code is all done inside a chroot to firstrib_rootfs, whereas any final addons_f.plug code is done on the normal system and not in any chroot.

For some detail on how such KL builds work you can refer to: https://forum.puppylinux.com/viewtopic. ... 487#p98487

Attachments
FR_minimal_noX_void.sh.tar
(3.01 KiB) Downloaded 46 times

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

williwaw
Posts: 1594
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 145 times
Been thanked: 291 times

Re: Build KLV mini; single script

Post by williwaw »

NOTE4:If you add wpa_supplicant to the f_00 xbps-install then simplistic wiakwifi (it's in 12KL addon as is wd_mount) should be available for connecting to your wifi.

Is f_00 xbps-install for this build the equivillent f_00_Void_amd64_noXsimple00_rockedge-120rc2.plug, at least for the purpose of adding wpa_supplicant?

At the pause to select mirrors, I added wpa_supplicant to f_00_Void_amd64_noXsimple00_rockedge-120rc2.plug as follows.
xbps-install -y wpa_supplicant

before the pause there was an error

Code: Select all

--2023-08-15 23:02:38--  https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/huge_kernels/upup22_04/01fdrv_upup_22.04.sfs
Resolving gitlab.com... 172.65.251.78, 2606:4700:90:0:f22e:fbec:5bed:a9b9
Connecting to gitlab.com|172.65.251.78|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-08-15 23:02:39 ERROR 404: Not Found.

boots fine, wpa_supplicant installed
can you direct me to any documentation the usage of wiakwifi?

User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Re: Build KLV mini; single script

Post by wiak »

williwaw wrote: Wed Aug 16, 2023 8:09 am

can you direct me to any documentation the usage of wiakwifi?

Hmmm... Maybe isn't any though no doubt I posted about how to use it long long ago (been around for years).

Needs wpa_supplicant installed and busybox with a symlink to busybox of udhcpc
Maybe also needs

Code: Select all

ip a

command to work as far as I remember (but can't remember what package that is in if not already installed?)

It just asks you to enter your wifi interface name (but should display that so I can't remember why I didn't automate its entry)
and then the wlan wifi router name
And then the SSID for that (just memory - I'd have to try it again).
That's about all there is to it. As long as WPA or WPA2 it should just search a bit and then auto-connect. I'll come back later on this, but busy on build_firstrib_rootfs.sh regression I need to fix urgently.

To run wiakwifi you just enter the command:

Code: Select all

wiakwifi

If you want to try with new settings, just enter command:

Code: Select all

wiakwifi reset

I think there is a

Code: Select all

wiakwifi --help

wiakwifi is a very basic wlan connection script. For more sophistication install NetManager and run command:

Code: Select all

nmtui

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Re: Build KLV mini; single script

Post by wiak »

Build KLV mini; single script

Sorry, had made an error in the PATH for the 00zdr (modules) and 01fdr (firmware) so the script was failing to download these, so wouldn't have booted out-of-the-box... Re-posted the script with their download link path fixed.

Please let me know whenever anything doesn't work in the way I claimed it would.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Re: Build KLV mini; single script

Post by wiak »

@willywaw
@Sofiya
@rockedge
@geo_c
and all

Okay, I had made a whole catalogue of errors here and there that were breaking a few things.

I had the url links wrong for 00zdr and 01fdr, which I've now fixed.

I had an old broken copy of wiakwifi in 12KL sfs that was overlaying the good one already installed by build_firstrib_rootfs.sh into firstrib_rootfs/usr/local/bin. I replaced the bad one in 12KL with the fixed one...

I had messed up build_firstrib_rootfs.sh with symlink issues regarding copying /etc/resolv.conf. I 'think' I have that fixed now such that same code will work with all distro builds. Time will tell, but at least I know what the issue is when it happens now. Latest build_firstrib_rootfs.sh on firstrib gitlab site, which has these IMPORTANT fixes is version="8.0.0"; revision="-rc5". Please download and use that one now.

Code: Select all

wget -c https://gitlab.com/firstrib/firstrib/-/raw/master/latest/build_system/build_firstrib_rootfs.sh && chmod +x build_firstrib_rootfs.sh

I have added wpa_supplicant into rockedge noXsimple plug that this KLV mini single build script downloads and uses. I think that is better since can now simply boot the default build result and immediately connect to wlan using command:

Code: Select all

wiakwifi

If you later add more sophisticated NetworkManager that has wpa_supplicant as a dependency anyway.

To use wiakwifi, you just enter the wlan interface name that should be reported.
And then enter your local wifi name, whatever that is.
And then the SSID (being the wlan password for your wifi)
and then after a few checks/discovery routines in wiakwifi it should simply connect successfully to your WPA or WPA2 wlan.

Then you can ping google.com (or whatever) to prove to yourself it is working and then can use xbps-install to install new programs, and if in w_changes=RAM2 mode, simply enter in terminal:

Code: Select all

snapmergepuppy

and all changes made will be made persistent for use next boot. In KLV mini, the current default save2flash script can't be used directly since that is a yad frontend so for GUI-use only, but all it does is call snapmergepuppy anyway.

Hopefully, building KLF Rawhide will also still be working... I've added a second optional addons_f.plug there, the second one being to include a default download of a huge-kernel, 00zdrv modules, and 01fdr firmware sfs (same as used in this Build KLV mini).

Personally, I'm playing with KLF Rawhide quite a bit just now (I like dnf package manager); but also fun playing with this mini KLV - been long time since I've used wiakwifi so I like the novelty (and feeling of control/simplicity)...

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

williwaw
Posts: 1594
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 145 times
Been thanked: 291 times

Re: Build KLV mini; single script

Post by williwaw »

I have added wpa_supplicant into rockedge noXsimple plug that this KLV mini single build script downloads and uses. I think that is better since can now simply boot the default build result and immediately connect to wlan using command
wiakwifi

If you later add more sophisticated NetworkManager that has wpa_supplicant as a dependency anyway.

Reading the docs at void https://docs.voidlinux.org/config/netwo ... nager.html
makes me wonder if having both may be problematic

FWIW, I have got NetworkManger working, using the earlier version of f_00_Void_amd64_noXsimple00_rockedge-120rc2.plug by adding

Code: Select all

xbps-install -y NetworkManager
ln -s /etc/sv/NetworkManager /etc/runit/runsvdir/default/NetworkManager
ln -s /etc/sv/dbus /etc/runit/runsvdir/default/dbus

the links, suggested by Rockedge in another .plug, may have made the difference to get NM up and running

User avatar
wiak
Posts: 3627
Joined: Tue Dec 03, 2019 6:10 am
Location: Packing - big job
Has thanked: 56 times
Been thanked: 994 times
Contact:

Re: Build KLV mini; single script

Post by wiak »

williwaw wrote: Wed Aug 16, 2023 8:22 pm

Reading the docs at void https://docs.voidlinux.org/config/netwo ... nager.html
makes me wonder if having both may be problematic

wiakwifi is just a script sitting in /usr/local/bin. If you don't run it, it does nothing at all. More sophisticated wifi managers auto-run, and then you'd get conflict with NetworkManager if you installed it.

https://www.tinylinux.info/
DOWNLOAD wd_multi for hundreds of 'distros' at your fingertips: viewtopic.php?p=99154#p99154
Αξίζει να μεταφραστεί;

User avatar
rockedge
Site Admin
Posts: 5714
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1994 times
Been thanked: 2097 times
Contact:

Re: Build KLV mini; single script

Post by rockedge »

@williwaw wiakwifi will remain dormant unless it's called and won't interfere with NetworkManager on it's own.
The sysmlinks are important and needed to start NetworkManager as a system service and to bring it up during system start up. There is good documentation on using Void's runit services. Experiment to get a feel for it. Getting audio to work is similar!

Code: Select all

xbps-install -y pulseaudio pulseaudio-utils alsa-plugins-pulseaudio alsa-utils
ln -s /etc/sv/pulseaudio /etc/runit/runsvdir/default/pulseaudio

An example from the Void doc's for services control from the command line:

Code: Select all

# sv up <services>
# sv down <services>
# sv restart <services>
# sv status <services>

I feel like you are making progress rather quickly. It is a lot like using Lego to build things and once the network connection is up, starting with the xbps package manager, you can go in any direction for your build.

Important note for advanced development: If installing an auto-login during boot, make sure to add an empty file /etc/sv/agetty-tty1/down
This will prevent any conflict between /etc/sv/agetty-tty1 and /etc/sv/agetty-autologin-tty1 during any logout/login

williwaw
Posts: 1594
Joined: Tue Jul 14, 2020 11:24 pm
Has thanked: 145 times
Been thanked: 291 times

Re: Build KLV mini; single script

Post by williwaw »

If installing an auto-login during boot, make sure to add an empty file /etc/sv/agetty-tty1/down
This will prevent any conflict between /etc/sv/agetty-tty1 and /etc/sv/agetty-autologin-tty1 during any logout/login

is agetty part of busybox or need to be installed seprately?

if I want an autologin (but not neccesarily a login manager) what needs to be in /etc/sv/agetty-autologin-tty1 to enable auto login.

where is a good place with void to place startup scripts?

User avatar
rockedge
Site Admin
Posts: 5714
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1994 times
Been thanked: 2097 times
Contact:

Re: Build KLV mini; single script

Post by rockedge »

@williwaw Make yourself a /root/Startup directory that gets sourced during system start to automatically run your scripts. I threw together a script that should do it...or give you the steps to do it manually.

Code: Select all

#!/bin/sh
#

# Add ~/Startup directory
#
mkdir -p /root/Startup
cat <<'EOF' >> /usr/local/bin/start-up
#!/bin/bash
sleep 5
user_home=$(eval echo ~${SUDO_USER})
ls $user_home/Startup/* | while read J
do
   "$J" &
done
EOF

chmod +x /usr/local/bin/start-up

# Setup autologin on tty1
#
cp -a /etc/X11/xinit/xinitrc /root/.xinitrc
cp -R /etc/sv/agetty-tty1 /etc/sv/agetty-autologin-tty1
sed -i 's/GETTY_ARGS.*/GETTY_ARGS="--autologin root --noclear"/' /etc/sv/agetty-autologin-tty1/conf  # editing for autologin root
touch /etc/sv/agetty-tty1/down

# Arrange to startx in user's .bash_profile (per Arch Wiki)
# Remove this section if not wanting boot straight into X
touch ~/.bash_profile
cat <<'AUTOLOGIN' > /etc/profile.d/autologin.sh
# autologin on tty1
if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
exec startx  # remove the exec if you want back to tty1 on exit X

fi
AUTOLOGIN

# Get and install autologin fix
#
cd /etc/sv
wget https://rockedge.org/kernels/data/XBPS_packages/agetty-autologin-tty1.tar.gz
tar xvfz agetty-autologin-tty1.tar.gz

# Use agetty-autologin-tty1 instead of agetty-tty1 
rm -f /etc/runit/runsvdir/default/agetty-tty1
ln -s /etc/sv/agetty-autologin-tty1 /etc/runit/runsvdir/default/agetty-autologin-tty1

echo "Should be Done...."

After these steps make sure there is a blank file /etc/sv/agetty-tty1/down to stop the agetty-tty1 service so there is no conflict with agetty-autologin-tty1. The script should have created the file.

Also in a /root/.xinitrc above the last line of the script insert: /usr/local/bin/start-up & like this example:

Deletes everything below line 51 in /root/.xinitrc and inserts the echo 'ed lines

Code: Select all

sed -i '51,$d' /root/.xinitrc
echo "/usr/local/bin/start-up &" >>/root/.xinitrc 
echo "# exec xfce4-session" >>/root/.xinitrc
echo "xfce4-session" >>/root/.xinitrc  # removed exec to allow dropping out of Xorg to console

Void Linux docs -> https://wiki.voidlinux.org/voidlinux_en ... nvironment

Post Reply

Return to “KL minis”