Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

secondary config.txt file #414

Closed
fabled opened this issue Apr 20, 2015 · 20 comments
Closed

secondary config.txt file #414

fabled opened this issue Apr 20, 2015 · 20 comments

Comments

@fabled
Copy link

fabled commented Apr 20, 2015

Would be nice if the boot loader would have a way to load a secondary configuration file. This would distribution to ship config.txt (or distrocfg.txt) and setup parameters for where to load kernels and initramfs, that could be simply overwritten on upgrade. And then have another file for possible hdmi, license, etc. options that are installation specific.

It'd be also nice if the kernel cmdline could be appended somehow by the user's config. It might be they want some specific command line option. So some lilo/grub style "append" option for cmdline in config.txt would be appreciated.

@popcornmix
Copy link
Contributor

You should be able to add include distrocfg.txt to config.txt and then include settings in distrocfg.txt.
You can also be able to use cmdline distrocmdline.txt to specify an alternative cmdline.txt.

@fabled
Copy link
Author

fabled commented Apr 22, 2015

include seems undocumented. Can it be documented? I suppose I'll make config.txt the distribution one, and have include usercfg.txt or similar; I hope it works even if the file does not exist.

What comes to cmdline I was hoping to have the cmdline directly in the config file, not as external file. And so that I could scatter it in proper blocks. E.g. have [pi1] with append mypi1configoption and then later [all] with append optionsforall and finally in usercfg.txt append usersoption and the final cmdline that would be pased to kernel in pi1 would be mypi1configoption optionsforall usersoption.

@pelwell
Copy link
Contributor

pelwell commented Apr 23, 2015

Just FYI, it is possible to append things to the command line using DT overlays. This would be inelegant and a bit opaque, but it would allow you to use the dtoverlay command within the board-specific sections in the way that you want.

I agree that a way to append to the command line from config.txt would be nice. Unfortunately, the ability to specify the whole line in-band would fall foul of the 79/80 character limit in the file parser, and I think fixing that properly could be quite a significant task.

@fabled
Copy link
Author

fabled commented Oct 8, 2015

Seems include distrocfg.txt does not work fully. For example, dtparam=xxx seems to work only when specified in the main config.txt.

@pelwell
Copy link
Contributor

pelwell commented Oct 9, 2015

Yes, that's right. The config file parsing is done in two passes, the second being for the DT support. include is a directive understood by the first pass, causing it to recursively parse the referenced file. The second pass doesn't recognise include, and handling it recursively is less trivial since there is more inter-line state.

The cleanest solution would be to hide the include processing in the line reader, as the C pre-processor does for C, and as the conditional blocks are handled now. It's on the list of things to look at, but it isn't a priority.

@pelwell
Copy link
Contributor

pelwell commented Oct 9, 2015

After thinking about this a bit it turned out to be quite simple, so I've prepared a patch. It will probably be in the next release.

popcornmix added a commit that referenced this issue Oct 10, 2015
See: #481

kernel: bcm2835-gpiomem: Fix for ARCH_BCM2835 builds
See: raspberrypi/linux#1154

kernel: BCM270X_DT: Add at86rf233 overlay
See: raspberrypi/linux#1151

kernel: BCM270X_DT: Make mmc overlay compatible with current firmware

firmware: arm_loader: Support DT commands in included files
See: #414

firmware: di_adv: Need up align up height to at least 4
See: https://discourse.osmc.tv/t/problems-with-divx5-videos-after-september-update/8499/7

firmware: Allow loading of tuning data from a memory block
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this issue Oct 10, 2015
See: raspberrypi/firmware#481

kernel: bcm2835-gpiomem: Fix for ARCH_BCM2835 builds
See: raspberrypi/linux#1154

kernel: BCM270X_DT: Add at86rf233 overlay
See: raspberrypi/linux#1151

kernel: BCM270X_DT: Make mmc overlay compatible with current firmware

firmware: arm_loader: Support DT commands in included files
See: raspberrypi/firmware#414

firmware: di_adv: Need up align up height to at least 4
See: https://discourse.osmc.tv/t/problems-with-divx5-videos-after-september-update/8499/7

firmware: Allow loading of tuning data from a memory block
@popcornmix
Copy link
Contributor

@pelwell's change is in latest rpi-update firmware.

@fabled
Copy link
Author

fabled commented Oct 17, 2015

I tried todays master firmware, but I could not get things to work with it as expected..

@pelwell
Copy link
Contributor

pelwell commented Oct 17, 2015

If you can upload your config files somewhere - a gist, perhaps - then we might be able to make some progress.

@fabled
Copy link
Author

fabled commented Oct 17, 2015

Maybe I misinterpreted the issue. Seems it probably works, but the SPI kernel module was just not auto loaded for some reason. This is probably due to my boot up sequence. I'll report back later if it was firmware issue.

@pelwell
Copy link
Contributor

pelwell commented Oct 17, 2015

Provided you have set dtparam=spi=on, and the spi module is not blacklisted, then it should load automatically.

@Ruffio
Copy link

Ruffio commented Dec 30, 2016

@fabled has this issue been resolved?

@fabled
Copy link
Author

fabled commented Dec 30, 2016

The feature works, but I'm still waiting it to be documented.

@fabled
Copy link
Author

fabled commented Dec 30, 2016

Also the "append" for kernel command line is not there, but might be worth a separate issue.

@Ruffio
Copy link

Ruffio commented Dec 30, 2016

@fabled how about applying for a PR so the documentation gets updated? ;-)

neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this issue Feb 27, 2017
See: raspberrypi#481

kernel: bcm2835-gpiomem: Fix for ARCH_BCM2835 builds
See: raspberrypi/linux#1154

kernel: BCM270X_DT: Add at86rf233 overlay
See: raspberrypi/linux#1151

kernel: BCM270X_DT: Make mmc overlay compatible with current firmware

firmware: arm_loader: Support DT commands in included files
See: raspberrypi#414

firmware: di_adv: Need up align up height to at least 4
See: https://discourse.osmc.tv/t/problems-with-divx5-videos-after-september-update/8499/7

firmware: Allow loading of tuning data from a memory block
@JamesH65
Copy link
Contributor

@pelwell @fabled As I read it, the missing docuementetion is just for the include directive? And the limitation specified by @pelwell above to do with device tree is no longer present? I'll update the docs once I know what is required!

@fabled
Copy link
Author

fabled commented Dec 19, 2017

Yes. The only thing missing is documentation for include directive. I think this ticket can be closed after that.

@JamesH65
Copy link
Contributor

PR here raspberrypi/documentation#784

@AlexanderKurtz
Copy link

PR raspberrypi/documentation#784 has been merged, so I think this issue can be closed now, right?

@fabled
Copy link
Author

fabled commented Feb 22, 2018

Yeah.

@fabled fabled closed this as completed Feb 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants