WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: piCore 9.0.3 boot to python script with GUI
« Reply #15 on: May 02, 2020, 07:13:14 AM »
..but the drivers you need are not in net-usb-4.9.22-piCore.

As mentioned, they are here:

http://tinycorelinux.net/9.x/armv6/releases/RPi/src/kernel/4.9.22-piCore_modules.tar.xz

..you will need to extract them and create your own extension

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #16 on: May 02, 2020, 08:44:55 AM »
Even for the usb to ethernet adapter?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: piCore 9.0.3 boot to python script with GUI
« Reply #17 on: May 02, 2020, 08:57:44 AM »
Ah, sorry, I thought you were speaking of a direct usb cable connection.

How did you try to connect to the RPi0? Which commands did you use?

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #18 on: May 02, 2020, 09:40:32 AM »
I just connected the board to the ethernet port using an usb adapter, however I see no device attached to the router from its main web page.

From the previous answers I thought that the connection over wire was automatically established. Am I wrong? Because I have no monitor or keyboard attached so I can't send any command. That's why I am trying to connect the board to the internet and access it through putty.
« Last Edit: May 02, 2020, 09:42:53 AM by Pacca »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: piCore 9.0.3 boot to python script with GUI
« Reply #19 on: May 02, 2020, 09:50:25 AM »
The RPi's with an onboard ethernet port will automatically connect to a router when booted with piCore.

I don't know if this is the case or not for a usb ethernet adapter.

Offline Greg Erskine

  • Sr. Member
  • ****
  • Posts: 402
Re: piCore 9.0.3 boot to python script with GUI
« Reply #20 on: May 02, 2020, 02:17:50 PM »
I just connected the board to the ethernet port using an usb adapter, however I see no device attached to the router from its main web page.

From the previous answers I thought that the connection over wire was automatically established. Am I wrong? Because I have no monitor or keyboard attached so I can't send any command. That's why I am trying to connect the board to the internet and access it through putty.

Yes it should be automatic. The USB ethernet adaptors I have tried have leds that light up indicating things are working.

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #21 on: May 08, 2020, 05:52:52 AM »
I finally managed to connect my Pi Zero to the internet! It was just a faulty usb adapter. Now I will continue with the configuration of the PiCore. Thank you all for the support!

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #22 on: May 11, 2020, 12:43:46 AM »
I was able to install python3.6 and all the libraries that I need to run my script. Now I am trying to create the GUI. Do I need Xorg.tcz in addition to tk.tcz to create the graphical interface?

Bonus question: there is any difference between creating an extension from a python library that is loaded into ram using copy2fs.flg, and installing it through command pip install and making a backup?

Next step is boot time optimization!

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14516
Re: piCore 9.0.3 boot to python script with GUI
« Reply #23 on: May 11, 2020, 01:32:45 AM »
Creating an extension and loading it copy2fs will be quicker than restoring a backup of a pip install - compiling the library with piCore flags will be better still.

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #24 on: May 11, 2020, 08:41:41 AM »
Thank you, I will try to understand how to create an extension or how to compile the library as last step of this project.

In the meantime, everything is finally working. I managed to install Python and its libraries, the script loads at startup with no problems, and X11 forwarding is working as well (while I am waiting for the HDMI cable to arrive). Thank you all for the great support!

