Toradex Easy installer Wrapup.sh -> Shutdown instead reboot -f

Hi,

I have a question regarding the wrapup.sh file that is used while installing a Linux version with the aid of the easy installer. I have search over the developer website and community forum but could not find a thing or two.

In the wrapup.sh you can add the command “reboot -f” at the end of the file (just before the exit 0) to reboot the CPU. But I want to be able to shutdown the device (like you can do when you use the GUI with the options: “Power off”, “Reboot”, and “Return to menu”). I already tried: “shutdown”, “shutdown -P now”, and “poweroff”. None where successful. Is this even possible?

Thanks in advance.

Kind regards,
Remco

Ps. we have a custom kernell to which we enable the “CONFIG_POWER_RESET” to be able to shutdown the board completely. I have verified this works. When I enter the command “poweroff” in a shell, then we get the standard shutdown procedure and at the end the power is cut off from the board (main power led is off).

HI @Remcovh

Thanks for writing to the Toradex Support.

Your use-case is very interesting and useful. I checked the Toradex Easy Installer version 2.0b5 and saw that the command shutdown and poweroff are missing in the image.

I created an internal Ticket to solve this issue.

Best regards,
Jaski

Thank you for looking into it. I hope it will integrated in the new image and I will be looking forward to it.

Kind regards,
Remco

Sorry to chime in here but I do not see what any such shutdown or poweroff should bring you. Please note that the Apalis iMX6 just like any other Apalis module does not have any standard power off functionality. What exactly is it that you are trying to achieve?

No problem to chime in. But if I read your comment, than I do not understand why it is possible to chose from: “Power off”, " Reboot", or " Return to menu" in the EasyInstaller when an linux OS has been installed (see picture). If I remember correctly when I press the “Power off” button than the SOM will shutdown itself and if your supported carrier boards are used the power is turned off. This is all done manual.

As described detailed manual for the Easy Installer, it is possible to automate it for production purposes. The SOM is delivered with the easy installer preloaded. So if I place the SOM in the connector and turn the system on, Easy Installer will load. If I then insert an USB stick with an OS image (and set “autoinstall”: true in the image.json) it will automatically install the OS for me. This is all without using the UI. Then the installation is complete and the picture is displayed I mentioned before. But I want to see see that it is finished, without the UI. So turning the board off would be a great choice because:

  1. The power led is off, indication installation is finished and power is off.
  2. A “free” test to see if the power shutdown mechanism works.

In the wrapup.h file you could already include the command “reboot -f” (my guess: it is an software reboot, not external hardware triggered reboot), and the SOM will reboot itself. This is one of the three options you have after installing an OS with UI. Hence my question if it possible to add the second option “shutdown” in the wrapup.h file. This way you would have the same options as in a manual OS installation with UI.

But there simply is no software way of hitting that “power off” button. So what exactly is the point really?

I understand you can’t tell the UI to press a button, neither the reboot nor shutdown button. That is not what I mean, I use it as a comparison between the manual way and the automatic way of what I would like to be able to do.

In this context. What does the “reboot -f” do than exactly in the wrapup.h file? I guess this also does not hit that “reboot” button in UI. So how does that work? there need some functions that are called upon.

I assume the Easyinstaller looks at the wrapup.h file after the installation is complete (hence the name wrapup). If it encounter the “reboot -f” command it will issue the reboot sequence code without any interaction with any UI (probably the same code that is executed when you press the reboot button in the UI, hence my comparison). So if the easyinstaller code can accept an e.g. “shutdown now” in the wrapup.h file than the same internal code will be called that is used when you press on the “shutdown” button in the UI.

The UI is there to make it easy in a simple way. The UI works perfect so there must be some code beneath that is called uppon when clicking on any button.

Hi @Remcovh

I’m not sure if I understand everything correctly but do you just mean “poweroff -f”? So you could just write in the wrapup.sh script “poweroff -f” which is basically the shutdown…

Regards,
Stefan

hi @stefan.tx

I though already that it was a bit hard to explain what I exactly try to convey.But yeah, in an essence that is what I tried to explain. I found no reference of that in the documentation, hence my post about it.

But there is no standard shutdown functionality neither on Apalis nor on Colibri. So what exactly are you hoping to achieve?

@marcel.tx

What do you mean exactly by: “There is no standard shutdown functionality…”? I honestly do not understand it when I read the various pages on the Toradex developer website. It sounds counter intuitive with the following:

  1. Gpio power off, to shutdown a setup completelylink to the developer website
  2. You can enter shutdown in terminal, and the SOM will shutdown itself. If you enable gpio power (described at point 1) than you are also able to “turn off” the power to the carrierboard if the carrierboard supports it.
  3. When installing an OS and it is finished. you can chose either a reset CPU or shutdown CPU. Picture of this is mid way the website

So please, elaborate.

  1. Gpio power off, to shutdown a setup completelylink to the developer website

Yes, but it is not standard. You would need to customise your carrier board as well as the device tree. How exactly should the Toradex Easy Installer know about any of your customisations?

  1. You can enter shutdown in terminal, and the SOM will shutdown itself.

Yes, whatever that means because depending on the module that won’t actually do much as the main power to the module is still gonna stay there.

If you enable gpio power (described at point 1) than you are also able to “turn off” the power to the carrierboard if the carrierboard supports it.

Yes, however, see my comment above.

When installing an OS and it is finished. you can chose either a reset CPU or shutdown CPU. Picture of this is mid way the website

