WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Found the problem with slow boot time rootfs-piCore-13.0.3.gz  (Read 3378 times)

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« on: September 07, 2021, 01:32:52 PM »
If I don't misunderstand the file: /usr/bin/tce-setup.

In the function: setupExtnDirs

Why should all the files and directories in /mnt/mmcblk0p2/tce/optional/ and all the recursive being changed with the correct rights and ownership every boot time ?

So when you adding more and more files into this directory even if you don't load them in onboot.lst. Slower and slower the boot time becomes.

I can't follow the flow thru the script's to understand if this function need some logic like the lines above, to just make change when the directory exist.

Or even smarter, just only make change with the corresponding files in onboot.lst with the correct rights and ownership(not everybody).

Thanks
//Patrik



Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #1 on: September 07, 2021, 02:14:09 PM »
Or maybe even smarter set the right's and ownership then you install/download them to there corresponding directory.


Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1267
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #2 on: September 07, 2021, 02:23:12 PM »
Its much faster to just do a recursive change.   Otherwise you would have to do it file by file based on what is on onboot and all the recursive dependencies.

This is for a pi0 with 109 extensions

Code: [Select]
# time chown -R tc.staff / mnt / mmcblk0p2 / tce
real    0m 0.11s
user    0m 0.01s
sys     0m 0.06s
# time chmod -R g+w / mnt / mmcblk0p2 / tce
real    0m 0.05s
user    0m 0.01s
sys     0m 0.03s

A pi4 with 4 times as many extensions is half the amount of time above.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #3 on: September 07, 2021, 03:18:36 PM »
Its much faster to just do a recursive change.   Otherwise you would have to do it file by file based on what is on onboot and all the recursive dependencies.

This is for a pi0 with 109 extensions

Code: [Select]
# time chown -R tc.staff / mnt / mmcblk0p2 / tce
real    0m 0.11s
user    0m 0.01s
sys     0m 0.06s
# time chmod -R g+w / mnt / mmcblk0p2 / tce
real    0m 0.05s
user    0m 0.01s
sys     0m 0.03s

A pi4 with 4 times as many extensions is half the amount of time above.

Yes of course, but do you need to call this function every boot ?

Code: (bash) [Select]
tc@box:~$ time chown -R tc.staff / mnt / mmcblk0p2 / tce                             
real    0m 35.85s                                                               
user    0m 0.00s                                                               
sys     0m 1.38s                                                               
tc@box:~$ time chmod -R g+w / mnt / mmcblk0p2 / tce                                 
real    0m 35.99s                                                               
user    0m 0.03s                                                               
sys     0m 0.89s
                                                               

Code: (bash) [Select]
ls  / mnt / mmcblk0p2 / tce / optional / | wc -l
147

On:
Model           : Raspberry Pi 3 Model B Plus Rev 1.3



Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #4 on: September 07, 2021, 05:11:37 PM »
Hi patrikg
I think there is something wrong with your setup. It should not take over 0.240 seconds per file to  chown.
This is after clearing the system cache:
Code: [Select]
tc@E310:~$ time sudo busybox chown -R tc:staff /mnt/sda1/tce; time sync
real    0m 0.10s
user    0m 0.00s
sys     0m 0.04s
real    0m 0.16s
user    0m 0.00s
sys     0m 0.00s
tc@E310:~$ ls /mnt/sda1/tce/optional/ | wc -l
1309
tc@E310:~$
Total time to chown 1300 files and syncing the file system is 0.260 secomds.

I ran the same test on an old USB thumb drive with 1000 files and the total time was 0.690 seconds.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #5 on: September 08, 2021, 04:26:51 AM »
Thank you for you reply.

I have to investigate little more about this, if this just was an unhappy sd card.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #6 on: September 10, 2021, 03:54:30 AM »
Rich, thank you.

I Found my problem. Haven't thought about this.

I use the also tce directory for my source files, trying to compile u-boot for supporting PI 3B+ 32bit, having problem with the getting inbuilt usb network card (lan78xx) working. To my surprise the 64 bit working fine. But for some reason the 32bit don't working.

So there are lots of more files in the tce directory.
Tried first to git clone into my home directory, but for some reason that didn't work.
So i went to the tce directory instead.

Instead of using my home directory that is in ram.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1267
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #7 on: September 10, 2021, 07:59:30 AM »
Create another folder in the root of /mnt/mmcblk0p2.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #8 on: September 10, 2021, 08:41:05 AM »
Hi patrikg
So if you have all of the source packages under one directory like this:
Code: [Select]
/mnt/mmcblk0p2/tce/SourceFiles/Then move them like this:
Code: [Select]
mv /mnt/mmcblk0p2/tce/SourceFiles /mnt/mmcblk0p2This will be very quick since there is no copying involved, only one entry gets changed in the file system.

If you created separate directories under  /mnt/mmcblk0p2/tce  then do something like this:
Code: [Select]
sudo mkdir /mnt/mmcblk0p2/SourceFiles
sudo chown tc:staff /mnt/mmcblk0p2/SourceFiles
mv /mnt/mmcblk0p2/tce/Dir1 /mnt/mmcblk0p2/SourceFiles
mv /mnt/mmcblk0p2/tce/Dir2 /mnt/mmcblk0p2/SourceFiles
 ...

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #9 on: September 10, 2021, 09:11:17 AM »
Yes that is a great suggestion, and then i also can make a link from my home directory to my source directory.
Don't know if I have to exclude the link, to not include the backup then using filetool.sh -bv.
It was so easy way to get into the tce directory when using the alias ce.

 

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #10 on: September 10, 2021, 09:26:36 AM »
Hi patrikg
You definitely want to exclude the link otherwise you will spend extra time backing up all of the source directories.
Add the link to your  /opt/.xfiletool.lst file so it doesn't get backed up.
Create the link in your  ~/.profile  file someplace before the  TERMTYPE=  statement.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #11 on: September 10, 2021, 01:11:49 PM »
tar does not follow symlinks by default, so if you don't have persistent home, it's fine to back up symlinks in /home.
The only barriers that can stop you are the ones you create yourself.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11694
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #12 on: September 10, 2021, 02:24:42 PM »
Hi curaga
I did not realize that. I stand corrected. :)

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #13 on: September 10, 2021, 04:31:28 PM »
Thank you all.

I let you all know if i get u-boot working in 32 bit mode, i have done it before with my first pi.
I have to investigate more what the problem can be.

I have making this before with my first original pi just with 256mb memory.
Booted up picore with u-boot just to boot up kernel and initramfs and root with nfs. Working well.
So all access from/to the sdcard are eliminated.
Even if picore not writing anything to it after the system booted.

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 722
Re: Found the problem with slow boot time rootfs-piCore-13.0.3.gz
« Reply #14 on: September 12, 2021, 05:17:09 AM »
Now i got my u-boot working with networking.
I having a Raspberry PI 3B+.
But the configs for 32bit in u-boot configs directory just contains for the 3B not plus.
So i just edit the config file to get the device tree file for 3B+.
Then it just starting to work.

This setup is useful for network booting raspberry pi 0-3 without tempering with the OTB. 

Like this:
Code: (diff) [Select]
--- a/configs/rpi_3_32b_defconfig
+++ b/configs/rpi_3_32b_defconfig
@@ -6,7 +6,7 @@ CONFIG_TARGET_RPI_3_32B=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x4000
-CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
+CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b-plus"
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_USE_PREBOOT=y