Power & Source of Big Ideas

[SOLVED]NanoPiM2A: UBoot kern cmnd line with 'fw_setenv'

Moderators: chensy, FATechsupport

Hello all,

I'm trying to change the boot command line parameters on the Nanopi, in order to isolate one of the CPUs.
This is pretty straightforward on an x86 machine via the GRUB line:
GRUB_CMDLINE_LINUX_DEFAULT="isolcpus=1"

However on Arm-Uboot you have to do it with the 'fw_setenv' utility. But the setup is quite complicated, as you first have to create the config files for the utility itself. And those parameters really have to match the system -i.e. the exact location of uboot on the sd card or something like that, or bad things will happen.

My question, has anyone successfully used 'fw_setenv' with the NanoPi boards? A small clarification or example would be really appreciated. Again I just want to set the 'isolcpus' option.

Thank you very much

Note: I also tried the boot.cmd ->mkimage -> boot.src scheme. It 'worked' as in no errors were shown and the .scr file was created (under /boot) but it had no effect :(
droid wrote:
Hello all,

I'm trying to change the boot command line parameters on the Nanopi, in order to isolate one of the CPUs.
This is pretty straightforward on an x86 machine via the GRUB line:
GRUB_CMDLINE_LINUX_DEFAULT="isolcpus=1"

However on Arm-Uboot you have to do it with the 'fw_setenv' utility. But the setup is quite complicated, as you first have to create the config files for the utility itself. And those parameters really have to match the system -i.e. the exact location of uboot on the sd card or something like that, or bad things will happen.

My question, has anyone successfully used 'fw_setenv' with the NanoPi boards? A small clarification or example would be really appreciated. Again I just want to set the 'isolcpus' option.

Thank you very much

Note: I also tried the boot.cmd ->mkimage -> boot.src scheme. It 'worked' as in no errors were shown and the .scr file was created (under /boot) but it had no effect :(


U-boot boot loader must have enabled support for loading and executing boot.scr ... this might not be by default. Usually, it's possible to break the boot process via (serial) console and manually set & save u-boot environment. Adding isocpus=1 at the end of bootarg variable ...

Setting this from Linux with gw_setenv ... not sure if it is supported either.
Wow that was fast, thanks igorp, I will look into it some more.

Also I forgot to mention on the NanoPi wiki it says:

Insert your MicroSD card into a PC host running Linux, mount the boot and rootfs sections of the SD card and follow the steps below:
1) If you want to change your kernel command line parameters you can do it via the fw_setevn utility under "sd-fuse_nanopi2/tools".
Check the current Command Line:

cd sd-fuse_nanopi2/tools
./fw_printenv /dev/sdc | grep bootargs


I don't know what the hell it means to 'mount' the boot and rootfs. Although I know you can 'mount' the sd card image to se the contents. it's all a bit confusing.
I can see the two 'partitions' under /dev/disk/by-label, (on the NP file manager) but as far as 'mounting' them on the PC, it makes no sense.

Thanks for any further help guys
Also I forgot to mention on the NanoPi wiki it says:


This means you need to insert this SD card into some Linux computer. Some deskop Linuxes "mount" this removable media (USB keys, SD cards, ...) automatically, on others you need to mount it manually. Than edit referred files, "unmount" SD card and boot it on your board.

I don't know if this will work, but its worth trying on FriendlyARMs manual.
igorp wrote:
Also I forgot to mention on the NanoPi wiki it says:


This means you need to insert this SD card into some Linux computer. Some deskop Linuxes "mount" this removable media (USB keys, SD cards, ...) automatically, on others you need to mount it manually. Than edit referred files, "unmount" SD card and boot it on your board.

I don't know if this will work, but its worth trying on FriendlyARMs manual.


Ok thank you for paraphrasing that igorp, It helped me figure it out !

For anyone out there, there were a couple of quirks in that the SD card doesn't appear as /dev/sd but rather as dev/mmcblk0, both on my laptop and on the NanoPi.

Also the configuration tools were not in the OS image but in github, that had me a bit confused too:
https://github.com/friendlyarm/sd-fuse_nanopi2

And yeah i was able to do the writing of the settings on the NanoPi itself, no need for a laptop with Linux really.
Just go on the command console to the directory where you put the tools:
/sd-fuse_nanopi2-master/tools/armv7

and use the following lines, in my case to add the isolcpus=3 parameter:

To show the current parameters:
fw_printenv /dev/mmcblk0

To change bootargs:
fw_setenv /dev/mmcblk0 bootargs console=ttyAMA0,115200n8 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait init=/sbin/init systemd.show_status=false g_ether.host_addr=82:cf:ce:fa:44:18 initrd=0x49000000,0x400000 console=tty1 lcd=HDMI720P60 isolcpus=3

*Note that until the settings have been written with fw_setenv at least once, both commands will issue an error about "bad crc" but this can be ignored.

*Also note that there was no need to make any address configuration file for the fw utility. It worked right off the bat.

Issue printenv again to verify the setting, and reboot.

Who is online

In total there are 3 users online :: 0 registered, 0 hidden and 3 guests (based on users active over the past 5 minutes)
Most users ever online was 5185 on Wed Jan 22, 2020 1:44 pm

Users browsing this forum: No registered users and 3 guests