Yes, that actually calls the following with RB_POWER_OFF which most likely as explained above won’t actually do much:

https://www.man7.org/linux/man-pages/man2/reboot.2.html

So sorry to keep asking but what exactly is it that you are trying to achieve? What should this “poweroff” exactly buy you? You may also read the explanation here:

Hi @Remcovh

I think what Marcel wanted to say is that the iMX6 doesn’t really do a power off… The reason for that is that if you want to do a proper power off you would have to inform the power supply about it. You can do this by adding a gpio-poweroff in the devicetree:
http://git.toradex.com/cgit/linux-toradex.git/tree/Documentation/devicetree/bindings/power/reset/gpio-poweroff.txt?h=toradex_4.9-2.3.x-imx
However, we do not support this on our carrier boards. Therefore, if you do a poweroff the processor will stop all tasks via systemd and then just goes into an idle mode. You can find this here:
http://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm/mach-imx/pm-imx6.c?h=toradex_4.9-2.3.x-imx
It’s in the function imx6_stop_mode_poweroff. However, for TEZI that’s already good because if you did this poweroff you are basically save to disconnect the power. So I think for your usecase everything is good if you do the “poweroff -f”.

I hope this explains it. Do you have anything to add @marcel.tx?

Sorry for the confusion.

Regards,
Stefan

So I think for your usecase everything is good if you do the “poweroff -f”.

No, that will bring absolutely nothing. After an image is installed that is it. No shutdown or similar is required at all nor will it bring anything. Remember, the Toradex Easy Installer runs from RAM so one can just remove power and nothing “bad” will happen.

@marcel.tx

I believe I understand it. But would you mind explaining the following practical experiment than, because that totally contradicts your statement? I have made an video of it, See this link to YouTube

I used a standard setup of yours. I installed the stable Linux 2.8b6 version with LXDE. After the installation I get the message is was succesfull, it is the start of the video. When I press “Power off” the system shutdown and the power is cutt off (LED are suddenly off, also measured the 3,3V rail, and that is 0V than). So there is a physical hard wired system power cutoff available. And because it works with hardware from you, I would assume it is standard.

Ps. The visible green LED at the end is from the micro USB. If the cable is removed, the LED is also off.

Hi @Remcovh

Thanks for your Input. I saw the video and actually what you see is that doing poweroff -f, the signal POWER_ENABLE_MOCI is off, which disable the Power Supply for Peripheral and hence you see the leds turned off.
However the SoM is still powered (check Sheet 3 of the Schematics of Ixora). To poweroff the SoM and carrier Board, you need to follow the instructions given in the link. But first of all you will need to customize your carrier board to have the possibility to turn off a main power supply. This possibility did not exist on Ixora carrier board.

@jaski.tx
Thank you for that explanation. Now I understand the behavioral and the TLDR frustration of Marcel trying to “explain” it.

I know it it a bit annoying, but I see on connector X5 on sheet 4 (Power Switch.SchDoc) the text “FORCE OFF”, it could poweroff the power for the SOM. If I am not mistaken.
Now hypothetically speaking. If I would modify the device tree according the documentation stated in the link. And connect the specified GPIO for Poweroff in the device tree to X5 with FORCE OFF. I would be able to shutdown the carrierboard completely when the Kernel is running. So far I already understand it, and have it working.

But the crux here is, we are using the Easyinstaller to install an OS with the modified device tree (lets assume it is a SOM straight from the factory). Like Marcel already said Easyinstaller is running from RAM. How can Easyinstaller know what gpio to assert for the poweroff sequence. Can it magically read the device tree blob that is just loaded into eMMC and thus use it without any additions. Or do you need to write some script that Easyinstaller can understand and hence make use of the poweroff functionality. Or do you need to modify the Easyinstaller “device tree” to make use of that functionality (which is not possible due to your intellectual property of Easyinstaller).

Hi

You are welcome. This Power Off Topic is not an easy topic.

Or do you need to write some script that Easyinstaller can understand and hence make use of the poweroff functionality. Or do you need to modify the Easyinstaller “device tree” to make use of that functionality (which is not possible due to your intellectual property of Easyinstaller).

Actually the GUI is protected, but you can modify the kernel and device-tree of Toradex Easy Installer for your use-case as explained here. The only thing is that you will have to maintain your custom version of Toradex Easy Installer.

I would recommend you to use Toradex Easy Installer 1.8 and decompose it, customize kernel and device-tree to your needs and reassemble tezi.itb.

Best regards,
Jaski

Hello! This seems to be the only thread related to this issue. Similar to @Remcovh I am also looking for a way to sign the operator that the flashing of the images is completed. Were the “shutdown” or “poweroff” commands ever integrated?

Right now I am using the TEZI 5.7 and an SD card is writing the needed image automatically on the eMMC. After this operation is completed it would be favorable to have an obvious sign.

poweroff -f and shutdown now are not functioning when written in the “wrapup.sh” they would be useful since they turn off the LEDs for the USB ports. And after that the operator could turn the whole board off.

My current base board does not have a display or any USB ports, this is why I prefer a “headless” operation.

Thanks in advance

Fahri

Hello @fahri ,

Would it be possible for you to share the schematics of your custom carrier board? That allows us to see which interfaces are available in it, in order to figure out a solution for you.

You can send them to support.eu@toradex.com, mentioning this topic

Best regards,
Josep