Welcome! Log In Create A New Profile

Advanced

Setting a kernel parameter at boot time?

Posted by hanker 
Setting a kernel parameter at boot time?
October 27, 2011 10:58AM
Greetings

I'd like to get fsprotect working on my Dockstar. fsprotect is a Debian package that makes it so that I can make my boot usb flash drive read-only with a writeable layer in RAM. To enable fsprotect on a machine that uses GRUB 2, I would set a kernel parameter like so:

fsprotect=$tmpfs_size

So, e.g., if the Dockstar used GRUB 2 and I wanted to reserve 20 MB for the fsprotect writeable layer, I would have a line like the following in /boot/grub/grub.cfg:

linux	/boot/vmlinuz-2.6.32-5-kirkwood root=UUID=b0bbbf98-d59d-4413-aeda-f2b6b9e851ed ro quiet fsprotect=20M

How do I set this fsprotect kernel parameter for u-boot?

Thank you!
Re: Setting a kernel parameter at boot time?
November 02, 2011 04:13PM
You add the "fsprotect=20M" part to the "bootargs".
You can set and save those parameters from within Debian using the "fw_setenv" command, or by halting the boot process and using the "setenv" command on the u-boot prompt. For the latter to be permanently set, you need to issue a "saveenv" after you have modified the bootargs on the u-boot prompt.

So, step by step for changing it from within debian:

1) In Debian issue a "fw_printenv".
2) Copy the whole part that says "bootargs=..." and paste it into a text editor.
3) Now the command to make the change should look like this:

fw_setenv bootargs '... fsprotect=20M'

Where the "..." is the old content of the bootargs that followed the "=".


Whatever way you choose to edit the kernel commandline (="bootargs" in u-boot), be sure to double or better triple check it before rebooting. If you do something wrong there is a good chance that the dockstar won't boot afterwards. That doesn't mean that it will be dead, it just means that you then might need a serial connection to the device to reedit the parameters, in order to make it boot again. ;-)
Re: Setting a kernel parameter at boot time?
November 02, 2011 06:04PM
If your using Jeff's uboot you could also use the usb_custom_params variable. You set can set this variable like this:
fw_setenv usb_custom_params=fsprotect=20M
On my Dockstars I have added bootargs using this variable. Here's what it like in my uboot environment.
usb_custom_params=nic=auto:eth0:dhcp kbd=uk init=/sbin/ubootchartd
Re: Setting a kernel parameter at boot time?
November 03, 2011 08:54AM
ingmar_k, laprjns:


Thank you for your replies.

Re: fw_setenv

I have done this: I have added a fsprotect=20M kernel parameter. But this makes it to where the Dockstar won't boot. It turns out that there's some sort of incompatibility between the fsprotect package and the low-level stuff that u-boot does at boot time. I'm currently working on a different scheme to make my boot flash drive read-only. I will post once I get it figured out.

I'm using netconsole, so I don't have to use fw_setenv; I can use setenv in netconsole, which is non-permanent. I've interrupted the startup with netconsole and modified usb_set_bootargs so that it adds the fsprotect=20M kernel parameter. Then the Dockstar won't boot. Or at least I see "Starting kernel ..." in netconsole, but the Dockstar never responds to ssh. At that point I just pull the power, plug it back in, and then the Dockstar boots just fine.

Thank you :)
Re: Setting a kernel parameter at boot time?
November 03, 2011 05:39PM
Yep, for testing purposes just a "quick" setenv is the way to go. Sorry to hear that your plan didn't quite work out the way you had hoped, though.
I don't know anything about the fsprotect stuff, so I can't really comment on that.
Stefanos Harhalakis
Re: Setting a kernel parameter at boot time?
March 29, 2012 08:24AM
Hi,

If you still have problems with fsprotect, feel free to contact me with e-mail as I may be able to sed some light since I know exactly how it operates.
Re: Setting a kernel parameter at boot time?
September 30, 2016 03:45AM
Hi Stefanos,

Can you supply me your e-mail as I am busy setting up a system with fsprotect.

Thank you kb
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: