Author Topic: Quick boot on Raspberry for embedded application  (Read 6892 times)

0 Members and 1 Guest are viewing this topic.

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Quick boot on Raspberry for embedded application
« on: May 23, 2021, 09:12:16 am »
Hi
I need to noticeably reduce the boot time on a Raspberry for an embedded application.

Everything I have found seems to require compiling scaled-down linux versions, buildroot, yocto, void linux, OpenWRT, Poky.

Anyone with experience in the field?

I just need Wifi and the UART. If there was an .img file to create the SD, all the better, because it is complex for me to have to compile and it can take hours before it does not work.
 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2570
  • Country: fr
    • kripton2035 schematics repository
Re: Quick boot on Raspberry for embedded application
« Reply #1 on: May 23, 2021, 11:29:27 am »

 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: Quick boot on Raspberry for embedded application
« Reply #2 on: May 23, 2021, 11:42:02 pm »
I need to noticeably reduce the boot time on a Raspberry for an embedded application.

What would be the maximum boot time allowed?
 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3772
  • Country: gb
Re: Quick boot on Raspberry for embedded application
« Reply #3 on: May 24, 2021, 10:15:37 am »
I just need Wifi and the UART.

All you need is to edit the file which describes the services to be launched.
Less services, less time to boot. Easy job.
Wifi requires more stuff than the simple Ethernet.
The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #4 on: May 25, 2021, 10:01:13 am »
What would be the maximum boot time allowed?

10 seconds.
 

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2570
  • Country: fr
    • kripton2035 schematics repository
Re: Quick boot on Raspberry for embedded application
« Reply #5 on: May 25, 2021, 10:19:30 am »
out of curiosity, what does the Pi exactly between wifi and uart ?
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #6 on: May 25, 2021, 11:49:09 am »
out of curiosity, what does the Pi exactly between wifi and uart ?

WIFI, I use it to connect from PC with SmarTTY and WinSCP to configure and update files. I do not like to use wired Ethernet, I find it more comfortable to do it over WIFI. And in the future I also want to develop an Android App so that the user can configure the product and upload firmware updates from the mobile phone.

UART, to communicate with an RT1064 microcontroller that sends commands to the Raspberry to play videos.
 

Offline ralphrmartin

  • Frequent Contributor
  • **
  • Posts: 479
  • Country: gb
    • Me
Re: Quick boot on Raspberry for embedded application
« Reply #7 on: May 25, 2021, 03:57:14 pm »
Why not just boot directly from a USB 3 SSD? Wouldn't this be quick enough? It may not be the cheapest solution, but might be the easiest.

As noted above, you could also turn off unwanted services for extra speed: e.g.
systemctl disable bluetooth
systemctl stop bluetooth

 

Offline DiTBho

  • Super Contributor
  • ***
  • Posts: 3772
  • Country: gb
Re: Quick boot on Raspberry for embedded application
« Reply #8 on: May 25, 2021, 04:21:49 pm »
Even a USB-stick should be faster than an SD card.
Except those gold-ones used for digital video recording.

So
-1- turn off unwanted services for extra speed
-2- try USB-stick for other extra I/O speed

The opposite of courage is not cowardice, it is conformity. Even a dead fish can go with the flow
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: Quick boot on Raspberry for embedded application
« Reply #9 on: May 25, 2021, 05:14:28 pm »
What would be the maximum boot time allowed?

10 seconds.

10 seconds is definitely no problem.
I managed about 5 seconds with a RPi3 (and 4). For that to happen, you need to install a very minimal Linux distro with no desktop environment and the minimum amount of services enabled. (Also of course, use a decent fast SD card.)
I personally use ArchLinuxARM for this. The base install is pretty minimal and comes with no desktop env. After installing it, you can fine-tune by disabling services you don't need, but under 10s with the base install should be no problem already.

RPi3: https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3
RPi4: https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4

Works a treat for me.
« Last Edit: May 25, 2021, 05:16:32 pm by SiliconWizard »
 
The following users thanked this post: luiHS

Offline kripton2035

  • Super Contributor
  • ***
  • Posts: 2570
  • Country: fr
    • kripton2035 schematics repository
Re: Quick boot on Raspberry for embedded application
« Reply #10 on: May 25, 2021, 05:40:14 pm »
not sure you can play videos on the Pi with this minimal linux distro ?
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #11 on: May 25, 2021, 06:50:04 pm »
10 seconds is definitely no problem.
I managed about 5 seconds with a RPi3 (and 4). For that to happen, you need to install a very minimal Linux distro with no desktop environment and the minimum amount of services enabled. (Also of course, use a decent fast SD card.)
I personally use ArchLinuxARM for this. The base install is pretty minimal and comes with no desktop env. After installing it, you can fine-tune by disabling services you don't need, but under 10s with the base install should be no problem already.

RPi3: https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3
RPi4: https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-4

Works a treat for me.

To install ArchLinux it can only be done from a Linux computer, it cannot be done from Widows, there is no .img file already ready to create the SD ??.
Where can I get information on how and what services can I disable?

I only use WIFI and the UART. I already have Bluetooth disabled to be able to use the serial port. I could do without keyboard and mouse, although for the near future I will need USB for a data pendrive.

« Last Edit: May 25, 2021, 06:55:27 pm by luiHS »
 
The following users thanked this post: WattsThat

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: Quick boot on Raspberry for embedded application
« Reply #12 on: May 25, 2021, 11:03:39 pm »
Well you have a number of ways of doing that. A small virtual machine with Linux (you only need the command line), or just do it from a RPi with Raspbian or similar!
That said, if you don't want to use ArchLinux ARM, you should be able to tailor Raspbian for the same thing. You just need to disable the desktop environment and a few services. I haven't tested, but a minimal Raspbian config should boot in only a couple seconds as well.
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #13 on: May 25, 2021, 11:38:57 pm »
I have a CM4 with 8Gb flash, I will try to do it with it, although if I have to compile I suppose it will be very slow.

I have already checked how to see running services with service --status-all and how to disable them with systemctl disable <service>. I don't know yet which services to disable, I have tried disabling avahi-daemon and triggerhappy. I need ssh to connect by WIFI, I do not know if need networking

I have also run the systemd-analyze blame and systemd-analyze critical-chain command, but RPY always responds with "Bootup not finished yet."

« Last Edit: May 25, 2021, 11:42:57 pm by luiHS »
 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 6769
  • Country: va
Re: Quick boot on Raspberry for embedded application
« Reply #14 on: May 26, 2021, 12:01:40 am »
Quote
To install ArchLinux it can only be done from a Linux computer