Now I am trying to reduce the boot time, that seems to be much longer since I installed Xorg.tcz, Xprogs.tcz, Xlibs.tcz, xorg-server.tcz. Here the results of dmesg:
Code: [Select]
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.9.22-piCore (root@box) (gcc version 6.3.0 (piCore) ) #1 Sat Apr 15 15:30:03 UTC 2017
[    0.000000] CPU: ARMv6-compatible processor [410fb767] revision 7 (ARMv7), cr=00c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT nonaliasing instruction cache
[    0.000000] OF: fdt:Machine model: Raspberry Pi Zero Rev 1.3
[    0.000000] cma: Reserved 8 MiB at 0x1b000000
[    0.000000] Memory policy: Data cache writeback
[    0.000000] On node 0 totalpages: 114688
[    0.000000] free_area_init_node: node 0, pgdat c0931188, node_mem_map dac10000
[    0.000000]   Normal zone: 1008 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 114688 pages, LIFO batch:31
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 113680
[    0.000000] Kernel command line: bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000  dwc_otg.lpm_enable=0 console=ttyAMA0,115200 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed waitusb=1 printk.time=1 syslog
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] Memory: 431364K/458752K available (6035K kernel code, 492K rwdata, 1968K rodata, 400K init, 739K bss, 19196K reserved, 8192K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xdc800000 - 0xff800000   ( 560 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xdc000000   ( 448 MB)
[    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
[    0.000000]       .text : 0xc0008000 - 0xc05ecef4   (6036 kB)
[    0.000000]       .init : 0xc085c000 - 0xc08c0000   ( 400 kB)
[    0.000000]       .data : 0xc08c0000 - 0xc093b038   ( 493 kB)
[    0.000000]        .bss : 0xc093b038 - 0xc09f3e60   ( 740 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000028] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[    0.000058] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[    0.000150] bcm2835: system timer (irq = 27)
[    0.000592] Console: colour dummy device 80x30
[    0.000623] Calibrating delay loop... 697.95 BogoMIPS (lpj=3489792)
[    0.060289] pid_max: default: 32768 minimum: 301
[    0.060703] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.060717] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.061775] Disabling cpuset control group subsystem
[    0.061975] CPU: Testing write buffer coherency: ok
[    0.062033] ftrace: allocating 21825 entries in 65 pages
[    0.180353] Setting up static identity map for 0x8200 - 0x8238
[    0.182348] devtmpfs: initialized
[    0.191309] VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
[    0.191734] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.191758] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.193032] pinctrl core: initialized pinctrl subsystem
[    0.194462] NET: Registered protocol family 16
[    0.197058] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.207014] hw-breakpoint: found 6 breakpoint and 1 watchpoint registers.
[    0.207029] hw-breakpoint: maximum watchpoint size is 4 bytes.
[    0.207134] Serial: AMBA PL011 UART driver
[    0.209884] bcm2835-mbox 2000b880.mailbox: mailbox enabled
[    0.258825] bcm2835-dma 20007000.dma: DMA legacy API manager at dc80d000, dmachans=0x1
[    0.261585] SCSI subsystem initialized
[    0.261851] usbcore: registered new interface driver usbfs
[    0.262005] usbcore: registered new interface driver hub
[    0.262201] usbcore: registered new device driver usb
[    0.270415] raspberrypi-firmware soc:firmware: Attached to firmware from 2017-04-04 18:41
[    0.272340] clocksource: Switched to clocksource timer
[    0.326859] VFS: Disk quotas dquot_6.6.0
[    0.326974] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.327267] FS-Cache: Loaded
[    0.327629] CacheFiles: Loaded
[    0.347160] NET: Registered protocol family 2
[    0.348492] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[    0.348579] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[    0.348651] TCP: Hash tables configured (established 4096 bind 4096)
[    0.348745] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.348771] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.349061] NET: Registered protocol family 1
[    0.349796] RPC: Registered named UNIX socket transport module.
[    0.349807] RPC: Registered udp transport module.
[    0.349811] RPC: Registered tcp transport module.
[    0.349816] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.350269] Trying to unpack rootfs image as initramfs...
[    0.994005] Freeing initrd memory: 4464K (dbb94000 - dbff0000)
[    1.025862] hw perfevents: enabled with armv6_1176 PMU driver, 3 counters available
[    1.028216] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[    1.044619] zbud: loaded
[    1.048765] FS-Cache: Netfs 'nfs' registered for caching
[    1.050470] NFS: Registering the id_resolver key type
[    1.050529] Key type id_resolver registered
[    1.050535] Key type id_legacy registered
[    1.059972] jitterentropy: Initialization failed with host not compliant with requirements: 2
[    1.060147] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    1.060520] io scheduler noop registered
[    1.060532] io scheduler deadline registered (default)
[    1.060994] io scheduler cfq registered
[    1.067298] BCM2708FB: allocated DMA memory 5b100000
[    1.067359] BCM2708FB: allocated DMA channel 0 @ dc80d000
[    1.075085] Console: switching to colour frame buffer device 82x26
[    1.082531] bcm2835-rng 20104000.rng: hwrng registered
[    1.082706] vc-cma: Videocore CMA driver
[    1.082716] vc-cma: vc_cma_base      = 0x00000000
[    1.082724] vc-cma: vc_cma_size      = 0x00000000 (0 MiB)
[    1.082729] vc-cma: vc_cma_initial   = 0x00000000 (0 MiB)
[    1.083149] vc-mem: phys_addr:0x00000000 mem_base=0x1ec00000 mem_size:0x20000000(512 MiB)
[    1.108524] brd: module loaded
[    1.120949] loop: module loaded
[    1.120969] Loading iSCSI transport class v2.0-870.
[    1.121944] usbcore: registered new interface driver smsc95xx
[    1.121972] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.348142] Core Release: 2.80a
[    1.348158] Setting default values for core params
[    1.348195] Finished setting default values for core params
[    1.548546] Using Buffer DMA mode
[    1.548560] Periodic Transfer Interrupt Enhancement - disabled
[    1.548565] Multiprocessor Interrupt Enhancement - disabled
[    1.548574] OTG VER PARAM: 0, OTG VER FLAG: 0
[    1.548662] Dedicated Tx FIFOs mode
[    1.549318] WARN::dwc_otg_hcd_init:1053: FIQ DMA bounce buffers: virt = 0xdb114000 dma = 0x5b114000 len=9024
[    1.549345] FIQ FSM acceleration enabled for :
[    1.549345] Non-periodic Split Transactions
[    1.549345] Periodic Split Transactions
[    1.549345] High-Speed Isochronous Endpoints
[    1.549345] Interrupt/Control Split Transaction hack enabled
[    1.549357] dwc_otg: Microframe scheduler enabled
[    1.549441] WARN::hcd_init_fiq:459: FIQ on core 0 at 0xc0466f8c
[    1.549455] WARN::hcd_init_fiq:460: FIQ ASM at 0xc0467268 length 36
[    1.549480] WARN::hcd_init_fiq:486: MPHI regs_base at 0xdc8a5000
[    1.549551] dwc_otg 20980000.usb: DWC OTG Controller
[    1.549615] dwc_otg 20980000.usb: new USB bus registered, assigned bus number 1
[    1.549699] dwc_otg 20980000.usb: irq 56, io mem 0x00000000
[    1.549753] Init: Port Power? op_state=1
[    1.549757] Init: Power Port (0)
[    1.550139] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.550156] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.550165] usb usb1: Product: DWC OTG Controller
[    1.550175] usb usb1: Manufacturer: Linux 4.9.22-piCore dwc_otg_hcd
[    1.550184] usb usb1: SerialNumber: 20980000.usb
[    1.551418] hub 1-0:1.0: USB hub found
[    1.551510] hub 1-0:1.0: 1 port detected
[    1.552559] dwc_otg: FIQ enabled
[    1.552569] dwc_otg: NAK holdoff enabled
[    1.552574] dwc_otg: FIQ split-transaction FSM enabled
[    1.552596] Module dwc_common_port init
[    1.553101] usbcore: registered new interface driver usb-storage
[    1.553565] mousedev: PS/2 mouse device common for all mice
[    1.555150] bcm2835-wdt 20100000.watchdog: Broadcom BCM2835 watchdog timer
[    1.555670] bcm2835-cpufreq: min=700000 max=1000000
[    1.557052] sdhci: Secure Digital Host Controller Interface driver
[    1.557059] sdhci: Copyright(c) Pierre Ossman
[    1.557397] sdhost-bcm2835 20202000.sdhost: could not get clk, deferring probe
[    1.557618] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.558132] ledtrig-cpu: registered to indicate activity on CPUs
[    1.558281] hidraw: raw HID events driver (C) Jiri Kosina
[    1.558482] usbcore: registered new interface driver usbhid
[    1.558487] usbhid: USB HID core driver
[    1.559405] vchiq: vchiq_init_state: slot_zero = 0xdb180000, is_master = 0
[    1.561503] Initializing XFRM netlink socket
[    1.561545] NET: Registered protocol family 17
[    1.561681] Key type dns_resolver registered
[    1.563549] registered taskstats version 1
[    1.563698] zswap: loaded using pool lzo/zbud
[    1.648506] Key type encrypted registered
[    1.648790] vc-sm: Videocore shared memory driver
[    1.648801] [vc_sm_connected_init]: start
[    1.649712] [vc_sm_connected_init]: end - returning 0
[    1.654797] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2
[    1.654875] console [ttyAMA0] enabled
[    1.656631] sdhost: log_buf @ db113000 (5b113000)
[    1.732384] mmc0: sdhost-bcm2835 loaded - DMA enabled (>1)
[    1.752589] of_cfs_init
[    1.752693] of_cfs_init: OK
[    1.753164] uart-pl011 20201000.serial: no DMA platform data
[    1.754230] Freeing unused kernel memory: 400K (c085c000 - c08c0000)
[    1.754235] This architecture does not have kernel memory protection.
[    1.790208] Indeed it is in host mode hprt0 = 00021501
[    1.853088] random: fast init done
[    1.973978] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.976681] mmc0: new high speed SDHC card at address aaaa
[    1.982748] mmcblk0: mmc0:aaaa SL16G 14.8 GiB
[    1.985746]  mmcblk0: p1 p2
[    2.082460] usb 1-1: new full-speed USB device number 2 using dwc_otg
[    2.082702] Indeed it is in host mode hprt0 = 00021501
[    2.394538] usb 1-1: New USB device found, idVendor=0fe6, idProduct=9700
[    2.394554] usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[    2.394561] usb 1-1: Product: USB 2.0 10/100M Ethernet Adaptor
[    3.559613] gpiomem-bcm2835 20200000.gpiomem: Initialised: Registers at 0x20200000
[    4.098168] zram: Added device: zram0
[    4.145310] zram0: detected capacity change from 0 to 106336256
[    4.167847] Adding 103840k swap on /dev/zram0.  Priority:-1 extents:1 across:103840k SSFS
[    4.472794] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    5.540568] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    5.656487] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[   20.406856] random: crng init done
[   51.337636] i2c /dev entries driver
[   53.442653] sr9700 1-1:1.0 (unnamed net_device) (uninitialized): Error reading MAC address
[   53.442896] usbcore: registered new interface driver sr9700
[   53.463731] dm9601 1-1:1.0 eth0: register 'dm9601' at usb-20980000.usb-1, Davicom DM96xx USB 10/100 Ethernet, 00:e0:4c:53:44:58
[   53.466023] usbcore: registered new interface driver dm9601
[   53.609404] dm9601 1-1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xFFFF
[   53.695936] dm9601 1-1:1.0 eth0: kevent 4 may have been dropped
[   53.725864] dm9601 1-1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xFFFF
[   53.820238] dm9601 1-1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xFFFF
I still have to remove the command waitusb=1 from cmdline.txt. However I can't understand the log very well. Up to 5.656487 seconds everything seems ok, probably I can reduce the boot time furthermore only by compiling the python libraries (right now I am restoring a backup). After that, I don't know what is happening till 20.406856 seconds and afterwards.

