Comments (10)
Huh. That's cool...better 4 times than 0? Thx for the example and log...I've replicated it.
from sdm.
Ah, yes, this is a shortcoming of the way arguments are parsed. Each argument (e.g., section
, dtoverlay
, dtparam
) can be used exactly once in a plugin invocation. If an argument is used more than once, the last value gets used for all of them. 😵
The workaround is to use multiple bootconfig plugins (blah blah obviously not valid commands 🤣)
sudo sdm blah blah blah \
--plugin bootconfig:"section=[pi4]" \
--plugin bootconfig:"dtoverlay=pwm-fan" \
--plugin bootconfig:"dtparam=fan_temp0=55000,fan_temp0_hyst=5000,fan_temp0_speed=75" \
--plugin bootconfig:"dtparam=fan_temp1=62500,fan_temp1_hyst=5000,fan_temp1_speed=128" \
--plugin bootconfig:"dtparam=fan_temp2=70000,fan_temp2_hyst=5000,fan_temp2_speed=192" \
--plugin bootconfig:"dtparam=fan_temp3=77500,fan_temp3_hyst=5000,fan_temp3_speed=255" \
blah blah blah
Plugin arguments are parsed by sdm by running through the list and assigning each found string to a variable with the name of the argument. In this case, the variable dtparam
is reassigned 4 times, with the final value being the value of the last one found.
Unfortunately, there's no easy way to fix this in sdm without likely creating collateral damage, but the above (somewhat ugly) workaround does the job.
which results in /boot/firmware/config.txt with:
[pi4]
dtoverlay=pwm-fan
dtparam=fan_temp0=55000,fan_temp0_hyst=5000,fan_temp0_speed=75
dtparam=fan_temp1=62500,fan_temp1_hyst=5000,fan_temp1_speed=128
dtparam=fan_temp2=70000,fan_temp2_hyst=5000,fan_temp2_speed=192
dtparam=fan_temp3=77500,fan_temp3_hyst=5000,fan_temp3_speed=255
The plugin documentation will be updated to explicitly explain this constraint.
The only way that I can see to enable these to be set in a single bootconfig invocation is to add an include
argument that would stuff the contents of the include
file into config.txt appropriately.
Your thoughts appreciated!
from sdm.
So, would the following work too, since "section" and "dtoverlay" are different? That would be a way to slightly shorten it?
sudo sdm blah blah blah \
--plugin bootconfig:"section=[pi4]|dtoverlay=pwm-fan" \
--plugin bootconfig:"dtparam=fan_temp0=55000,fan_temp0_hyst=5000,fan_temp0_speed=75" \
--plugin bootconfig:"dtparam=fan_temp1=62500,fan_temp1_hyst=5000,fan_temp1_speed=128" \
--plugin bootconfig:"dtparam=fan_temp2=70000,fan_temp2_hyst=5000,fan_temp2_speed=192" \
--plugin bootconfig:"dtparam=fan_temp3=77500,fan_temp3_hyst=5000,fan_temp3_speed=255" \
blah blah blah
I haven't dived into your parsing [ and won't ], so anything I suggest is likely to be annoying and certain to be ignorant. But why not?? ;-)
The following atomic style was where I started, then I realized I could compress things to the 4-line style above:
section=[pi4]
dtoverlay=pwm-fan
dtparam=fan_temp0=55000
dtparam=fan_temp0_hyst=5000
dtparam=fan_temp0_speed=75
dtparam=fan_temp1=62500
dtparam=fan_temp1_hyst=5000
dtparam=fan_temp1_speed=128
dtparam=fan_temp2=70000
dtparam=fan_temp2_hyst=5000
dtparam=fan_temp2_speed=192
dtparam=fan_temp3=77500
dtparam=fan_temp3_hyst=5000
dtparam=fan_temp3_speed=255
Since the pi is happy with me combining distinct variables under one dtparam, I assume that the pi would be happy to have me mash all of the dtparam variables into one line?
section=[pi4]
dtoverlay=pwm-fan
dtparam=cooling_fan=on,fan_temp0=55000,fan_temp0_hyst=5000,fan_temp0_speed=75,fan_temp1=62500,fan_temp1_hyst=5000,fan_temp1_speed=128,fan_temp2=70000,fan_temp2_hyst=5000,fan_temp2_speed=192,fan_temp3=77500,fan_temp3_hyst=5000,fan_temp3_speed=255
So, since there's only one section, and one dtoverlay, and one dtparam, would you accept:
sudo sdm blah blah blah \
--plugin bootconfig:"section=[pi4]|dtoverlay=pwm-fan|dtparam=cooling_fan=on,fan_temp0=55000,fan_temp0_hyst=5000,fan_temp0_speed=75,fan_temp1=62500,fan_temp1_hyst=5000,fan_temp1_speed=128,fan_temp2=70000,fan_temp2_hyst=5000,fan_temp2_speed=192,fan_temp3=77500,fan_temp3_hyst=5000,fan_temp3_speed=255" \
blah blah blah
from sdm.
It appears so:
#!/bin/bash
sudo sdm $1 \
--customize \
--apt-options none \
--plugin bootconfig:"section=[pi4]|dtoverlay=pwm-fan|dtparam=cooling_fan=on,fan_temp0=55000,fan_temp0_hyst=5000,fan_temp0_speed=75,fan_temp1=62500,fan_temp1_hyst=5000,fan_temp1_speed=128,fan_temp2=70000,fan_temp2_hyst=5000,fan_temp2_speed=192,fan_temp3=77500,fan_temp3_hyst=5000,fan_temp3_speed=255" \
exit
yields a config.txt with:
[pi4]
dtoverlay=pwm-fan
dtparam=cooling_fan=on,fan_temp0=55000,fan_temp0_hyst=5000,fan_temp0_speed=75,fan_temp1=62500,fan_temp1_hyst=5000,fan_temp1_speed=128,fan_temp2=70000,fan_temp2_hyst=5000,fan_temp2_speed=192,fan_temp3=77500,fan_temp3_hyst=5000,fan_temp3_speed=255
from sdm.
... but such a line doesn't seem to work on the pi. There's apparently a documented 98-character line length limit (anything more is ignored). In my case it seems the long line is rejected, perhaps it breaks at a syntactically incorrect point. In any case the fan just runs and doesn't get PWM'd to different speeds per temperature. So maybe multiple lines can't be avoided...
Testing now, will report what finally works.
from sdm.
Because I may use this block in multiple burns within the script, I made the lines into variables:
FANPARMS420="from=$MYFILES/pwm-fan.dtbo|to=/boot/firmware/overlays|chown=root:root|chmod=755"
FANPARMS421="section=[pi4]|dtoverlay=pwm-fan"
FANPARMS422="dtparam=fan_temp0=55000,fan_temp0_hyst=3000,fan_temp0_speed=75"
FANPARMS423="dtparam=fan_temp1=62500,fan_temp1_hyst=3000,fan_temp1_speed=128"
FANPARMS424="dtparam=fan_temp2=70000,fan_temp2_hyst=3000,fan_temp2_speed=192"
FANPARMS425="dtparam=fan_temp3=77500,fan_temp3_hyst=3000,fan_temp3_speed=255"
sudo sdm \
...
--burn /dev/$DEVICE \
--expand-root \
--plugin copyfile:"$FANPARMS420" \
--plugin bootconfig:"$FANPARMS421" \
--plugin bootconfig:"$FANPARMS422" \
--plugin bootconfig:"$FANPARMS423" \
--plugin bootconfig:"$FANPARMS424" \
--plugin bootconfig:"$FANPARMS425" \
...
$IMGDIR/${MYIMAGE}32.img
RC=$?
sdm is happy and the pi is happy, so I'm happy
from sdm.
Nice! I'll add a line-length check to the bootconfig plugin to help avoid errors, especially since "extra" characters are just ignored by the system.
from sdm.
Or, to cut down on the number of lines in my script, I can do this?
--plugin copyfile:"$FANPARMS420" --plugin bootconfig:"$FANPARMS421" --plugin bootconfig:"$FANPARMS422" \
--plugin bootconfig:"$FANPARMS423" --plugin bootconfig:"$FANPARMS424" --plugin bootconfig:"$FANPARMS425" \
from sdm.
I would expect that to work.
Don't know if it's of interest to you or not, but you could also set up plugin @files, one per fan profile. For instance, here's fanprofile1.plugins:
bootconfig:dtparam=fan_temp0=55000,fan_temp0_hyst=3000,fan_temp0_speed=75
bootconfig:dtparam=fan_temp1=62500,fan_temp1_hyst=3000,fan_temp1_speed=128
bootconfig:dtparam=fan_temp2=70000,fan_temp2_hyst=3000,fan_temp2_speed=192
bootconfig:dtparam=fan_temp3=77500,fan_temp3_hyst=3000,fan_temp3_speed=255
and then use --plugin @fanprofile1.plugins
.
Keeps the command lines simpler at the expense of having more configuration files. I use plugin lists for my server configs:
apt-cacher-ng:tunnelenable=true
postfix:relayhost=mail.mydomain.com|mailname=mydomain.com|domain=mydomain.com|[email protected]
logwatch:config=/rpi/etc/logwatch|sendfrom=ps-logwatch<[email protected]>|sendto=bls<[email protected]>
ndm:localsrc=/l/work/ndm|config=/rpi/pisrv1/etc/dbndm.json
/l/work/mydomain/host-plugin:host=pisrv1
from sdm.
sdm 12.2 checks for config.txt lines too long. Closing this issue. Please re-open or start a new issue if required.
from sdm.
Related Issues (20)
- wifi config isn't being applied HOT 8
- Change default aes cipher from aes-cbc-essiv:sha256 to aes-xts-plain64 HOT 4
- ELI5 add authorized_keys file for ssh. HOT 4
- serial plugin not able to disable shell console HOT 14
- Allow to specify the root and boot partitions HOT 16
- The apt-addrepo plugin seems to ignore the name argument HOT 3
- Console colors are completely broken after sdm run HOT 9
- Unable to logon to newly imaged NVMe HOT 8
- Invalid systemd version check HOT 4
- Looking for way to set hostname to MAC address during first run HOT 1
- Using of sdm without of system-wide installation HOT 4
- Add ability to assign FS label in parted plugin HOT 6
- Add a user and their SSH key? HOT 5
- Image is not sdm-enhanced HOT 9
- Failure in docker image HOT 2
- [sdm-cryptconfig] - sdmcryptfs does not ask for password on RaspberryPi 5 HOT 10
- system:"name=s1|systemd-config=system=... fails HOT 5
- 'truncate' can fail because of fs.protected_regular HOT 3
- Confusion about systemd HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdm.