Lazarus

Programming => General => Topic started by: Seenkao on September 01, 2021, 07:59:00 pm

Title: Qemu - Arm.
Post by: Seenkao on September 01, 2021, 07:59:00 pm
Я собираюсь эмулировать какую-нибудь из ARM систем. Linux, Android, возможно и ту и другую. Так как занимаюсь в основном на паскале, то и мне надо будет отлаживать конечный код, но я не имею ни какой машины ARM. Понятно что на Android не очень удобно отлаживать код, потому что зачастую его не увидишь в действии, в данный момент времени.
Потому хотел узнать, какую машину настраивать для Linux-ARM/Linux-ARM64.

Подскажите пожалуйста! Не очень охота тратить ещё лишний день-два на поиски нужного, а потом ещё дополнительное время на установку.

Или есть ещё варианты, о которых я не знаю?

Google translate:
I'm going to emulate one of the ARM systems. Linux, Android, possibly both. Since I work mainly in Pascal, I will also need to debug the final code, but I do not have any ARM machine. It is clear that on Android it is not very convenient to debug the code, because often you will not see it in action at a given time.
So I wanted to know which machine to configure for Linux-ARM / Linux-ARM64.

Tell me please! Not really willing to spend an extra day or two looking for the right one, and then another extra time for installation.

Or are there other options that I don't know about?
Title: Re: Qemu - Arm.
Post by: AlexTP on September 01, 2021, 10:36:15 pm
Можно купить Raspberry Pi 3 - она ARM64, но ОС 32 битная. Но можно наверно и не официальную ОС поставить - Manjaro for ARM64. Просто записываешь ОС на карту памяти, карту вставляешь в плату.

===
EN:
You can get the Raspberry Pi 3 (ARM64 with 32-bit OS). you can install 64-bit ARM OS on it. Manjaro ARM64.
Title: Re: Qemu - Arm.
Post by: ttomas on September 02, 2021, 01:32:06 am
You can try Oracle cloude VM, more details
https://synopse.info/forum/viewtopic.php?id=5945 (https://synopse.info/forum/viewtopic.php?id=5945)
Title: Re: Qemu - Arm.
Post by: avra on September 02, 2021, 08:45:09 am
You can try Oracle cloude VM, more details
https://synopse.info/forum/viewtopic.php?id=5945 (https://synopse.info/forum/viewtopic.php?id=5945)

Thank you for this tip!
Title: Re: Qemu - Arm.
Post by: PascalDragon on September 02, 2021, 09:17:28 am
Можно купить Raspberry Pi 3 - она ARM64, но ОС 32 битная. Но можно наверно и не официальную ОС поставить - Manjaro for ARM64. Просто записываешь ОС на карту памяти, карту вставляешь в плату.

In the international part of the forum, please don't reply solely in a non-English language. Thank you.
Title: Re: Qemu - Arm.
Post by: Seenkao on September 27, 2021, 05:28:42 pm
Благодарю всех за информацию! Это достаточно полезная информация!
Но я решил остановиться, как и хотел, на Qemu. В интернете достаточно немало информации по созданию полноценной ARM машины, за малым исключением, достаточно сложно эмулировать графическое окружение машины.
Я создал и 32-х и 64-х битные машины Debian для тестов, но без графики. Если будет полезно, то выкладываю сайт, где человек сделал эти машины. И две ссылки на видео (Rus) которые я сделал больше для себя, и изменял настройки эмулируемой машины, а так же показал как можно было вытащить ядро из созданной машины другим способом.

yandex translate:
Thank you all for the information! This is quite useful information!
But I decided to stop, as I wanted, on Qemu. There is quite a lot of information on the Internet on creating a full-fledged ARM machine, with a few exceptions, it is quite difficult to emulate the graphical environment of the machine.
I created both 32-bit and 64-bit Debian machines for tests, but without graphics. If it will be useful, then I post a site where a person made these machines. And two links to the video (Rus) that I made more for myself, and changed the settings of the emulated machine, and also showed how it was possible to pull the kernel from the created machine in another way.

