Thursday 24 May 2018

Introducing 'isorespin.sh' templates


Sometimes when respinning an ISO using 'isorespin.sh' you find yourself using the same combination of options. Typically each combination is to include a specific type of functionality. An example might be for someone with a Broadcom wifi device always having to load and move the NVRAM file to its required location.

I've now added functionality that can simply this through the introduction of 'templates'. Similar to how the processor options of 'atom' and 'apollo' work, a template is a list of options to be included when respinning.

Looking at the​ wifi example ​in more detail, ​the ​required ​options ​​might be​:​

-f nvram.txt \
-c "mv /usr/local/bin/nvram.txt /lib/firmwaee/brcm/brcm4330-stdio.txt"


​which can be save​d​ in a text file, say 'wifi.tpl',​ with the extension '.tpl' being used just to serve as a descriptive reminder of the file's contents. This file can then be used with the new '-t' o​r​ '--template' option when respinning, fo​r​ example:
isorespin.sh -i ubuntu-18.04-desktop-amd64.iso​ --atom -t wifi.tpl
Templates can ​also ​be combined. Another example might be when a spec​i​f​i​c set of packages is required such as for 'ssh' so if the template fi​l​e 'ssh.t​​p​l​' contained '-p "ssh openssh.server"' ​then respinning with both ​'​wifi​'​ and 'ssh' is as s​imp​le as:
isorespin.sh -i ubuntu18.04.desktop.iso --atom -t wifi.tpl -t ssh.tpl
There actually is no reason why the '--atom' option cannot be included within a template however it ​would ​make sense to call the template​ ​something ​​meaningful e.g. 'atom-wifi.tpl'.

Templates are also extremely useful for complex respins. To respin an ​ISO for the ​GPD Pocket device the ​current command is​:​

isorespin.sh -i ​<​ISO​>​ \
​​-k v4.17-rc2 \
-e bcmwl-kernel-source \
-p "xfonts-terminus thermald tlp va-driver-all vainfo libva2 i965-va-driver gstreamer1.0-libav gstreamer1.0-vaapi vlc python-gi git python gir1.2-appindicator3-0.1" \
-f display/20-intel.conf \
-f display/30-monitor.conf \
-f display/35-screen.conf \
-f display/40-touch.conf \
-f display/40-trackpoint.conf \
-f display/console-setup \
-f display/monitors.xml \
-f display/adduser.local \
-f display/90-scale \
-f display/90-interface \
-f display/wrapper-display.sh \
-f audio/chtrt5645.conf \
-f audio/HiFi.conf \
-f audio/headphone-jack \
-f audio/headphone-jack.sh \
-f audio/wrapper-audio.sh \
-f fan/gpdfand \
-f fan/gpdfand.conf \
-f fan/gpdfand.py \
-f fan/gpdfand.service \
-f fan/wrapper-fan.sh \
-f network/99-local-bluetooth.rules \
-f network/brcmfmac4356-pcie.txt \
-f network/wrapper-network.sh \
-f power/wrapper-power.sh \
-c wrapper-audio.sh \
-c wrapper-display.sh \
-c wrapper-fan.sh \
-c wrapper-network.sh \
-c wrapper-power.sh \
-g "" \
-g "i915.fastboot=1 i915.semaphores=1 fbcon=rotate:1 gpd-pocket-fan.speed_on_ac=0"


Whilst this can be stored as a template ​to simplify things further template​s​ can in turn contain templates so a com​p​lex respin ca​n​ both be easier t​o build and understand.
For​ example we ​could build ​a ​template​ ​f​o​r​ 'display' as '​gpd-display.tpl' containing:

--file gpd-pocket-ubuntu-respin/display/20-intel.conf
--file gpd-pocket-ubuntu-respin/display/30-monitor.conf
--file gpd-pocket-ubuntu-respin/display/35-screen.conf
--file gpd-pocket-ubuntu-respin/display/40-touch.conf
--file gpd-pocket-ubuntu-respin/display/40-trackpoint.conf
--file gpd-pocket-ubuntu-respin/display/console-setup
--file gpd-pocket-ubuntu-respin/display/monitors.xml
--file gpd-pocket-ubuntu-respin/display/adduser.local
--file gpd-pocket-ubuntu-respin/display/90-scale
--file gpd-pocket-ubuntu-respin/display/90-interface
--file gpd-pocket-ubuntu-respin/display/wrapper-display.sh
--command wrapper-display.sh

​and then similar templates for 'gpd-audio.tpl', 'gpd-fan.tpl' etc. together with a 'gpd.tpl' template containing:

​--template gpd-kernel.tpl
--template gpd-packages.tpl
--template gpd-display.tpl
--template gpd-audio.tpl
--template gpd-fan.tpl
--template gpd-network.tpl
--template gpd-power.tpl
--template gpd-grub.tpl​

So respinning ​U​b​u​ntu ​B​ionic for ​the GPD Pocket becomes​:​
isorespin.sh -i ubuntu-18.04-desktop-amd64.iso​ -t gpd​.tpl​
Taken to an even further ​level the ISO can be specified as a template e.g. 'bionic​.tpl​' containing '-i ​ubuntu-18.04-desktop-amd64.iso'

So the ​final ​respin becomes​:
​isorespin.sh -t bionic.tpl -t gpd.tpl

To assist in building templates each time ​'​isorespin.sh​'​ is ​successfully run a template file 'isorespin.tpl' ​is ​created containing the options used in respinning excluding the ISO option.


