Hi all, I am new here!
I have built a Gentoo image for Teres 1. It runs the amazing LXDE, has chromium, latex, libreoffice, vlc, etc.
It is fun to build, even though it is a rather long process and there are quite a few complications. I set up a repo with the configs and the local overlay:
https://github.com/khumarahn/teres1-gentoo
(there is a torrent with a pre-built image if you want to try it out)
P.S.: is this the first community image for Teres? :-)
This is great! What was the biggest difficulty?
BTW, the users of Chromium who care about their privacy should try Brave (https://brave.com/).
Nothing was particularly difficult. It's just many smaller things.
Like setting up a cross tool chain, distcc, qemu, figuring out what works and what does not.
Specific things were: battery indication, disabling the keyboard when the lid is closed, setting up vdpau. I still do not know how to set up the audio so that with the headphones plugged in, there is no sound on the speakers.
There is quite a lot information available on the internet, for example for pine64 and cubieboard. It was really helpful.
There is quite a lot of browsers. Why Brave?
Thanks for that image! It's really fast and a lot more suitable for such laptop than ubuntu mate in terms of lightweight OS.
I only have that problem with the touchpad(left click = right click, no right click) but I guess it doesn't depend on the linux distribution so I am waiting for new keyboard firmware.
-L
I found that I forgot to save/restore the sound on suspend. Arghhh. It is not enough to rebuild the image, but if you downloaded it and would like to fix it, then change two files:
/etc/acpi/actions/suspend.sh and /etc/acpi/actions/powerbtn.sh
They should be as here:
https://github.com/khumarahn/teres1-gentoo/blob/master/etc/acpi/actions/
Related commit: https://github.com/khumarahn/teres1-gentoo/commit/89417d6514e38ce4384b6242f0967664c1df6122
P.S.: There is a thread here on the touchpad buttons. I had this problem and, at least in my case, it was hardware. Wasn't difficult to solve, but I used a soldering iron + hot air station, which you may or may not have. Look into the topic, try the diagnosis with a multimeter.
P.P.S.: Can it be that haveged helps wifi? I have strange problems, sometimes cannot connect to eduroam, and later it works perfectly with the same config. The signal is very strong and numerous other devices work well.
So, what do you suggest? Should I burn the image again on the sd card and fix it then or I can only fixed these files directly.
In fact I just now realized that I don't have audio :-) even after shutdown/restart. It was there initially.
-L
uh, no need to burn the image again.
to get the sound back, open the terminal and:
1. become root (root password was "olimex"):
# su -
2. download the sound state:
# wget https://raw.githubusercontent.com/OLIMEX/DIY-LAPTOP/master/SOFTWARE/A64-TERES/blobs/asound.state
3. apply it:
# alsactl -f asound.state restore
To fix this sound loss on suspend, you can run (also as root):
# cd /etc/acpi/actions
# rm powerbtn.sh suspend.sh
# wget https://raw.githubusercontent.com/khumarahn/teres1-gentoo/master/etc/acpi/actions/powerbtn.sh
# wget https://raw.githubusercontent.com/khumarahn/teres1-gentoo/master/etc/acpi/actions/suspend.sh
# chmod 755 powerbtn.sh
# chmod 755 suspend.sh
I will update the image also :-)
Great! Thanks, it works 8)
cool, thanks, fixed. Also, you may want to rebuild the LED control program, it had an annoying bug fixed. Just run as root:
emerge -av teres1-ledctrl
(and later maybe cleanup the disproportionately large download by running rm -r /usr/portage/distfiles/*)
I uploaded a new version where these things are fixed.
did it! thanks!
Something that I tried and you may help here, should be easy cause I did it under ubuntu mate.
I am really interested to install kicad on teres but on Gentoo I am not sure how to fix the dependencies below:
emerge -av kicad
emerge: there are no ebuilds to satisfy ">=dev-libs/boost-1.61[context,nls,threads,python?,python_targets_python2_7(-)?,-python_single_target_jython2_7(-),-python_single_target_pypy(-),-python_single_target_pypy3(-),-python_single_target_python3_4(-),-python_single_target_python3_5(-),-python_single_target_python3_6(-),python_single_target_python2_7(+)]".
(dependency required by "sci-electronics/kicad-4.0.7::gentoo" [ebuild])
(dependency required by "kicad" [argument])
I resolved that under ubuntu by adding temporary the debian repos. Mainly the problem here is how to install the correct python version.
Many thanks!
-L
About what you mentioned earlier for the audio:
QuoteI still do not know how to set up the audio so that with the headphones plugged in, there is no sound on the speakers.
Check what we uploaded here, it was missing previously:
https://github.com/OLIMEX/DIY-LAPTOP/tree/master/SOFTWARE/A64-TERES/teres1-audioselect
Best regards,
Lub/OLIMEX
With kicad on gentoo, it seems to be OK with python, but it required boost built with context support, which is masked by default:
# Sergey Popov <pinkbyte@gentoo.org> (27 Dec 2013)
# Mask because Boost.Context library does not work on most of arches
dev-libs/boost context
(you can see this if you do emerge -pv boost, then the context use flag with be in parenthesis, i.e. most probably masked)
You can install kicad by first unmasking context:
dev-libs/boost -context
Then emerge -av kicad complains about keywords and use flags, so add a few likes to respective files:
# kicad
sci-electronics/electronics-menu amd64 ~amd64
sci-electronics/kicad amd64 ~amd64
(this allows use of the versions which are stable or testing for amd64)
# kicad
sci-electronics/kicad examples github
x11-libs/wxGTK opengl
dev-libs/boost context
dev-python/wxpython opengl
(not sure if you want kicad with examples and github support though)
Then emerge -av kicad works, though it may take quite some time and you need a lot of disk space (roughly 2.5 GB for build, 2.5 GB for the installed files, 500MB for the source files archives. I mounted /usr/portage and /var/tmp/portage out on a large and fast sd card so I can build large packages.
And after all this, kicad may or may not work :-) Let me try to install it, I will write back.
Kicad works, here is the noisy inductor:
(https://raw.githubusercontent.com/khumarahn/teres1-gentoo/master/screen.2.png)
WOW! Magic :D
Can you share step-by-step how to install kicad on Teres? I think it will be very useful and may be we can move this discussion into new topic - Kicad on Gentoo..
-L
You need to make changes to files in /etc/portage/, as in https://www.olimex.com/forum/index.php?topic=5966.msg24472#msg24472
Then run emerge -av kicad, and let it work for a few hours. Set up distcc on a big computer if you want to speed it up.
You may run out of space, so if you are running on an sd card, you should use 16 gb or larger, and resize the system partition (with gparted for example).
Quote from: LubOlimex on November 24, 2017, 09:44:16 AM
https://github.com/OLIMEX/DIY-LAPTOP/tree/master/SOFTWARE/A64-TERES/teres1-audioselect
It seems to work! I made a few cosmetic changes, will create a PR. E.g. there has to be the check for read()>0 again.
Thank you!
Quote from: LubOlimex on November 24, 2017, 09:44:16 AM
https://github.com/OLIMEX/DIY-LAPTOP/tree/master/SOFTWARE/A64-TERES/teres1-audioselect
@LubOlimex,
is there a way to query whether the headphones are plugged in or not? The audioselect program does not receive events if the headphones are removed while the computer is powered off or suspended, and then on poweron or resume, this may results in a no sound situation.
Gcc-7.2.0 is now "testing" in Gentoo. I rebuilt the image using the new compiler, links are updated on Github. It probably does not make any noticeable difference performance-wise, but why not upgrade.
sunxi_check_jack_type (https://github.com/OLIMEX/DIY-LAPTOP/blob/89bee96906f3d334b946d89bdc090217aa26fe7e/SOFTWARE/A64-TERES/linux-a64/sound/soc/sunxi/sunxi_sndcodec.c#L88)
Hope this help you
I have tested that reading memory at address 0x01c22c00,0x319 return 0 when no headset is plugged and 0x0f/0x1f when headphones/headset is plugged. I tryed to add this check to teres1-audioselect service but this was not that easy as look at first sight because this service is started before alsa state restoring, so will search for another way.
Maybe you can use "After=alsa-restore.service" in the systemd service file?
How did you find the address 0x01c22c00,0x319, and is it variable?
I found this address in Allwinner_A64_User_Manual (https://linux-sunxi.org/images/b/b4/Allwinner_A64_User_Manual_V1.1.pdf) page 323 3.20.5.52.
0x318 HMIC Status Register(Default Value: 0x00000000) bit 6:Jack Detect Status
I'ts readable for sure via /dev/mem and this is enough 8)
There is an update available:
https://github.com/khumarahn/teres1-gentoo
Changes are substantial, but probably not easy to notice by a user.
- Updated to profile 17.0 (C++14, PIE)
- Fixed headphones detection issues
- Many programs updated to most recent versions
Some bugs (e.g. with chromium https://bugs.gentoo.org/636758) have been fixed, and the build is now simpler. Most things just work.
I updated the headphones detection as in here: https://github.com/d3v1c3nv11/teres1-audioselect. It seems to work perfectly, if run as a daemon, and not-as-daemon after each resume.
I've downloaded the last version and it seems faster and better.
Nevertheless I find some strange issue with Google Chrome, it doesn't load youtube or google.com - errors out with Ah, snap! ... that was not the case with thr previous image.
I see same error with Google Chrome and Olimex Ubuntu mate image.
yes, there is this strange issue. I could not figure out where it comes from, but when I updated the system again, the issue was gone... I will upload a new image soon.
I learned how to make a binary package repo for gentoo (easy). If anyone is interested, I could open it to the internet, so the packages can be downloaded binary without compilation.
That would be great.
I am really interested for binary repo cause right now any time I am trying to install/compile something I am getting an error that I couldn't resolve... I've just tried to install firefox and I got compile error pointing something MALLOC..
I also cannot compile firefox, probably hitting this bug:
https://bugs.gentoo.org/649540
But chromium I use without any issues. Here is my repo:
teres ~
# cat /etc/portage/repos.conf/gentoo.conf
[DEFAULT]
main-repo = gentoo
[gentoo]
location = /usr/portage
sync-type = rsync
sync-uri = rsync://163.172.132.71/teres-portage
#sync-uri = rsync://rsync.gentoo.org/gentoo-portage
auto-sync = yes
sync-rsync-verify-metamanifest = yes
sync-openpgp-key-path = /var/lib/gentoo/gkeys/keyrings/gentoo/release/pubring.gpg
teres ~
# cat /etc/portage/make.conf
CHOST=aarch64-linux-gnu
CHOST_arm64="${CHOST}"
...
PORTAGE_BINHOST="rsync://163.172.132.71/teres-portage-full/packages"
...
To use the repo:
- make sure that the portage sync points to my server 163.172.132.71 as above
- set PORTAGE_BINHOST is set as above in make.conf
- run emerge --sync
- synchronize the use flags, masks and keywords with my repo, see commit
https://github.com/khumarahn/teres1-gentoo/commit/d5bddb8791a3c6cf3843165f763b274ca50a9de2
for the recent changes
Then you should be able to install chromium-65 as a binary package with
emerge -av --getbinpkg chromium
The main recent changes are CHOST_arm64="${CHOST}" in make.conf (needed for correct clang prefix), and the patch for eselect-mesa (or opengl would silently fail, I spent two days searching the source of the problem).
Finally I updated the image :-)
I gave up on compiling things on Teres. It is too slow, and I want to use it for other things. So I compile in a cross arch chroot, and pull compiled packages from a binary repo. I set up the image to sync and pull binaries from my repo. (Comment out the respective lines in /etc/portage/make.conf and /etc/portage/repos.d/gentoo to disable this.)
Now to install kicad-4.0.7, run
emerge -av --getbinpkg kicad
and there is no compilation involved.
I am looking forward to the mainline kernel! If I have some spare time, I will experiment with what is available.
Great work, works nice and smooth, many thanks!
I experimented a bit with f2fs. On my old class 4 kingston sd card, the image with f2fs boots literally 2-3 times faster than with ext4. It takes 1:25-1:35 to boot and open my favorite web site in the browser, compared to 3-4 minutes with ext4!!
Thus I made a new release, with root on f2fs. Also, I aligned root partition to 4MiB. Not sure if this is necessary, but it may be good. I had to compile f2fs support in the kernel image (not as a loadable module).
f2fs is relatively raw in the old 3.10 kernel, but I did not encounter any real problems yet. I am impatiently waiting on the mainline to catch up with things like sound and suspend. I use my laptop for work when I travel, and these small things feel important.
Quote from: khumarahn on April 26, 2018, 08:12:48 PM
I am impatiently waiting on the mainline to catch up with things like sound and suspend. I use my laptop for work when I travel, and these small things feel important.
I don't think anybody is looking into suspend issues, but since it probably is something fairly trivial, maybe you can try to debug this yourself ...
(I guess experimenting with the PMIC related patches mentioned in the other thread recently might be a good start ...)
HTH,
Harald
Quote from: lambda on April 27, 2018, 10:43:08 PM
experimenting with the PMIC related patches might be a good start
thanks!! I may look at it, though this will hardly happen soon.
I've downloaded the last your gentoo version. It looks nice and faster boot but how do you resize the root partition? Doesn't look so easy as ext3/4.
-L
I did not have time recently to look at how the f2fs partitions are resized. Would gparted do it in gui somehow automatically?
In any case, you can save all the contents with rsync -aAxXhH, recreate the partition and copy the contents back.
Let me know if there are any issues.
I have been procrastinating from doing my most important work by updating Gentoo on Teres. So here is a set of updated configuration files and a new image:
https://github.com/khumarahn/teres1-gentoo
New things:
* I used the `deadline` scheduler for the IO. It prioritizes reads, storing writes for later. On Teres, where IO is a major bottleneck, it seems to improve overall latency. Say, chromium feels much more responsive. Or is it a placebo?
* Home folder is now encrypted with encfs, the password is asked at boot. I use my laptop on travel, and would not want to lose it with all those paypal cookies and passwords saved in my browser. This takes a toll on the IO, but not too much.
* Everything is rebuilt with newer compilers (gcc-8, clang-7). Many programs are updated, e.g. kicad to version 5.0.0.
* Portage is compressed into squashfs with squashmount; this frees up aroung 1GB. (Portage stores loads of small files in the filesystem; this is largely inefficient but not a problem on most modern computers.)
hi, any news since then?
I am going to prepare a 2024 stage4, with a recent kernel
Quote from: DiTBho on February 29, 2024, 08:39:52 PMhi, any news since then?
I am going to prepare a 2024 stage4, with a recent kernel
The current way is to get u-boot (currently the best way seems to be to manually compile it until FWUPD is handled) and then use the graphical UEFI aarch64 installer to get teres to work on all distros as we are trying to do patches upstream to make downstream easier. Khumarahn highlighted few issues that i am tracking on https://git.dotya.ml/KREYLIMEX/TERES/issues
If you find any issues then submit them to https://github.com/khumarahn/teres1-gentoo i will submit patches if needs be
is there any patch-set and .config for recent kernel v6.*?
Quote from: DiTBho on March 11, 2024, 06:50:46 PMis there any patch-set and .config for recent kernel v6.*?
Yes, See https://linux-sunxi.org/Olimex_Teres-A64#Broken_ANX6345_on_Linux_6.5.2B_.28non-LTS_version.29 which is afaik the only patch needed to get teres to work atm beyond https://git.dotya.ml/KREYLIMEX/TERES/milestone/21. Let me know if you need help with the kernel config
Can I use the default arm64 kernel config as reference, or is there a specific config for the Teres1?
I will make my own, at the end, but I need a starting point.
kernel-6.1.72-arm64-teres1-a64 vanilla:
drivers/clk/sunxi-ng/ccu-sun50i-a64.c already ok out of the box
(the patch appears to have been merged upstream)
Quote from: DiTBho on March 12, 2024, 02:26:50 PMCan I use the default arm64 kernel config as reference, or is there a specific config for the Teres1?
There is a specific config, but all mainstream distribution excluding alpine linux/postmarketos (i am still working on that one https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4743) should provide a sufficient configs for the device, beyond that the kernel's defconfig is not sufficient for teres as understood it's due to the sunxi kernel module naming scheme.
The sunxi wiki page for the device provides info on the kernel configuration and the dt_to_config script can be used for reference (dump on https://gitea.itycodes.org/itycodes/olimex-teres/src/branch/master/dt_dump.txt#L242)
This is my kernel config: https://gist.githubusercontent.com/Kreyren/f0952b889d25216ae43cd4a585ca8373/raw/2e1780d63a010b7013dced6259485707ade07de4/gistfile1.txt (should be used only as a reference as i do a lot of development on the device and will use different configs bcs of it)
And for reference this is my nixos configuration for the device that i use as a daily: https://github.com/Kreyren/nixos-config/tree/WORK-IN-PROGRESS/machines/tsvetan
Overall in terms of the kernel defconfig + https://linux-sunxi.org/Olimex_Teres-A64#Unified_Extensible_Firmware_Interface_.28UEFI.29 for UEFI and https://linux-sunxi.org/Olimex_Teres-A64#Display for display should get you a working system
Cedrus (driver that handles hardware video encoding) is currently being investigated how to make it work reliably, but it seems that just enabling it will work
devfreq might need to be enabled (ARM_SUN8I_A33_MBUS_DEVFREQ)
crypto might need to be enabled, see https://itycodes.org/A64.html
Sim Card will probably need to be enabled, but that wasn't investigated yet
PWM, audio, wireless, media, DMA, camera, battery should work without an issue
let me know if you have issues i try to address them, the sunxi kernel modules are sometimes like a little annoying minigame to play nice on the linux kernel
Quote from: DiTBho on March 12, 2024, 02:37:10 PMkernel-6.1.72-arm64-teres1-a64 vanilla:
drivers/clk/sunxi-ng/ccu-sun50i-a64.c already ok out of the box
(the patch appears to have been merged upstream)
6.1-lts is not affected, the change seemed to have happened around 6.3 and projected itself in +6.5-lts