WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: piCore 9.0.3 boot to python script with GUI  (Read 22510 times)

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #45 on: May 14, 2020, 04:43:30 AM »
I read more carefully usr/local/var/log/Xorg.0.log. Following the errors, I am now loading also xf86-video-fbturbo.tcz, xf86-input-evdev.tcz, xkeyboard-config.tcz and xkbcomp.tcz (almost all the extensions installed with Xorg.tcz http://tinycorelinux.net/9.x/armv6/tcz/Xorg.tcz.dep). startx works again and the commands in ./.X.d as well. So probably only Xprogs.tcz is not necessary, right?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: piCore 9.0.3 boot to python script with GUI
« Reply #46 on: May 14, 2020, 09:15:57 AM »
Hi Pacca
... So probably only Xprogs.tcz is not necessary, right?
That sounds correct.  Xprogs  provides the programs and icons that show up in the wbar at the bottom of the screen. I don't see
anything in there that you would need for what sounds like an embedded application.

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #47 on: May 14, 2020, 09:24:36 AM »
Hi Pacca
... So probably only Xprogs.tcz is not necessary, right?
That sounds correct.  Xprogs  provides the programs and icons that show up in the wbar at the bottom of the screen. I don't see
anything in there that you would need for what sounds like an embedded application.
Hi Rich,
yes it is an embedded application, and it looks like the software side of the project is finally complete. Thank you very much!

... My intention is to boot the system as fast as possible (3 seconds maximum, is this even possible?) and to load directly a python script with a TK GUI, without passing through the OS desktop.
Even if the boot time is not even close to 3 seconds, it works perfectly. It takes a little less than 30 seconds to start the GUI script, but still it is great. And I learned a lot in the process.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: piCore 9.0.3 boot to python script with GUI
« Reply #48 on: May 14, 2020, 09:32:58 AM »
Hi Pacca
If you like, you can attach a fresh copy of  messages.txt  to your next post (not pastebin) and I'll see if I can spot any other issues.

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #49 on: May 14, 2020, 10:02:20 AM »
Hi Rich,

sure, here it is! I'll offer you a beer if you can spot anything more ;D

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: piCore 9.0.3 boot to python script with GUI
« Reply #50 on: May 14, 2020, 12:04:27 PM »
Hi Pacca
I don't see a whole lot to work with, so here are a few minor observations:

I don't have any Pi hardware so the only baseline I have to compare against is x86. On 3 machines running different TC kernels
the rootfs unpack time is 0.20 to 0.25 seconds. Your Pi takes ~0.64 seconds. Depending on the trade off between file read
speed and decompression speed, you might be able to pick up a couple hundred  milliseconds  by lowering or increasing the
compression ratio.
Code: [Select]
Jan  1 00:00:04 box user.info kernel: [    0.350381] Trying to unpack rootfs image as initramfs...
Jan  1 00:00:04 box user.info kernel: [    0.994230] Freeing initrd memory: 4464K (dbb94000 - dbff0000)


The  squashfs  driver is taking almost a full second to load. My machines (oldest to newest) take 0.04, 0.125, and 0.04 seconds.
I may be comparing apples to oranges, so just for some context, my oldest machine is a Dell 800 Mhz Pentium III from 2002 running TC4.
Code: [Select]
Jan  1 00:00:04 box user.info kernel: [    4.307435] squashfs: version 4.0 (2009/01/31) Phillip Lougher
Jan  1 00:00:05 box user.info kernel: [    5.388360] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
Jan  1 00:00:05 box user.info kernel: [    5.499410] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
My understanding is Pi boots off of  mmcblk0p1  and then unmounts it when booting is complete and extensions are stored on
mmcblk0p2  which stays mounted. My question is, why is  mmcblk0p2  being mounted twice?


How big is your  mydata.tgz  file? It looks like it takes about 3 seconds to restore.
Code: [Select]
Jan  1 00:00:17 box local2.notice sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/tar -C / -zxf /mnt/mmcblk0p2/tce/mydata.tgz
Jan  1 00:00:20 box user.notice kernel: [   20.388901] random: crng init done


Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #51 on: May 15, 2020, 03:33:37 AM »
Hi Pacca
I don't see a whole lot to work with, so here are a few minor observations:
Hi Rich,
you have a good eye for spotting small inaccuracies!

The  squashfs  driver is taking almost a full second to load. My machines (oldest to newest) take 0.04, 0.125, and 0.04 seconds.
I may be comparing apples to oranges, so just for some context, my oldest machine is a Dell 800 Mhz Pentium III from 2002 running TC4.
Code: [Select]
Jan  1 00:00:04 box user.info kernel: [    4.307435] squashfs: version 4.0 (2009/01/31) Phillip Lougher
Jan  1 00:00:05 box user.info kernel: [    5.388360] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
Jan  1 00:00:05 box user.info kernel: [    5.499410] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
My understanding is Pi boots off of  mmcblk0p1  and then unmounts it when booting is complete and extensions are stored on
mmcblk0p2  which stays mounted. My question is, why is  mmcblk0p2  being mounted twice?
I know the specs of Raspberry Pi Zero on paper, but I don't know how they really compare in real life. Processor power and RAM size should be comparable, but the real difference I think is coming from the low-speed SD card. Regarding the double mount of mmcblk0p2, at first I thought it was coming from my multiple experiments with extensions, config.txt and cmdline.txt. But then in an old thread about piCore7 I saw that bmarkus has the same behavior with his Raspberry Pi 2. http://forum.tinycorelinux.net/index.php/topic,19759.msg122571.html#msg122571. I don't know why is being mounted twice, but probably is a function and not a bug.

How big is your  mydata.tgz  file? It looks like it takes about 3 seconds to restore.
Code: [Select]
Jan  1 00:00:17 box local2.notice sudo:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/tar -C / -zxf /mnt/mmcblk0p2/tce/mydata.tgz
Jan  1 00:00:20 box user.notice kernel: [   20.388901] random: crng init done
I know, mydata.tgz is 6.6 MB because I had to install two python libraries to run my script. Now I am still trying to understand how to build the *.tcz extensions instead of loading a big backup.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: piCore 9.0.3 boot to python script with GUI
« Reply #52 on: May 15, 2020, 03:40:41 AM »
If you build your python libraries like this:
Code: [Select]
$ python3 setup.py build
$ sudo python3 setup.py install --root=/tmp/pkg

..you can remove anything unneeded under /tmp/pkg (__pycache__ folders, *.pyc, *.pyo, etc) and then:
Code: [Select]
$ cd /tmp
$ sudo mksquashfs pkg/ mypython.tcz

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #53 on: May 15, 2020, 04:48:26 AM »
Hi Juanito,
wow it is much easier than I thought, thanks! Anyway, I don't know why I can't reach out the wiki, it says permission denied.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: piCore 9.0.3 boot to python script with GUI
« Reply #54 on: May 15, 2020, 04:50:04 AM »
There is an ongoing problem with the wiki host.

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #55 on: May 15, 2020, 05:07:07 AM »
Alright, but I found a mirror here I think: http://wiki.tinycorelinux.net/doku.php?id=welcome.
« Last Edit: October 27, 2022, 11:19:11 PM by Rich »

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #56 on: May 15, 2020, 10:15:50 AM »
Great, I had to change some paths to match piCore structure, but eventually it works. Now loading mydata.tgz takes less than 1 second.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11619
Re: piCore 9.0.3 boot to python script with GUI
« Reply #57 on: May 15, 2020, 10:40:41 AM »
Hi Pacca
... The  squashfs  driver is taking almost a full second to load. My machines (oldest to newest) take 0.04, 0.125, and 0.04 seconds.
I may be comparing apples to oranges, so just for some context, my oldest machine is a Dell 800 Mhz Pentium III from 2002 running TC4.
Code: [Select]
Jan  1 00:00:04 box user.info kernel: [    4.307435] squashfs: version 4.0 (2009/01/31) Phillip Lougher
Jan  1 00:00:05 box user.info kernel: [    5.388360] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
Jan  1 00:00:05 box user.info kernel: [    5.499410] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
...
... I saw that bmarkus has the same behavior with his Raspberry Pi 2. http://forum.tinycorelinux.net/index.php/topic,19759.msg122571.html#msg122571. I don't know why is being mounted twice, but probably is a function and not a bug. ...
I see in his dmesg that loading the  squashfs  driver is taking less than 0.001 seconds compared to your 1.08 seconds. I checked
a couple of the dmesg attachments in the post just before bmarkus and  squashfs  loaded just as fast as for bmarkus.

Maybe a couple of other picore users could post there timing info for  squashfs  load time.


Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14815
Re: piCore 9.0.3 boot to python script with GUI
« Reply #58 on: May 15, 2020, 10:47:30 AM »
Code: [Select]
[    1.922584] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    1.951714] usb 1-1.4: new full-speed USB device number 4 using xhci_hcd

piCore-11.x RPi4

Offline redFrik

  • Newbie
  • *
  • Posts: 6
Re: piCore 9.0.3 boot to python script with GUI
« Reply #59 on: May 15, 2020, 11:33:36 AM »
Code: [Select]
Jan  1 00:00:04 box user.notice kernel: [    4.507954] random: crng init done
Jan  1 00:00:04 box user.info kernel: [    4.525273] squashfs: version 4.0 (2009/01/31) Phillip Lougher
Jan  1 00:00:05 box user.info kernel: [    5.785504] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
Jan  1 00:00:05 box user.info kernel: [    5.880092] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
rpi0, piCore9.0.3
(great thread btw, i've learned a lot.  thanks.)