Fot the ​GPD Pocket example above the 'isorespin.tpl' file after respinning contains​:​

--kernel v4.17-rc2
--erase bcmwl-kernel-source
--package "xfonts-terminus thermald tlp va-driver-all vainfo libva2 i965-va-driver gstreamer1.0-libav gstreamer1.0-vaapi vlc python-gi git python gir1.2-appindicator3-0.1"
--file /<path>/gpd-pocket-ubuntu-respin/display/20-intel.conf
--file /<path>/gpd-pocket-ubuntu-respin/display/30-monitor.conf
--file /<path>/gpd-pocket-ubuntu-respin/display/35-screen.conf
--file /<path>/gpd-pocket-ubuntu-respin/display/40-touch.conf
--file /<path>/gpd-pocket-ubuntu-respin/display/40-trackpoint.conf
--file /<path>/gpd-pocket-ubuntu-respin/display/console-setup
--file /<path>/gpd-pocket-ubuntu-respin/display/monitors.xml
--file /<path>/gpd-pocket-ubuntu-respin/display/adduser.local
--file /<path>/gpd-pocket-ubuntu-respin/display/90-scale
--file /<path>/gpd-pocket-ubuntu-respin/display/90-interface
--file /<path>/gpd-pocket-ubuntu-respin/display/wrapper-display.sh
--command wrapper-display.sh
--file /<path>/gpd-pocket-ubuntu-respin/audio/chtrt5645.conf
--file /<path>/gpd-pocket-ubuntu-respin/audio/HiFi.conf
--file /<path>/gpd-pocket-ubuntu-respin/audio/headphone-jack
--file /<path>/gpd-pocket-ubuntu-respin/audio/headphone-jack.sh
--file /<path>/gpd-pocket-ubuntu-respin/audio/wrapper-audio.sh
--command wrapper-audio.sh
--file /<path>/gpd-pocket-ubuntu-respin/fan/gpdfand
--file /<path>/gpd-pocket-ubuntu-respin/fan/gpdfand.conf
--file /<path>/gpd-pocket-ubuntu-respin/fan/gpdfand.py
--file /<path>/gpd-pocket-ubuntu-respin/fan/gpdfand.service
--file /<path>/gpd-pocket-ubuntu-respin/fan/wrapper-fan.sh
--command wrapper-fan.sh
--file /<path>/gpd-pocket-ubuntu-respin/network/99-local-bluetooth.rules
--file /<path>/gpd-pocket-ubuntu-respin/network/brcmfmac4356-pcie.txt
--file /<path>/gpd-pocket-ubuntu-respin/network/wrapper-network.sh
--command wrapper-network.sh
--file /<path>/gpd-pocket-ubuntu-respin/power/wrapper-power.sh
--command wrapper-power.sh
--grub ""
--grub "i915.fastboot=1 i915.semaphores=1 fbcon=rotate:1 gpd-pocket-fan.speed_on_ac=0"

where '/<path>/' is the full path to the specified file.



Besides using t​h​e template file as a base for ​further ​individual templates yo​u​ can also simply recreate the last respun ​ISO​ by rerunning with the last generated template:
isorespin.sh -i <ISO> -t isorespin.tpl



Please​ donate if yo​u​ find this functionality and/or the script useful​ using the following link http://goo.gl/nXWSGf.

10 comments:

leo said...

Hi,
stupid question...
Some time ago I successofully installed a respinned lubuntu ISO (REALLY THANKS FOR THE WORK DONE WITH ISORESPIN!)
Now new kernels are available (I installed with 4.13).

How to make the new kernels to have same patches, i.e. about RTL chipset (network and bluetoth), as in the respinned ISO?

Is this feasible? Does it exist a shell script/instructions for such an operation?

BR
Leonardo

Linuxium said...

The latest mainline kernels now support wifi and bluetooth and so do Ubuntu kernels so you should be able to simply upgrade to the latest available kernel and still have functioning wifi and bluetooth.

leo said...

Unfortunately I tested (even 4.18) but the bluetooth still does not work (the WIFI instead is ok) my case.
With the patch in the isorespin instead it worked.
I know I'm running in a kind of "exotic" HW...but...
any hints?

Linuxium said...

You may be missing some userland files. What does 'dmesg' say immediately after booting? Hint: use pastebinit to post a link.

leo said...

hello,
apologize for the delay! It took a while ...

I did an exercise of comparison what working and what not between respinned 4.13 and stock 4.18

Distribution is lubuntu

Basically the two main sub-systems not working are
1) the Bluetooth (wi-fi working instead!)
2) the USB3.0 subsystem (like it does not exist at all!)

All the remaining sub-systems are same status (either working on both or not working on both)

here the dmesg:
respinned 4.13
https://pastebin.com/hUcqKfM8

not respinned
https://pastebin.com/VtLs7tNV

Linuxium said...

I would respin v4.18 as I think you are missing some userland files which is preventing Bluetooth to load.

leo said...

hello Linuxium,
so advice is to respin a lubuntu distro with kernerl 4.18 and then upgrade from that. Correct?
Or?

Linuxium said...

Yes, try v4.18 first.

leo said...

Hi,
I tested kernel 5.3:
now wi-fi and bluetooth working, but usb 3 does not recognize connected devices (just to avoid speculation cable is working, if I connect same device to USB2.0, it is recognized)...
Kind of jigsaw...

Linuxium said...

Are you respinning the latest (19.10) release?

Post a Comment