Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: ashfame on July 18, 2020, 03:46:39 AM

Title: Firefox for piCore 11
Post by: ashfame on July 18, 2020, 03:46:39 AM
Hi,

I am attempting to run my application as kiosk mode as demonstrated in TC book. How do I get the firefox.tcz since its not available on the repo? Thanks!

Edit: I saw Juanito's post here http://forum.tinycorelinux.net/index.php/topic,23981.0.html Would it be possible to use either of those to run the application in kiosk mode?

Also, why isn't firefox available? Cuz nobody compiled & packaged it for the target or something else?
Title: Re: Firefox for piCore 11
Post by: Juanito on July 18, 2020, 04:01:55 AM
Firefox is available in the piCore-11.x armv7 repo - I didn’t put it in the armv6 repo as I didn’t have the means to test and I suspect it uses simd/neon instructions.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 18, 2020, 04:11:48 AM
Firefox is available in the piCore-11.x armv7 repo - I didn’t put it in the armv6 repo as I didn’t have the means to test and I suspect it uses simd/neon instructions.

I have no idea about the simd/neon instructions you are mentioning, but is testing specifically just running it to ensure it crashes or something? I can try that.

I found dillo doesn't have JS support, so it won't work for me. Epiphany I couldn't find it in repo either but that seems to be based on webkit so would support everything (not sure of the kiosk mode though).
Title: Re: Firefox for piCore 11
Post by: Rich on July 18, 2020, 04:35:54 AM
Hi ashfame
... I have no idea about the simd/neon instructions you are mentioning, ...
Typically, when the question of whether specific instructions are utilized in a program, they refer to instructions designed/used
for a performance boost. So if you try it out, it shouldn't take long for them to show up if they were used. Start Firefox
from a terminal so you can see any error messages. In x86, that type of error would say  "illegal instruction".  I would
expect ARM to behave in a similar fashion.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 18, 2020, 04:46:34 AM
Hi ashfame
... I have no idea about the simd/neon instructions you are mentioning, ...
Typically, when the question of whether specific instructions are utilized in a program, they refer to instructions designed/used
for a performance boost. So if you try it out, it shouldn't take long for them to show up if they were used. Start Firefox
from a terminal so you can see any error messages. In x86, that type of error would say  "illegal instruction".  I would
expect ARM to behave in a similar fashion.

Hi Rich, oh instruction set, right, that makes sense.

But since my target is Raspberry Pi Zero which is arm6 and 32 bit, what do you suggest would be easier to get up a kiosk running with JS support?

I would try running firefox but I don't know how to obtain its tcz file
Title: Re: Firefox for piCore 11
Post by: Rich on July 18, 2020, 05:00:15 AM
Hi ashfame
According to this:
http://tinycorelinux.net/11.x/armv7/tcz/firefox.tcz.info
it says:
Quote
RPi2, RPi3 and RPi4 only
I'm not familiar with their architecture numbering system, but is a  Pi Zero  at least a  RPI2 ?

Regardless, it doesn't stop you from trying it if you wish. Download these into you  tce  directory:
http://tinycorelinux.net/11.x/armv7/tcz/firefox.tcz
http://tinycorelinux.net/11.x/armv7/tcz/firefox.tcz.dep

Then:
Code: [Select]
tce-load -i firefox
An icon should appear in the wbar. Click it and see if Firefox starts.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 18, 2020, 05:06:31 AM
Hi ashfame
According to this:
http://tinycorelinux.net/11.x/armv7/tcz/firefox.tcz.info
it says:
Quote
RPi2, RPi3 and RPi4 only
I'm not familiar with their architecture numbering system, but is a  Pi Zero  at least a  RPI2 ?

Regardless, it doesn't stop you from trying it if you wish. Download these into you  tce  directory:
http://tinycorelinux.net/11.x/armv7/tcz/firefox.tcz
http://tinycorelinux.net/11.x/armv7/tcz/firefox.tcz.dep

Then:
Code: [Select]
tce-load -i firefox
An icon should appear in the wbar. Click it and see if Firefox starts.

Hi Rich,

Its different from RPI2. RPI2 is ARMv7 and RPI Zero is ARMv6 but I will give this a try and report back
Title: Re: Firefox for piCore 11
Post by: Rich on July 18, 2020, 05:25:43 AM
Hi ashfame
If it doesn't start, look in  ~/.wmx.Applications.  You should see a file called  firefox.  Inside is the command you can use to start it
from the command line to see any error messages. If the command begins with  exec , omit that part.
Title: Re: Firefox for piCore 11
Post by: curaga on July 18, 2020, 09:28:05 AM
Both Firefox and Webkit dropped armv6 support years ago. So you don't have many good options to run a modern browser on that. Old versions of those, or maybe some rpi-specific forks.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 18, 2020, 10:53:18 AM
Hi ashfame
If it doesn't start, look in  ~/.wmx.Applications.  You should see a file called  firefox.  Inside is the command you can use to start it
from the command line to see any error messages. If the command begins with  exec , omit that part.

Hi Rich, It didn't work. Got "Illegal instruction" message.

Both Firefox and Webkit dropped armv6 support years ago. So you don't have many good options to run a modern browser on that. Old versions of those, or maybe some rpi-specific forks.

Hi curaga,

Do you know what was the last version that was supported under armv6? Perhaps I can try that?
Do you know of any such rpi-specific forks? I will try to find something along those lines but if you can share something, that would be great :)
Title: Re: Firefox for piCore 11
Post by: curaga on July 18, 2020, 11:38:52 PM
Sorry, I don't use rpi, I don't have those details.
Title: Re: Firefox for piCore 11
Post by: Juanito on July 19, 2020, 01:27:17 AM
You could try compiling with https://ftp.mozilla.org/pub/firefox/releases/31.3.0esr/source/firefox-31.3.0esr.source.tar.bz2
Title: Re: Firefox for piCore 11
Post by: ashfame on July 19, 2020, 07:59:34 AM
You could try compiling with https://ftp.mozilla.org/pub/firefox/releases/31.3.0esr/source/firefox-31.3.0esr.source.tar.bz2

Hi Juanito,

I am guessing that would require compiling on Raspberry Pi itself to not have to cross compile and attempting to do it on a Raspberry Pi Zero with no networking option isn't an acceptable device to compile it on.

I noticed that epiphany browser is also packaged for armv7 here http://tinycorelinux.net/11.x/armv7/tcz/ but not for armv6, can that be packaged and made available in the armv6 repo? Its my understanding that's still armv6 code as that's the browser which comes in official OS as well.
Title: Re: Firefox for piCore 11
Post by: Rich on July 19, 2020, 08:10:54 AM
Hi ashfame
...  Its my understanding that's still armv6 code as that's the browser which comes in official OS as well.
If that's the case, you should be able to just download it from the ARMv7 repository.
Title: Re: Firefox for piCore 11
Post by: Rich on July 19, 2020, 08:21:20 AM
Hi ashfame
According to:
http://tinycorelinux.net/11.x/armv7/tcz/epiphany.tcz.dep
you will also need to copy over  webkitgtk4.tcz.

That's as far down the dependency tree I checked. Copy those 2 extensions and their  .dep  files to your  tce/optional  directory. Then
Code: [Select]
tce-load -i epiphanyWatch for  not found  messages to see if any other dependencies are missing.
Title: Re: Firefox for piCore 11
Post by: Juanito on July 19, 2020, 09:28:44 AM
I am guessing that would require compiling on Raspberry Pi itself to not have to cross compile and attempting to do it on a Raspberry Pi Zero with no networking option isn't an acceptable device to compile it on.

If you're going to compile something like firefox, it would be better to borrow an RPi3/RPi4 - as I recall, webkit took 187h on an RPi3..
Title: Re: Firefox for piCore 11
Post by: ashfame on July 19, 2020, 09:41:30 AM
Hi ashfame
According to:
http://tinycorelinux.net/11.x/armv7/tcz/epiphany.tcz.dep
you will also need to copy over  webkitgtk4.tcz.

That's as far down the dependency tree I checked. Copy those 2 extensions and their  .dep  files to your  tce/optional  directory. Then
Code: [Select]
tce-load -i epiphanyWatch for  not found  messages to see if any other dependencies are missing.

Hi Rich,

I actually tried that and `alsa-modules-4.9.22-piCore-v7.tcz` is the one that I found missing. Not sure if there are more.
Title: Re: Firefox for piCore 11
Post by: Rich on July 19, 2020, 09:55:23 AM
Hi ashfame
... I actually tried that and `alsa-modules-4.9.22-piCore-v7.tcz` is the one that I found missing. ..
That's because in ARMv6:
http://tinycorelinux.net/11.x/armv6/tcz/
it's called  alsa-modules-4.19.81-piCore.tcz.  Anytime you see numbers like that in an extension name, they are referring to the
kernel version which must match the kernel you are running.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 19, 2020, 10:00:22 AM
I am guessing that would require compiling on Raspberry Pi itself to not have to cross compile and attempting to do it on a Raspberry Pi Zero with no networking option isn't an acceptable device to compile it on.

If you're going to compile something like firefox, it would be better to borrow an RPi3/RPi4 - as I recall, webkit took 187h on an RPi3..

Oh damn, that's not practical at all. Either cross compilation or figure something else out like getting either epiphany or some old build to work. Failing on all that, I would have to give up on Raspberry Pi Zero and move to a newer model where I desolder wifi/bluetooth module (which is what I wanted to avoid as that would act as a barrier for a lot of people attempting to use my open source project to DIY their air-gapped device)
Title: Re: Firefox for piCore 11
Post by: ashfame on July 19, 2020, 10:07:26 AM
Hi ashfame
... I actually tried that and `alsa-modules-4.9.22-piCore-v7.tcz` is the one that I found missing. ..
That's because in ARMv6:
http://tinycorelinux.net/11.x/armv6/tcz/
it's called  alsa-modules-4.19.81-piCore.tcz.  Anytime you see numbers like that in an extension name, they are referring to the
kernel version which must match the kernel you are running.

Hi Rich,

oh, good to know, I will try that. Currently I have Xorg, flwm_topside, wbar & epiphany loading up. But all I see is wallpaper and ability to invoke things from right click context menu. wbar doesn't show up, nor epiphany gets listed in right click menu (probably due to the missing depdency). I remember firefox showed up there on wbar and in right click context menu without me having to do anything. Do you know what I might be doing wrong in invoking them?
Title: Re: Firefox for piCore 11
Post by: ashfame on July 19, 2020, 10:12:35 AM
Do you know what I might be doing wrong in invoking them?

Nevermind, I figured out my silly mistake. I was able to get the wbar loaded and launch the browser too. Going to put that missing dependency in & figure out launching it in kiosk mode etc.
Title: Re: Firefox for piCore 11
Post by: Rich on July 19, 2020, 10:13:56 AM
Hi ashfame
You won't see epiphany load until all of its dependencies have loaded.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 19, 2020, 10:22:22 AM
Hi ashfame
You won't see epiphany load until all of its dependencies have loaded.

Hi Rich, It actually did load. Everything is pretty sluggish but atleast it loaded. I am guessing it will probably crash when that missing dependency is invoked at some point.
Title: Re: Firefox for piCore 11
Post by: Rich on July 19, 2020, 04:38:10 PM
Hi ashfame
... Either cross compilation or ...
On the topic of cross compilation, I found this pre built toolchain that supports Pi Zero:
https://github.com/Pro/raspi-toolchain

It's a 460 Mbyte tarball that gets installed under /opt.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 19, 2020, 09:46:24 PM
Hi ashfame
... Either cross compilation or ...
On the topic of cross compilation, I found this pre built toolchain that supports Pi Zero:
https://github.com/Pro/raspi-toolchain

It's a 460 Mbyte tarball that gets installed under /opt.

That's a great find Rich! I will use that if this epiphany browser doesn't work out.
Title: Re: Firefox for piCore 11
Post by: ashfame on July 20, 2020, 03:01:50 AM
Hi ashfame
You won't see epiphany load until all of its dependencies have loaded.

Hi Rich,

I am not sure if the epiphany browser is not functional or I am running out of memory. Sometimes it will load a simple js file just fine, sometimes it will crash. Sometimes it gets stuck trying to load the html file, possibly due to parsing of JS files.

I tried launching it via terminal and saw messages regarding "memory pressure", but when I check free memory by running `free -m`, it tells me ~12M is free but over 300M is cached, which as per my understanding can be released by kernel when required, unless in TinyCore RAM based file system is shown under cached and that's actually not freeable memory?
Title: Re: Firefox for piCore 11
Post by: Juanito on July 20, 2020, 03:30:37 AM
epiphany works on a 1gb RPi3 and 4gb RPi4 without problems - how much ram do you have?
Title: Re: Firefox for piCore 11
Post by: ashfame on July 20, 2020, 04:30:41 AM
epiphany works on a 1gb RPi3 and 4gb RPi4 without problems - how much ram do you have?

Hi Juanito,

I have 512MB RAM (Raspberry Pi Zero), and additional need to use copy2fs.flg which takes up even more space in memory as I require to run an air-gapped device which runs an immutable OS state with the ability of ejecting the bootable media.

Additionally, I just tried removing the copy2fs.flg to free some space in the memory and browser was able to function. So browser isn't the culprit here, I am just running out of memory here. I am going to order a newer RPi model which has 1-2GB of RAM to use, but I would like to explore other options as well - full-fledged browsers which may not be this heavy in terms of disk space or running cost on memory. Any ideas about midori / Vivaldi?
Title: Re: Firefox for piCore 11
Post by: Juanito on July 20, 2020, 04:46:57 AM
Like epiphany, midori uses webkitgtk, so I'm not sure how much better it will be - I haven't tried vivaldi.
Title: Re: Firefox for piCore 11
Post by: Rich on July 20, 2020, 07:02:33 AM
Hi ashfame
I am not sure if the epiphany browser is not functional or I am running out of memory ...
Spoiler alert. Web browsers are selfish and inconsiderate programs. In their attempt to cache every last byte of data they sucked
in, they will consume most/all of your RAM. Epiphany may also be caching stuff to disk (/home/tc/) which in your case also resides
in RAM.

Quote
... I tried launching it via terminal and saw messages regarding "memory pressure", but when I check free memory by running `free -m`, it tells me ~12M is free ...
I would call that  "out of memory territory".

Quote
... but over 300M is cached, which as per my understanding can be released by kernel when required, unless in TinyCore RAM based file system is shown under cached and that's actually not freeable memory?
I've noticed that even if you tell the system to clear the cache, it never goes to zero. That suggests that not everything that is currently
cached can be released.

I believe you disabled the  zswap  to free up RAM.  You could try adding a little back to see if it relieves the pressure any. Maybe try
adding about 50 Mbytes:

... By default, Tinycore uses 25% of your RAM for  zswap (swap space in RAM). If you want to change the amount used, try this:

First, boot using the  nozswap  boot code.
Then
Code: [Select]
sudo su
# remove all existing swap
swapoff -a

# Set the size to 50000 K bytes
echo "50000K" > /sys/block/zram0/disksize

# Create the swap file
mkswap /dev/zram0 >/dev/null 2>&1

# Update fstab.
echo "/dev/zram0  swap         swap    defaults,noauto   0       0" >> /etc/fstab # Lets swapoff -a work

# Enable this swap device first so it has priority.
swapon /dev/zram0

# Enable any remaining swap devices.
swapon -a
exit

To see the status of your swap devices:
Code: [Select]
cat /proc/swaps
If this does what you want, then add it to your  /opt/bootsync.sh  file before the line that calls  /opt/bootlocal.sh.  Do not include
the lines that say  sudo su  or  exit.
Title: Re: Firefox for piCore 11
Post by: curaga on July 20, 2020, 09:30:39 AM
Yes, the RAM filesystem is included under "cached".
Title: Re: Firefox for piCore 11
Post by: ashfame on July 21, 2020, 05:43:16 AM
Yes, the RAM filesystem is included under "cached".

Thanks for confirming!
Title: Re: Firefox for piCore 11
Post by: ashfame on July 21, 2020, 08:08:12 AM
Like epiphany, midori uses webkitgtk, so I'm not sure how much better it will be - I haven't tried vivaldi.

Thanks for the heads up!
Title: Re: Firefox for piCore 11
Post by: ashfame on July 21, 2020, 08:16:44 AM
Hi ashfame
I am not sure if the epiphany browser is not functional or I am running out of memory ...
Spoiler alert. Web browsers are selfish and inconsiderate programs. In their attempt to cache every last byte of data they sucked
in, they will consume most/all of your RAM. Epiphany may also be caching stuff to disk (/home/tc/) which in your case also resides
in RAM.

Quote
... I tried launching it via terminal and saw messages regarding "memory pressure", but when I check free memory by running `free -m`, it tells me ~12M is free ...
I would call that  "out of memory territory".

Quote
... but over 300M is cached, which as per my understanding can be released by kernel when required, unless in TinyCore RAM based file system is shown under cached and that's actually not freeable memory?
I've noticed that even if you tell the system to clear the cache, it never goes to zero. That suggests that not everything that is currently
cached can be released.

I believe you disabled the  zswap  to free up RAM.  You could try adding a little back to see if it relieves the pressure any. Maybe try
adding about 50 Mbytes:

... By default, Tinycore uses 25% of your RAM for  zswap (swap space in RAM). If you want to change the amount used, try this:

First, boot using the  nozswap  boot code.
Then
Code: [Select]
sudo su
# remove all existing swap
swapoff -a

# Set the size to 50000 K bytes
echo "50000K" > /sys/block/zram0/disksize

# Create the swap file
mkswap /dev/zram0 >/dev/null 2>&1

# Update fstab.
echo "/dev/zram0  swap         swap    defaults,noauto   0       0" >> /etc/fstab # Lets swapoff -a work

# Enable this swap device first so it has priority.
swapon /dev/zram0

# Enable any remaining swap devices.
swapon -a
exit

To see the status of your swap devices:
Code: [Select]
cat /proc/swaps
If this does what you want, then add it to your  /opt/bootsync.sh  file before the line that calls  /opt/bootlocal.sh.  Do not include
the lines that say  sudo su  or  exit.

Hi Rich, thanks for the instructions. I wasn't convinced if use of swap could help at all, since it would barely have unused code that it can push to swap. But perhaps a compressed swap would result in some sort of optimization, so I simply tried removing the "nozswap" bootcode and it didn't result in much of a difference. The web process inside of the browser crashed at the same point where it was crashing without swap and at that point, zswap was full 100M too. It just got sluggish that browser was struggling to show anything inside it. I am guessing because of constant swap in/out movement.

I tried your instruction to use a little swap to see if that makes any difference but it didn't let me update the disksize for swap stating it was busy. I did use `swapoff -a` before but I think your instructions required not to have swap enabled? Anyway, I don't think that will make a difference unless I reduce the size of this browser itself. I got my hands on palemoon and vivaldi binary that I am gonna try using and see if they occupy less disk space.

Great point about browser trying to cache stuff as well. I will explore if I can disable that using a flag or something.

Title: Re: Firefox for piCore 11
Post by: ashfame on July 21, 2020, 02:59:50 PM
Hey folks,

It just occurred to me I am essentially trying to bundle a browser in my remaster because my application UI is web based. So instead of running a full fledged browser will something like webkit-gtk wrapper of some sort would do the job just fine?

Essentially I am loading localhost:3002 in the browser. So perhaps there is an easy way to package my UI for ARM6 than just trying to include a common browser that has a lot more stuff than simple rendering of webpage. I do need WebRTC support, not sure if that kinda forces me to run a full fledged browser though. Thoughts?
Title: Re: Firefox for piCore 11
Post by: Juanito on July 21, 2020, 10:32:14 PM
You could try /usr/local/lib/webkit2gtk-4.0/MiniBrowser from webkitgtk4?
Title: Re: Firefox for piCore 11
Post by: curaga on July 22, 2020, 12:08:56 AM
WebRTC is such a new feature you may be out of options.
Title: Re: Firefox for piCore 11
Post by: Rich on July 22, 2020, 06:05:49 AM
Hi ashfame
I just glanced through them, but maybe some of these will be of interest:
https://github.com/EricssonResearch/openwebrtc/issues/403
http://www.linux-projects.org/    This one mentions using Pi Zero near the bottom of the page.
https://www.raspberrypi.org/forums/viewtopic.php?t=211124

If you plug this into Google:
Code: [Select]
linux webrtc without browseryou will find it is not an uncommon question.