Just to note, in the final configuration the Pi0 will not be connected to the ethernet cable. Can I disable somehow the ethernet connection?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: piCore 9.0.3 boot to python script with GUI
« Reply #25 on: May 11, 2020, 09:44:23 AM »
Hi Pacca
... After that, I don't know what is happening till 20.406856 seconds and afterwards. ...
Take a look in  /var/log/messages  (and  /var/log/messages.0  if  /var/log/messages filled up)  for more detailed timing information.
It will include extension loading, execution of  /usr/local/tce.installed/ExtensionName  scripts interleaved with the kernel messages.

You might want to take a look at this to see if it affects piCore too:
http://forum.tinycorelinux.net/index.php/topic,23333.msg146167.html#msg146167

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #26 on: May 12, 2020, 12:57:59 AM »
Hi Rich,

thank you for your help. I'm impressed by how supportive this forum is! This is the /var/log/messages content. https://pastebin.com/wwPtpRy7. Does it mean that it takes from 5.656487 to 51.337636 to load all the extensions and restore the backup? If that's the case, I think there is no way I can short the boot time. Am I right? Regarding your link, I don't see any strange delay between the log entries so probably it does not affects piCore.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: piCore 9.0.3 boot to python script with GUI
« Reply #27 on: May 12, 2020, 07:03:44 AM »
Hi Pacca
I have 3 recommendations to speed things up:
1. Stop loading unneeded extensions. One glaring example I noticed was  -dev.tcz  extensions. Those are only needed for compiling.
2. Check your  /opt/.filetool.lst  for unnecessary entries. If you're not sure, post the contents of  /opt/.filetool.lst  here.
3. Don't use  copy2fs  if you don't need to. Stick to  mount mode.