If you're  building from sources you can compile and do whatever is needed on Windows. Takes a bit of effort to set up the cross-compiler and environment, but it's doable (and you'll end up knowing exactly how the thing gets built and from what).

But if you just want to get going quickly, as SiliconWizard suggests: install Linux in a VM to do the biz. VirtualBox is free and easy to set up.
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #15 on: May 26, 2021, 05:19:18 am »

I have already installed VirtualBox on my Windows computer.
What is the best version of Linux to install and work with this issue in VirtualBox? I am going to create Buildroot for Raspberry 3 and 4.
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #16 on: May 26, 2021, 07:54:25 am »
 
Thank you all for the information and advice.

Finally I have decided to create a custom linux with buildroot, but I am doing it from a Raspberry pi 4 with a 64Gb SD card.

I have followed the instructions that I found in this tutorial.
https://ubanov.wordpress.com/2020/04/21/sistema-embebido-sobre-raspberry-pi-con-buildroot/

If the system boots in less than 10 seconds for a Raspberry pi 1, as indicated in that tutorial, which will be even less for an RPY 3 or 4, and WIFI and UART work, I'm already happy.

What I have seen is that there are a lot of parameters. Buildroot has some configurations ready for Raspberry pi 3 and 4, even so I have reviewed them all and I have remembered that wpa_supplicant may be necessary for the WIFI, the rest or they were already selected or indicated in that tutorial as open_ssh. I have also activated and configured the password for root.

iptables I do not need it, I understand that it is a firewall and in my application it is not necessary.

Now I have left it processing in my Raspberry pi4 with the make so that the .img file for the SD card is created. I suppose it will take a long time, and that if I had process it from Virtualbox on my PC, it would compile much faster, but there's no rush. If I see that it takes more than 5 hours, I will cancel it and do it on the PC.

« Last Edit: May 26, 2021, 07:59:39 am by luiHS »
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #17 on: May 26, 2021, 08:11:05 am »
 
Compilation failed, and no idea why. Here it gives five ERROR messages, for the selected processor it does not support mls, r1, r2, r8, r11 in ARM mode. Luckily it failed soon and not after hours of compiling.



 

Offline PlainName

  • Super Contributor
  • ***
  • Posts: 6769
  • Country: va
Re: Quick boot on Raspberry for embedded application
« Reply #18 on: May 26, 2021, 11:51:47 am »
Quote
What is the best version of Linux to install and work with this issue in VirtualBox? I am going to create Buildroot for Raspberry 3 and 4.

Sorry, I can't help with buildroot - when I did this I wrote a custom build script, partly because with the likes of buildroot (and, especially, crosstool) if you hit a strange problem it can often take more effort to sort it out than to have done your own from the start.

Having said that, a quick google suggests that this page may be of use:

https://jenda.hrach.eu/w/rpi-gcc
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #19 on: May 26, 2021, 04:41:46 pm »
Quote
What is the best version of Linux to install and work with this issue in VirtualBox? I am going to create Buildroot for Raspberry 3 and 4.

Sorry, I can't help with buildroot - when I did this I wrote a custom build script, partly because with the likes of buildroot (and, especially, crosstool) if you hit a strange problem it can often take more effort to sort it out than to have done your own from the start.

Having said that, a quick google suggests that this page may be of use:

https://jenda.hrach.eu/w/rpi-gcc


I had already read about the compiler, an old version is kept in Raspbian for compatibility with Raspberry pi 1, but I was not convinced by the solution.

So I tried again with VirtualBox, and again problems, it installed well, also without problems to configure everything, but when trying to Start it gave me an error, I tried to solve it, but it could not be. I already activated virtualization in the BIOS because before it did not allow me to install 64bit versions, only 32bit and with problems.

So I looked for a Debian version for ARM, not Raspbian, there is a Debian ARM that does have the GCC compiler updated to the latest version. It has also been somewhat complicated because there are enough differences with Raspbian to configure the IP, SSH and WIFI, but finally I managed to start it, and again I started to compile buildroot in the Raspberry pi4.

And there is now the Raspberry pi 4 with Debian compiling buildroot, to see if there is luck and it does not give errors.

The truth is that it is a nightmare, I found three options, and two of them gave me an error, and the third was being very complicated:
1.- PC with Virtualbox and Linux Debian
2.- Raspberry pi 4 with Raspbian
3.- Raspberry pi 4 with Debian 10.

If all fail, then I will order a new SSD disk for my PC to install a Linux version.
« Last Edit: May 26, 2021, 04:49:43 pm by luiHS »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14230
  • Country: fr
Re: Quick boot on Raspberry for embedded application
« Reply #20 on: May 27, 2021, 12:01:09 am »
I have a CM4 with 8Gb flash, I will try to do it with it, although if I have to compile I suppose it will be very slow.

Compile what?
 

Offline artag

  • Super Contributor
  • ***
  • Posts: 1058
  • Country: gb
Re: Quick boot on Raspberry for embedded application
« Reply #21 on: May 27, 2021, 01:09:25 am »
There are a couple of Pi distributions intended specifically for a media player.
Wouldn't they be a good starting point ?
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #22 on: May 27, 2021, 05:48:23 am »

Three tries and I had to cancel it because it was stuck during the compilation process.

Now I am following these instructions, they are similar but downloading the latest stable version of buildroot, and the compilation process is launched before configuring to add wifi, ssh and others.

https://armphibian.wordpress.com/2019/10/01/how-to-build-raspberry-pi-zero-w-buildroot-image/

If it fails me too, I'll buy an SSD for the PC, install Linux and do it again.

 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #23 on: May 27, 2021, 05:49:17 am »
There are a couple of Pi distributions intended specifically for a media player.
Wouldn't they be a good starting point ?

Problem is only the boot time. I prefer build a custom version with only the essential for fast boot.
 

Online luiHSTopic starter

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: es
Re: Quick boot on Raspberry for embedded application
« Reply #24 on: May 27, 2021, 05:50:24 am »
I have a CM4 with 8Gb flash, I will try to do it with it, although if I have to compile I suppose it will be very slow.

Compile what?

buildroot

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf