Kategoriarkiv: Khadas VIM

How to Install Lazarus on Manjaro 22.06 with your VIM3


This is a pretty easy install, some bug fixes have to be done and you have to change some files – then you are up and running with the beautiful Lazarus – a programming language that never dies.

Written by Morten Steenberg. 2022 AUG

We assume you have installed Manjaro 22.06 distro on your Khadas VIM3 (I have my own help for this for you) and updated the system, so this is up to date!

1. Install Fpc, Fpc-src, and Lazarus via the regular Software manager built in Manjaro. For the moment this is version 3.2.2 for Fpc and 2.2.0 for the Lazarus (Lazarus-qt5 version). I mean, there is no point in struggling to get the latest version, very small changes, so you should accept these versions – work and compile fine!

2. The compiler is broken, so you have to fix up something. You have to locate the file cprt0.as on your computer. Be aware, that you have 10’s of these files in your system – so NOT search for this file, go to the right folder, explained under here!

3. Travel/goto to this folder on your Manjaro with console, first:

cd /usr/lib/fpc/src/rtl/linux/aarch64

4. Enter this in your console:

sudo nano ./cprt0.as

Or if you prefer Kate instead: kate ./cprt0.as…

5. Then goto about line 40 from the top in the file, you will find this section :

/* __libc_start_main(main, argc, argv,
init, fini, rtld_fini, stack_end) */
adrp x0,:got:PASCALMAIN
ldr x0,[x0,#:got_lo12:PASCALMAIN]
adrp x3,:got:__libc_csu_init
ldr x3,[x3,#:got_lo12:__libc_csu_init]
adrp x4,:got:__libc_csu_fini
ldr x4,[x4,#:got_lo12:__libc_csu_fini]
bl __libc_start_main

Mark this section over in the file, and replace it with this :

/* __libc_start_main(main, argc, argv,
init, fini, rtld_fini, stack_end) */
adrp x0,:got:PASCALMAIN
ldr x0,[x0,#:got_lo12:PASCALMAIN]
mov x3,xzr
mov x4,xzr
bl __libc_start_main

Then save the file and leave the nano or kate editor and return to the console!

6. Then travel one folder back/up

cd ..

7. And enter this (this will compile this C/ASM code in the file cprt0.as):

sudo make CPU_TARGET=aarch64 OS_TARGET=linux cprt0.o

8. Then copy the file to this location, like this:

sudo cp /usr/lib/fpc/src/rtl/units/aarch64-linux/cprt0.o /usr/lib/fpc/3.2.2/units/aarch64-linux/rtl/

You should now have the ability to Compile in Lazarus!

9. Fix the crtbegin/crtend warning when you compile. Be sure you have installed the GCC compiler before you proceed here (Install gcc – The GNU Compiler Collection -C and C++ frontend in Manjaro Software Manager, if you have not):

Then, check what version of gcc that’s installed in your system:

cd /usr/lib/gcc/aarch64-unknown-linux-gnu/

Then type

ls

Probably you see a folder with the name 12.1.0. This is the folder you should get fpc to look after. This will get rid of the crtbegin/crtend warning! To fix this you have to update the fpc.cfg file. You should find the file in /etc. Goto this folder:

cd /etc

Then edit the file:

kate ./fpc.cfg

Travel/goto about line 178 in the fpc.cfg file, you will find a header with the name # path to the gcclib – here is the error/problem! Add a new line after the last -Fl line and before #endif, with (about line 182 in the fpc.cfg file…) this line of text:

-Fl/usr/lib/gcc/aarch64-unknown-linux-gnu/12.1.0

Save the file. Important if your system has another version of gcc, you have to alter/change the -Fl line to the right version/number!

Now you can compile without any strange warnings!

10. A better dook container for Lazarus. At last, I prefer a docking system in the Lazarus Ide, activate the already light preinstalled packages with (Lazarus Ide→Package→Install/uninstall packages) :
AnchorDocking 1.0
AnchorDockingDsgn 1.0
Then “Save and rebuild IDE”

Happy programming with Fpc/Lazarus.

How to install a new fresh Manjaro KDE Plasma 22.06 on your VIM3

Download the file here: https://minibase.no/khadasfiles/Manjaro-ARM-kde-plasma-vim3-22.06.img.xz -Or if you prefer to do it the hard way by yourself, download the image from  www.manjaro.org – Select Download, KDE Plasma version and select Khadas VIM3 computer then read the guidelines here to create the file:
https://github.com/khadas/krescue/blob/master/docs/README_how_to_make_simple_krescue_image_xz.md

OR

We do the hard work for you, and you install only – it is easy!

There are many ways to install OS images on your Vim. But there is a lack of what is important and what is a bad way to install. We think Khadas gives us many ways to install OS on your lovely VIM3.

We have downloaded, compressed, and tagged the latest image of Manjaro KDE Plasma 22.06 for (late summer 2022) for your VIM3 all ready for you – and it’s ready for installation direct via oowow. We strongly recommend the newest release of oowow and not the old Krescue system. Be aware if you use the old Krescue program, it has a strange behavior to empty the xz-file and the Krescue’s says the file is “broken”, we don’t know why – but with oowow we have no problems at all. You will find the newest version here for oowow:
https://dl.khadas.com/firmware/oowow/system/vim3-oowow-latest-sd.img.gz
This works fine with Khadas VIM3 and the image we have created for you. For the moment there is only a very old 22.01 image of Manjaro, sadly on Khadas’s dl.khadas.com site. This is wrong, Manjaro images for Khadas VIM 3 are updated! On this link, you will find all versions of Manjaro the last 2 years direct for Khadas VIM3 – Great!

Here is the way

Download the image from our server. Then:

  1. Before you begin. Use a USB Stick (>16Gb) NOT MS-DOS formatted (only 4Gb files max on MS-DOS, the Manjaro OS decompressed is about 5Gb) but a Linux ext4, or similar formatted!
  2. Put the image we have prepared for you, on this USB stick. Remember you must only copy the file, not create an image on the USB Stick.
  3. Before proceeding have oowow ready on an SD Card (here you have to create an image with Gnome Disk or similar) also since the VIM3 has a non-internal SPI memory to store oowow internal.
  4. Turn off power on your VIM3 – be sure to take a backup before you proceed here – all old data from EMMC will be lost – important!!!
  5. Put SD Card in back and plug in the USB Stick, power on. Oowow should start.
  6. Select Write image to EMMC.
  7. Travel thru folders to find the USB Stick – and be sure to click on <<VIM3 only>> so ALL files in the USB Stick will be shown, otherwise only files that begin with VIM3. will be shown!
  8. Select the file Manajro-ARM-kde-plasma-vim3-22.06.img.xz you have put on the USB Stick.
  9. Click Install.
  10. After finishing, remove the booth SD Card and USB Stick and turn off the power then turn the power on again. The new system will begin to boot. This OS takes a few minutes the first time, we don’t know why, but after 2-3 boots, this is speeding up.
  11. Problem with sound/video on Manjaro 22.06. This is an easy fix: Start software manager and remove/install this:
    Remove plasma-pa
    Remove pipewire-pulse
    Install pulseaudio
    Perhaps a reboot here before proceeding?
    re-install plasma-pa
    reboot again.
  12. Problem with video playback in Chromium on the new Manjaro install? This is also an easy fix: Open Chromium and go to chrome://flags In the browser, then set this:
    Set WebRTC PipeWire support to Enabled.
    Set Preferred Ozone platform til Wayland.
    Relaunch your browser, Youtube video will now play smoothly.

You should now get a video playback in HD quality, preferably with a connected Bluetooth speaker with a CPU load of approximately 25 percent. NICE!

You have now an updated Manjaro 22.06 on your Khadas VIM3. Happy Computing!

 

Khadas VIM 3 

Written by Morten Steenberg
Aug 2022

Permalink to this article: https://minibase.no/?p=1602