You can try any of these 3 recommendations individually or together to measure their impact.
« Last Edit: May 12, 2020, 08:09:41 AM by Rich »

Offline Pacca

  • Newbie
  • *
  • Posts: 37
Re: piCore 9.0.3 boot to python script with GUI
« Reply #28 on: May 12, 2020, 08:06:18 AM »
Hi Rich,

1. I needed -dev.tcz during the setup of the system, I didn't know I could remove them now. Great! Now I will try removing Xorg.tcz too and see if the Python GUI keeps working. Because removing this extension reduces the boot time of around 20 seconds.
2. This is my /opt/.filetool.lst:
Code: [Select]
opt
home
etc/passwd
etc/shadow
etc/group
etc/gshadow
usr/local/etc/ssh/ssh_host_dsa_key
usr/local/etc/ssh/ssh_host_dsa_key.pub
usr/local/etc/ssh/ssh_host_ecdsa_key
usr/local/etc/ssh/ssh_host_ecdsa_key.pub
usr/local/etc/ssh/ssh_host_ed25519_key
usr/local/etc/ssh/ssh_host_ed25519_key.pub
usr/local/etc/ssh/ssh_host_rsa_key
usr/local/etc/ssh/ssh_host_rsa_key.pub
usr/local/lib/python3.6/site-packages
usr/local/lib/python3.6/site-packages/pad4pi
usr/local/lib/python3.6/site-packages/pad4pi-1.1.5-py3.6.egg-info
usr/local/lib/python3.6/site-packages/simpleaudio
usr/local/lib/python3.6/site-packages/simpleaudio-1.0.4-py3.6.egg-info
I added only the entries referring to the python libs. Can I remove all the etc/... and usr/local/etc/... entries? Keep in mind that I have to setup the system once and never connect it to a pc again. So I was thinking of removing openssh.tcz from onboot.lst.
3. I use copy2fs and unmount /mnt/mmcblk0p2/ to avoid problems with hard shutdown. Is mount mode enough or do I really need copy mode?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: piCore 9.0.3 boot to python script with GUI
« Reply #29 on: May 12, 2020, 08:15:06 AM »
Hi Pacca
2. Your  /opt/.filetool.lst  looks OK to me. Leave the  etc  and  usr/local  entries in there.
3. I believe Greg Erskine is better versed on that topic, so I'll let him address it.