Installing Debian on QEMU’s 32-bit ARM “virt” board (https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/)
video_1_rus (https://www.youtube.com/watch?v=I5CqbvJt8x4) - installing Debian 32 ARM
video_2_rus (https://www.youtube.com/watch?v=rAlbBv062i4) - extract the kernel.

they are quite well suited for testing programs. :-[
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 27, 2021, 08:26:51 pm
This isn't right place to ask such questions. Read QEMU docs first. https://wiki.qemu.org/Documentation/Platforms/ARM (https://wiki.qemu.org/Documentation/Platforms/ARM) Have you tried "-device virtio-gpu-pci"?
Title: Re: Qemu - Arm.
Post by: Seenkao on September 27, 2021, 09:22:47 pm
This isn't right place to ask such questions. Read QEMU docs first. https://wiki.qemu.org/Documentation/Platforms/ARM (https://wiki.qemu.org/Documentation/Platforms/ARM)
FPC позволяет разрабатывать под разные платформы, в том числе и под платформы ARM. Я не вижу ни чего плохого в том, что человек сможет использовать стороннюю платформу, не имея при этом машину на данной платформе. Если человек сможет протестировать свой код на платформе отличной, от той, которая у него есть, то зачастую отпадают лишние потребности в тестировании кода на оборудовании, которое не предназначено для тестирования. Или человек просто боится за это оборудование. Я говорю про телефоны и планшеты.
Потому, я думаю, я правильно сделал, что задал именно здесь свой вопрос!

Да, мы должны знать, что конечный код должен быть проверен на конечном оборудовании, на котором он будет работать. От этого ни куда не уйти.

Yandex translate:
FPC allows you to develop for different platforms, including ARM platforms. I don't see anything wrong with a person being able to use a third-party platform without having a machine on this platform. If a person can test his code on a platform different from the one he has, then often there are no unnecessary needs for testing code on equipment that is not intended for testing. Or a person is simply afraid for this equipment. I'm talking about phones and tablets.
Therefore, I think I did the right thing by asking my question here! :)

Yes, we should know that the final code must be tested on the final hardware on which it will run. There is no getting away from this.

Quote from: Mr.Madguy
Have you tried "-device virtio-gpu-pci"?
Благодарю, я проверял. Но как описано в документации, мы должны прописать в ядре Linux (гостевой машины):
CONFIG_DRM=y
CONFIG_DRM_VIRTIO_GPU=y
но у меня и опыта мало и я не достаточно хорошо разбираюсь в Linux, потому на данный момент, я не знаю, как поменять ядро уже созданной машины на ядро скомпилированное снаружи. Либо как создать машину с заданными параметрами ядра (как я понял, ядро идёт по умолчанию). И потому я отказался от дальнейших "боданий" с эмулятором (хотя, я наверняка знаю, что это можно сделать). Я потратил на это достаточно немало времени.
Единственное что я не проверил, это Debian 11. Возможно там это уже прописано в ядре.

Yandex translate:
Thank you, I checked. But as described in the documentation, we must register in the Linux kernel (guest machine):
CONFIG_DRM=y
CONFIG_DRM_VIRTIO_GPU=y
but I have little experience and I don't understand Linux well enough, because at the moment, I don't know how to change the kernel of an already created machine to a kernel compiled from the outside. Or how to create a machine with the specified kernel parameters (as I understood, the kernel goes by default). And so I refused to continue "butting" with the emulator (although I certainly know that this can be done). I spent quite a lot of time on this.
The only thing I haven't checked is Debian 11. Perhaps it is already written in the kernel there.
Title: Re: Qemu - Arm.
Post by: engkin on September 28, 2021, 03:31:53 am
It is clear that on Android it is not very convenient to debug the code, because often you will not see it in action at a given time.

What about Android and gdbserver?

If I were you I would give gdbserver a chance If you have an Android phone with an ARM CPU. You should be able to tell if it works for you or not in a short time.

Usually, gdbserver comes with Android NDK:
$NDK/prebuilt/android-*/gdbserver/gdbserver

Assuming you know enough Linux, you should have the power to run teminal apps on your phone in the temp folder:
/data/local/tmp/

LAMW can produce Android terminal apps for you.

Lazarus *might* work with gdbserver in this configuration.
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 28, 2021, 06:03:11 am
I just don't think, that things are so hard with ARM. Have you looked into list of predefined hardware? There should be video-capable hardware there and there should be pre-built versions of Linux distributives for it. Even if it doesn't have video, it should have some way to get to remote desktop, such as VNC or SSH. For example it looks like Pi 2 (https://www.raspberrypi.org/products/raspberry-pi-2-model-b/) has video. At least it has HDMI and therefore should have video. And then you just need to search for Linux distributives for it. For example Debian (https://raspi.debian.net/). So, this problem boils down to search skill.

I also think, that almost all distributives should support virtio by default. At least I've never met distributive, that would refuse to work with "-vga virtio".

And it's better to ask such questions on QEMU/Linux forums, because there is better chance to get answers there. I know, that sometimes one may know only one forum and doesn't want to register on some other. Sometimes it's also easier for me to ask my question on "wrong" forum. But at the end it's not good practice to do it.

P.S. I have to agree, that things are little bit overcomplicated there. Lack of standard video support, like VGA, causes too many problems and solutions are too complicated.
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 28, 2021, 08:50:19 am
I'm going to emulate one of the ARM systems. Linux, Android, possibly both. Since I work mainly in Pascal, I will also need to debug the final code, but I do not have any ARM machine. It is clear that on Android it is not very convenient to debug the code, because often you will not see it in action at a given time.
So I wanted to know which machine to configure for Linux-ARM / Linux-ARM64.

Well buy one for $deity's sake! Raspberry Pis and their equivalent aren't expensive, and it's been possible to run FPC/Lazarus on them and do your debugging natively for the last ten years or so.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 28, 2021, 12:04:50 pm
Unfortunately currently it's the best result, I've achieved. No picture then. Manuals say, that I should connect via VNC. I try to do it, but nothing happens. I.e. QEMU runs, port is open, if I don't specify password - it asks to enter password. But once I enter password - nothing happens.
Title: Re: Qemu - Arm.
Post by: Seenkao on September 28, 2021, 12:22:44 pm
Повторюсь.  :)
Я не говорил, что эти способы плохи! Но на данный момент, у меня дома лежит тонна телефонов, планшетов и прочей "ереси". Я бы с удовольствием просто поставил на какой-нибудь планшет FPC/Lazarus. Но я не видел способа установки FPC/Lazarus на планшет.
Покупать ещё одну "игрушку" в виде Raspberry Pi это означает, что у меня дома прибавится хлама (хотя компьютер/ноутбук на основе ARM было бы интересно взять, там намного больше возможностей).
Установив виртуальную машину, я могу как писать код на этой машине, так и запускать его. Проводить мелкие тесты, хоть десятки тысяч раз, выверяя работу кода и просматривать ассемблерный код (да, я тот ещё задрот). Потому, виртуальная машина, является достаточно неплохим решением проблемы и не захламляет пространство дома.
Я думаю вы понимаете, что в жизни, в данное время, мне не пригодится Raspberri. А купив его я так же закину его к туче телефонов и он будет большую часть времени просто пылится. :) В течении длительного времени я не покупал себе смартфон,  купив его, побаловался и "забросил в угол", поняв, что не так уж и сильно он мне нужен.
engkin, я попробую ваше предложение, но я не уверен в том, что я буду часто его использовать. Зачастую проще быстро перекомпилировать код и тут же его проверить. Понятно дело, если я буду работать с графикой, то в этом случае, ваше предложение будет очень полезным! :)

yandex translate:
I will repeat myself.  :)
I didn't say that these methods are bad! But at the moment, I have a ton of phones, tablets and other "heresy"at home. I would love to just put an FPC/Lazarus on some tablet. But I haven't seen a way to install FPC/Lazarus on a tablet.
Buying another "toy" in the form of a Raspberry Pi means that I will have more junk at home (although it would be interesting to take an ARM-based computer/laptop, there are much more possibilities there).
By installing a virtual machine, I can both write code on this machine and run it. Conduct small tests, at least tens of thousands of times, verifying the work of the code and viewing the assembly code (я ещё тот "zadrot"). Therefore, a virtual machine is a fairly good solution to the problem and does not clutter up the space of the house.
I think you understand that in life, at this time, Raspberri will not be useful to me. And after buying it, I will also throw it to the phones and it will just gather dust most of the time. :) For a long time, I did not buy a smartphone for myself, after buying it, I pampered myself and "threw it into a corner", realizing that I did not need it so much.
engkin, I will try your suggestion, but I am not sure that I will use it often. It is often easier to quickly recompile the code and immediately check it. It is clear that if I work with graphics, then in this case, your suggestion will be very useful!:)

Задрот - a person who has been looking for a better way/result for a long time and persistently.
Title: Re: Qemu - Arm.
Post by: Seenkao on September 28, 2021, 12:27:40 pm
Unfortunately currently it's the best result, I've achieved. No picture then. Manuals say, that I should connect via VNC. I try to do it, but nothing happens. I.e. QEMU runs, port is open, if I don't specify password - it asks to enter password. But once I enter password - nothing happens.
Network installation?

Как вам удалось запустить графический интерфейс? Если не секрет.

yandex translation:
How did you manage to launch the GUI? If it's not a secret.
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 28, 2021, 12:54:49 pm
But I haven't seen a way to install FPC/Lazarus on a tablet.

Have you asked?

About four years ago I installed FPC onto an Android-based x86_64 tablet... although admittedly I had to jump through a few hoops to do so. I'd be very surprised indeed if there isn't a "right way" to do this by now.

A tablet is just a computer: you can attach an HDMI monitor to it and a keyboard and it runs very much like any other system. Or- if I recall correctly- you can VNC into it or tunnel X11 over SSH just like you can with any other Linux system. Or you can, in many cases, go the whole hog and reflash it with Debian.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 28, 2021, 12:57:20 pm
Oh, man. I was stupid. I just needed to wait longer!
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 28, 2021, 01:10:20 pm
Oh, man. I was stupid. I just needed to wait longer!

(GUFFAW) Don't worry, we've all been caught by that sort of thing. Qemu's VNC is fairly foolproof since it's implemented as part of the host video card emulation, so everybody- irrespective of target being emulated- is using the same code and bugs will be spotted and (occasionally) fixed.

One thing I've found extremely useful is to always start the Qemu program from a command line (i.e. shell session), since if something isn't working properly there will be error messages that you definitely need to see. If you want to hide the session you can use the (Gnu) screen command, but you definitely don't want to run it from a desktop environment menu item- at least when you're getting it working- since all your startup messages will be lost.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 28, 2021, 01:18:51 pm
(GUFFAW) Don't worry, we've all been caught by that sort of thing. Qemu's VNC is fairly foolproof since it's implemented as part of the host video card emulation, so everybody- irrespective of target being emulated- is using the same code and bugs will be spotted and (occasionally) fixed.

One thing I've found extremely useful is to always start the Qemu program from a command line (i.e. shell session), since if something isn't working properly there will be error messages that you definitely need to see. If you want to hide the session you can use the (Gnu) screen command, but you definitely don't want to run it from a desktop environment menu item- at least when you're getting it working- since all your startup messages will be lost.

MarkMLl
I guess, VNC wasn't working due to long period of "Guest disabled display". But at the end I don't need VNC - everything work directly.

It was long way to this solution. Here it is:
Code: [Select]
qemu-system-aarch64.exe -display sdl -M virt -m 8G -cpu cortex-a57 -smp 4 -device virtio-keyboard -device virtio-tablet <or virtio-mouse - it works too> -device virtio-gpu,xres=1920,yres=1080 <TAP network here - won't work without OpenVPN> -bios "edk2-aarch64-code.fd" -boot c -hda "path_to_linux.iso"

Things to note:
1) CPU is important - without it system would be 32bit
2) BIOS is important - u-boot should be used for rootfs images, BIOS is different for 32bit and 64bit
3) Keyboard doesn't work during boot screen - you need to wait till timeout
4) Loading is looooooooooooooooong - you need to be patient, long "Guest disabled display" doesn't mean that nothing works
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 28, 2021, 01:55:13 pm
But at the end I don't need VNC - everything work directly.

If you don't have VNC then as soon as you close the window displaying your emulated system it will terminate abruptly: no SSH etc.

Be warned that Qemu and Docker don't always play nicely together. Apart from that I think most of https://wiki.freepascal.org/Qemu_and_other_emulators is still applicable.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 28, 2021, 02:21:33 pm
In order to make keyboard work during EFI shell - add following options:
Code: [Select]
-device xhci,id=xhci -device usb-kbd,bus=xhci.0You won't be able to install Debian without it.
Title: Re: Qemu - Arm.
Post by: engkin on September 28, 2021, 03:54:05 pm
I would love to just put an FPC/Lazarus on some tablet. But I haven't seen a way to install FPC/Lazarus on a tablet..

Try Termux (https://termux.com). I managed to use FPC on a phone with it.

Quote
By installing a virtual machine, I can both write code on this machine and run it. Conduct small tests, at least tens of thousands of times, verifying the work of the code and viewing the assembly code (я ещё тот "zadrot"). Therefore, a virtual machine is a fairly good solution to the problem and does not clutter up the space of the house.

SPEED

This is exactly what my previous post is about.. You compile on your computer and generated assembly files are on your computer, as usual. The application is a console type, does *not* need installation, just copying to the device and giving it executable permissions over ADB. All your work is on your computer.

Installation is needed for apk files, and it does take a few seconds. Copying is fast, less than a second, usually.

This was my biased opinion.
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 28, 2021, 04:02:03 pm
Try Termux (https://termux.com). I managed to use FPC on a phone with it.

That's what I used to get FPC to work on an x86_64 tablet. I remember there was something slightly odd about the internal paths that I had to fudge... if anybody goes this way I might have notes somewhere.

FDroid might have entered into the equation somewhere as well.

MarkMLl
Title: Re: Qemu - Arm.
Post by: engkin on September 28, 2021, 04:13:59 pm
For x86, I used android-x86 (https://www.android-x86.org) was fast enough on my older computer. Couldn't get all its versions to work, but the ones that did were good enough.
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 28, 2021, 05:02:26 pm
Tried to do the same with Debian today. It was a little bit harder, because Debian doesn't have live Arm64 images, i.e. it needs installation. Then I had some problems with install media. And when I solved them, I realized, that my work day ended. So, I'll continue this experiment tomorrow. While I've got used to x86, Arm is also very interesting for me.
Title: Re: Qemu - Arm.
Post by: Seenkao on September 28, 2021, 06:04:30 pm
Have you asked?
Тут вы правы, я не спрашивал, но так же и не видел. На Raspberry видел.
Eng:
You're right there, I didn't ask, but I also didn't see it. I saw it on Raspberry.
Quote from: MarkMLl
About four years ago I installed FPC onto an Android-based x86_64 tablet... although admittedly I had to jump through a few hoops to do so. I'd be very surprised indeed if there isn't a "right way" to do this by now.
Давайте всё же будем объективны. Меня интересует возможность проверки/отладки работы на ARM машинах, а не на машинах x86.  :)
Eng:
Let's still be objective. I am interested in the possibility of checking/debugging work on ARM machines, and not on x86 machines. :)

Try Termux (https://termux.com). I managed to use FPC on a phone with it.
Qemu предоставляет полную возможность работы с ARM машиной. При этом не отвлекаясь на телефон или подключенное устройство.
Eng:
Qemu provides a full opportunity to work with an ARM machine. At the same time, without being distracted by the phone or the connected device. :)

Quote from: engkin
SPEED

This is exactly what my previous post is about.. You compile on your computer and generated assembly files are on your computer, as usual. The application is a console type, does *not* need installation, just copying to the device and giving it executable permissions over ADB. All your work is on your computer.

Installation is needed for apk files, and it does take a few seconds. Copying is fast, less than a second, usually.

This was my biased opinion.
Всё то же самое и с Qemu. Только в данном случае мы просто компилируем код и запускаем его на ARM-VM (уроков как это использовать достаточно много в интернете).
А так же VM основанная на Qemu позволила мне установить полноценный FPC и использовать его на виртуальной машине (вероятнее всего, постаравшись, FPC можно и на Android).
Eng:
Everything is the same with Qemu. Only in this case, we simply compile the code and run it on an ARM-VM (there are quite a lot of lessons on how to use it on the Internet). :)
And also VM based on Qemu allowed me to install a full-fledged gas station and use it on a virtual machine (most likely, after trying, the gas station can also be on Android).

Mr.Madguy,
я и стараюсь как раз установить изначально виртуальную машину, а не скачать готовый рабочий диск. Хотя наверно и надо было просто взять готовую рабочую машину... что было бы проще.
Eng:
I'm trying to install a virtual machine initially, and not download a ready-made working disk. Although I probably should have just taken a ready-made working machine... which would be easier.
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 28, 2021, 06:47:04 pm
Let's still be objective. I am interested in the possibility of checking/debugging work on ARM machines, and not on x86 machines. :)

I suspect that the best translation would be "let's stay on topic" :-)

You are of course right, but the point I'm trying to make is that if I was able to get FPC onto a tablet four years ago- and not even a tablet running the dominant variant of Android- then I'd expect that there would be a "right and proper way" by now... which doesn't rely on fossicking around using an emulator.

Later: this is directly relevant

https://hackaday.com/2020/10/07/linux-fu-the-linux-android-convergence/#more-429444

MarkMLl
Title: Re: Qemu - Arm.
Post by: Seenkao on September 29, 2021, 08:01:21 am
MarkMLl :)

------------------------------------------------------------
Если использовать Debian 11, то все проблемы эмуляции автоматически решаются. Debian 11 использует обновлённое ядро, которое поддерживает виртуальную составляющую Qemu и они взаимонастраиваемы. Потому с помощью данной ссылки вы можете установить ARM-машину с графической оболочкой. Позже выложу весь процесс создания рабочей VM.
yandex translate:
If you use Debian 11, then all emulation problems are automatically solved. Debian 11 uses an updated kernel that supports the virtual component of Qemu and they are mutually configurable. Therefore, using this link, you can install an ARM machine with a graphical shell. Later I will lay out the whole process of creating a working VM.

Download the kernel for Debian 11 (on the original Debian 9 website):
Quote
wget -O installer-linux http://http.us.debian.org/debian/dists/bullseye/main/installer-arm64/current/images/netboot/debian-installer/arm64/linux
wget -O installer-initrd.gz http://http.us.debian.org/debian/dists/bullseye/main/installer-arm64/current/images/netboot/debian-installer/arm64/initrd.gz
changed "stretch" to "bullseye" from:
Installing Debian on QEMU’s 32-bit ARM “virt” board (https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/)
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 29, 2021, 09:16:16 am
MarkMLl :)

------------------------------------------------------------
Если использовать Debian 11, то все проблемы эмуляции автоматически решаются. Debian 11 использует обновлённое ядро, которое поддерживает виртуальную составляющую Qemu и они взаимонастраиваемы. Потому с помощью данной ссылки вы можете установить ARM-машину с графической оболочкой. Позже выложу весь процесс создания рабочей VM.
yandex translate:
If you use Debian 11, then all emulation problems are automatically solved. Debian 11 uses an updated kernel that supports the virtual component of Qemu and they are mutually configurable. Therefore, using this link, you can install an ARM machine with a graphical shell. Later I will lay out the whole process of creating a working VM.

Download the kernel for Debian 11 (on the original Debian 9 website):
Quote
wget -O installer-linux http://http.us.debian.org/debian/dists/bullseye/main/installer-arm64/current/images/netboot/debian-installer/arm64/linux
wget -O installer-initrd.gz http://http.us.debian.org/debian/dists/bullseye/main/installer-arm64/current/images/netboot/debian-installer/arm64/initrd.gz
changed "stretch" to "bullseye" from:
Installing Debian on QEMU’s 32-bit ARM “virt” board (https://translatedcode.wordpress.com/2016/11/03/installing-debian-on-qemus-32-bit-arm-virt-board/)
Too hard. I'm currently installing Debian 11 from official DVD (https://cdimage.debian.org/debian-cd/current/arm64/iso-dvd/), as if I would install it on x86 machine. There was only one problem. I found solution here (https://wiki.debian.org/DebianInstaller/Qemu).

P.S. Debian has terrible site. It's common practice to have "download" link somewhere on main page and avoid maze of pages, referencing to each other.
Title: Re: Qemu - Arm.
Post by: Seenkao on September 29, 2021, 11:05:27 am
Mr.Madguy,
на самом деле это выглядит довольно сложно, позже распишу и покажу все действия, думаю даже обычному пользователю будет не сложно.
Гораздо сложнее было изначально разобраться как это работает.
Eng:
in fact, it looks quite complicated, later I will write down and show all the actions, I think even an ordinary user will not be difficult.
It was much more difficult initially to figure out how it works. :)
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 29, 2021, 12:25:09 pm
Ok. I've finally installed Debian. Had another problem - EFI doesn't auto-detect installed Debian, so I have to select it manually. But the biggest question is - how to install FPC/Lazarus, if Synaptic doesn't show their packages?

P.S. Installed FPC from archive, but I can't install Lazarus from sources, because I can't even install make.

P.P.S There were problems with repositories - Debian guys have done everything in order to prevent me from updating from their Internet repositories
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 29, 2021, 01:32:05 pm
P.S. Installed FPC from archive, but I can't install Lazarus from sources, because I can't even install make.

make is in the build-essential package. The effective prerequisites are build-essential, gdb, libgpm-dev (formerly libgpmg1-dev), libncurses5-dev and libncursesw5-dev... they're the ones that have been good for me for about 15 years.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 29, 2021, 03:43:58 pm
No, problem was with repositories.

Here it is. But I have problem. IDE start dialog says two things:
1) Lazarus version doesn't match source version
2) It can't find system.ppc
I'm not sure, if this problems are caused by previous install from archive or not.
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 29, 2021, 03:54:42 pm
No, problem was with repositories.

Here it is. But I have problem. IDE start dialog says two things:
1) Lazarus version doesn't match source version
2) It can't find system.ppc
I'm not sure, if this problems are caused by previous install from archive or not.

You've said you've installed FPC from an archive: /what/ archive?

You've said you can't build Lazarus... but it's patently obvious you've got a running copy so what /exactly/ have you done and what's gone wrong?

I always install FPC from a freepascal.org tarball, then rebuild from source, then build Lazarus from source. So there's limited direct help I can provide, but I think you need to go into more details so that somebody more familiar with Debian packaging etc. can pick it up.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 29, 2021, 04:00:49 pm
You've said you've installed FPC from an archive: /what/ archive?

You've said you can't build Lazarus... but it's patently obvious you've got a running copy so what /exactly/ have you done and what's gone wrong?

I always install FPC from a freepascal.org tarball, then rebuild from source, then build Lazarus from source. So there's limited direct help I can provide, but I think you need to go into more details so that somebody more familiar with Debian packaging etc. can pick it up.

MarkMLl
I tell you it for 3rd time in a row. There was problem with repositories - I couldn't install anything. So I tried to install from here (https://sourceforge.net/projects/freepascal/files/Linux/3.2.2/). But I couldn't install Lazarus from sources, cuz I couldn't install make. And then I fixed problem with repositories and installed everything from there. FPC.CFG files are in right places and it looks like they point to right directories. But still this errors.
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 29, 2021, 04:28:15 pm
I tell you it for 3rd time in a row. There was problem with repositories

Yes, and three times you haven't told us /what/ repositories or what you did to fix it.

Are you talking about Debian's own repositories- and if so where does Synaptic come into it since Debian doesn't install it by default?

MarkMLl
Title: Re: Qemu - Arm.
Post by: AlexTP on September 29, 2021, 04:48:49 pm
Offtopic a little.
I wrote the list of req packaged to the wiki:
https://wiki.freepascal.org/Installing_Lazarus_on_Linux#Required_Linux_packages

You may correct this list.
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 29, 2021, 05:14:06 pm
Yes, and three times you haven't told us /what/ repositories or what you did to fix it.

Are you talking about Debian's own repositories- and if so where does Synaptic come into it since Debian doesn't install it by default?

MarkMLl
Sorry. I've got tired of Debian a little bit. It's second day of fighting against it. It has taken whole day to just install it. Not sure, if Arm64 version is so bad or whole Debian. Nothing works out of the box. Problems started, when Debian refused to find DVD, it was actually booted from. And then I encountered many problems with configuring it. Like laking some Mate options and not having /sbin on PATH and therefore failing to start some programs. Even if I started some program from /sbin, it failed anyway, when it tried to start some other program, that was in /sbin too. Or sudo not working properly by default. Problem with repositories was with fact, that Debian configured it's DVD as main source of repositories. And this DVD wasn't accessible. As result I couldn't install anything. It wasn't showing some error. No. Just no programs in repository. First I though, that Arm64 repositories didn't have all packages. And decided to try to install FPC and Lazarus directly. FPC installed properly, but I couldn't install Lazarus from sources due to lack of make. This is when I realized, that there was some problem with repositories. Because they can lack Lazarus, but definitely not make. I fixed this problem and installed default FPC and Lazarus from there. I thought, that new installation would configure itself properly, even if there was some previous faulty ones. But it didn't. Problem with Lazarus sources isn't big deal. Looks like it simply misses "bsomething" at the end. But no FPC units - is worse problem. Nothing would compile without them. I checked files and everything looked fine. As I understand, "/x/bin/fpc" searches for configuration in "/x/etc/fpc.cfg", sources are in "/usr/lib/fpc" and arch name is "aarch64-linux".
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 29, 2021, 10:34:04 pm
Sorry. I've got tired of Debian a little bit. It's second day of fighting against it. It has taken whole day to just install it. Not sure, if Arm64 version is so bad or whole Debian. Nothing works out of the box.

I haven't a clue what you're trying to say with this "/x/" business, you're just not giving us enough information to make sense.

If you're still talking about Qemu, I suspect that the DVD problem is because you've not adjusted your command line to make it accessible... there's probably documentation somewhere that tells you all about that but in my case case it's 15 years relevant experience (of Qemu, and before that UML etc.). In any event that one's hardly an FPC/Lazarus problem.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 30, 2021, 08:41:27 am
I'm mostly Windows user. I'm not familiar with all that Linux file system mounting stuff. So, despite of DOS experience, user-unfriendly Linux distributives are hard for me. Unfortunately I've found out, that in many Linux distributives FPC/Lazarus packages are maintained badly, that causes them not to work out of the box. And Debian seems to have weird problems with paths. I don't know, what is wrong with it. Lazarus says that compiler is in "/usr/bin/fpc" (it's the same, as "/bin/fpc" or just "fpc"). Docs say, that in this case fpc.cfg should be "/etc/fpc.cfg". It's there. Ok. Unit paths are "-Fu/lib/fpc/$fpcversion/units/$fpctarget/<something>". And I have following directory - "/lib/fpc/3.2.2/units/aarch64-linux/". "rtl" is there and it has "system.ppu". I just don't understand, why Lazarus can't find it.

I just don't want to waste another day to try to reinstall everything from scratch. I'm reinstalling. This process just goes by itself anyway, while I can do my job. It just makes me a little bit tired.
Title: Re: Qemu - Arm.
Post by: MarkMLl on September 30, 2021, 03:02:00 pm
I don't want to prolong this thread since I suspect that OP's wandered off. However

Try Termux (https://termux.com). I managed to use FPC on a phone with it.

That's what I used to get FPC to work on an x86_64 tablet. I remember there was something slightly odd about the internal paths that I had to fudge... if anybody goes this way I might have notes somewhere.

FDroid might have entered into the equation somewhere as well.

I've got a development "phablet" with Cyanogenmod based on Android 6 here, onto which it appears that I've already installed Termux.

Running passwd and then starting sshd, I'm able to login as root via port 8022. At that point I see:

Code: [Select]
~$ ssh -p 8022 root@172.27.16.176
root@172.27.16.176's password:
X11 forwarding request failed on channel 0

Welcome to Termux!

Wiki:            https://wiki.termux.com
Community forum: https://termux.com/community
Gitter chat:     https://gitter.im/termux/termux
IRC channel:     #termux on freenode

Working with packages:

 * Search packages:   pkg search <query>
 * Install a package: pkg install <package>
 * Upgrade packages:  pkg upgrade

Subscribing to additional repositories:

 * Root: pkg install root-repo

You are using legacy Termux environment.
Packages are unmaintained and will not
receive any updates.

$ uname -a
Linux localhost 3.10.72+ #1 SMP PREEMPT Thu Oct 13 18:38:52 CST 2016 aarch64 Android
$

I'm not putting any more time into this, and if anybody wants to discuss it I suggest a new thread. But note that that's aarch64... subject to the availability of standard utilities that should be enough to get FPC running natively and possibly Lazarus.

MarkMLl
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 30, 2021, 03:27:31 pm
Finally!
Title: Re: Qemu - Arm.
Post by: Seenkao on September 30, 2021, 04:53:50 pm
Mr.Madguy, Congratulations! :)

-------------------------------------------------
Я сделал подробное описание установки Debian 11 используя Qemu (это было не просто...). Графическое окружение включено. Извиняюсь, пока только на русском. Если это нужно, то я сделаю перевод и выложу на вики (или вы можете перевести и выложить :)).
yandex translate:
I made a detailed description of installing Debian 11 using Qemu (it wasn't easy...). The graphical environment is enabled. I'm sorry, so far only in Russian. If it is necessary, then I will make a translation and post it on the wiki(or you can translate and post :)).
Debian 11 using Qemu (https://gamedev.ru/flame/forum/?id=263879&m=5456066#m3)

Rus: Только делал я на Linux, потому возможно будет сложно извлечь ядро, если человек будет эмулировать Debian на Windows.
FPC3.2.0/Lazarus в данной системе есть по умолчанию, но может не работать. Я устанавливал FPC/Lazarus используя FPCUPDELUXE. На работоспособность проверил.
End:I only did it on Linux, because it might be difficult to extract the kernel if a person emulates Debian on Windows.
FPC3.2.0/Lazarus is in this system by default, but it may not work. I installed FPC/Lazarus using FPCUPDELUXE. I checked for operability.

Rus: Отдельная благодарность Mr.Madguy! Если б он не поддержал, то я остановился бы на начатом.
Eng: Special thanks to Mr.Madguy! If he hadn't supported me, then I would have stopped what I started. ;)
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on September 30, 2021, 05:23:47 pm
My instruction would be a little bit shorter:
1) Download Debian installation DVD
2) To make things easier, do everything in QEMU folder. Admin rights are needed to do it. I use FAR manager for this purpose. It can remember your previous command lines, that is very useful feature for us.
3) Create disk via "qemu-img create -f qcow2 debian.qcow2 <size>G". qcow2 is used because it's size = size of data on it, not size of disk. Disk economy, you know. So, size of disk doesn't actually matter - you can even use 200G.
4) Use command line, I provided earlier. Specify debian.qcow2 as hda and installation DVD as hdb. Use -boot d to boot from DVD. Don't forget about USB keyboard support!
5) Install the same way, you would install x86 distributive. I used graphic installer. Have you ever installed any OS? I don't think, you'd have some problems.
6) When installer complains, that it can't find installation media - use "specify it manually" option and use /dev/vdb (if DVD is hdb)
7) When installer asks you to use network repository - agree to do it. This way you will avoid future problems with repositories and won't need to add them manually.
8) Complete installation
9) After reboot you'll notice, that EFI shell refuses to find installation automatically. May be it can be solved some way, but I don't know how. I guess, EFI storage just isn't emulated properly. I don't remember exact names of menu items. Pick 3rd one. Something like "Boot Maintenance Manager" and specify path of one of efi files manually. "/EFI/debian/grubsomething.efi" for example.
10) Boot to Debian. Start Synaptic and go to repositories config. Disable Debian DVD to avoid errors.
11) Just install Lazarus.
12) Lazarus will complain about source version mismatch. Not sure, if it's good way to solve this problem or it can cause some future problems, but I simply changed Lazarus version in file "version.ini" - added "+b2" at it's end.

P.S. I think I know how to solve #9 problem. Will test it tomorrow. First of all -pflash should be used instead of -bios. This will make UEFI area writable. But second pflash image is needed for EFI variables.
Title: Re: Qemu - Arm.
Post by: Mr.Madguy on October 01, 2021, 10:00:58 am
Everything works now. Instruction to enable EFI vars:
1) Run qemu-img.exe dd if=edk2-aarch64-code.fd of=debian0.img bs=1M count=64
2) Run qemu-img.exe create -f raw debian1.img 64M
3) Change -bios "edk2-aarch64-code.fd" to -pflash "debian0.img" -pflash "debian1.img"
4) Add "<your disk>/EFI/debian/shima64.efi" boot option and set it's as first one

Debian will do #4 automatically, if you'll add EFI vars support prior to installing it
Title: Re: Qemu - Arm.
Post by: MarkMLl on October 05, 2021, 10:13:38 am
That's what I used to get FPC to work on an x86_64 tablet. I remember there was something slightly odd about the internal paths that I had to fudge... if anybody goes this way I might have notes somewhere.

I took a look for my notes over the weekend, and it appears that the sticking point with Termux+FPC was that Android bundles libpthread somewhere unexpected and that caused problems for various things including fpcmkcfg. I can't remember whether I found an easy workaround or simply accepted that multithreaded programs might be a problem, a bit of Googling indicates that it's been discussed regularly since then so Termux itself might have got a fix.

MarkMLl
TinyPortal © 2005-2018