hexdump0815 / linux-mainline-on-arm-chromebooks

running linux mainline on arm chromebooks - for example: samsung xe303c12 and xe503c12 (snow and peach), acer c100, c101 and c201 (veyron speedy, minnie etc. and gru bob and kevin), medion s2013 and s2015 (veyron jaq, mighty etc.), acer cb5 311 (nyan big), lenovo n23, acer r13 (oak elm and hana), lenovo duet (kukui krane) and most probably many many more over time ...
144 stars 10 forks source link

The chromebook boots properly but mouse,keyboard and wi-fi don't work anymore after having recompiled kernel 5.4.244 with KVM enabled... #11

Open Marietto2008 opened 11 months ago

Marietto2008 commented 11 months ago

Hello.

I'm still trying to enable KVM on a more recent kernel version,to be precise on the 5.4.244. First of all I have formatted my sd card following the procedure explained by the v.o.s website. I mean this is what I did :

In the uboot source directory:

$ sudo ./scripts/sdcard.sh /dev/sdX

This will erase all data and create 4 partitions in the medium, along with copying the u-boot binary to the first partition:

a) ChromeOS signed binary (vos chained u-boot)

b) Partition 2 not used

c) EXT2 partition for u-boot files (here I have copied the zImage (converted in uImage and the exynos5250-snow.dtb files) that I've got on the link below :

https://github.com/quarkscript/linux-armv7-xe303c12-only/files/11615040/5.4.244-kvm.zip

I have decompressed it and I've got the zImage file that was stored inside the deb file. Since I want to use u-boot,I have converted zImage into uImage using the following command :

# mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n "Linux kernel" -d zImage uImage

d) EXT4 partition for userspace files. Here I have copied the devuan 4 userland files that I've got here :

https://drive.google.com/u/0/uc?id=1KSgE-3G2GEBzcYhk_JleVYWl6m061GdI&export=download

but I haven't used a btrfs fs,but ext4. And I have extended the space on the partition from 1882M to 200 GB.

sudo dd if=nv_uboot-snow.kpart of=/dev/sdX1 (nv_uboot-snow.kpart taken from the vos website)

what happened ? that the chromebook booted and the desktop enviroment also started. Unfortunately mouse and keyboard and trackpad don't work,so I can't check if kvm exists. But I think that there is an high chance that it works. Why keyboard,mouse and trackpad don't work ? maybe that when has been re-compiled the 5.4.244 kernel,the author hasn't enabled the drivers ? Previously I had configured the SSH server on the Chromebook,but I can't connect to it because it is enabled only when I will able to overcome the login screen. Can you suggest something to try ?

Update : I have enabled the automatic login and I saw :

1) mouse,wi-fi and keypad don't work : I have no connection 2) the screensaver starts after some time,so the OS is not freezed.

so,the os works,but there is a problem only with the kernel modules used for the mouse,wi-fi and trackpad. Maybe it happens because the kernel modules are for the kernel 5.15.79 but I chosen to boot the chromebook with the kernel 5.4.244 ? what should I do ?

hexdump0815 commented 11 months ago

an option to get info without kbd/mouse is to write dmesg or other interesting info into files in /etc/rc.local and afterwards sync and wait a while - then you can read those files on the sd card later

Marietto2008 commented 11 months ago

you mean to write a bash script that executes itself as soon as the desktop environment starts and then shut it down the chromebook and go to read inside the log ? yeah,that's the only method to know what's the problem. I wil let you know.

Marietto2008 commented 11 months ago

I wrote a little bash script that executes the commmand line :

dmesg > /root/Desktop/log

as soon as the desktop environment started (kde 5). This is the content of the log file :

https://pastebin.ubuntu.com/p/GQ59sqt72v/

I would like to understand what's wrong. I don't understand it. But I understand this "kvm: Hyp mode initialized successfully". So kvm is working on the kernel version that I've used (5.4.244).

Marietto2008 commented 11 months ago

Mission accompished. After a full year of work,I've been able to enable kvm on the arm chromebook running on a relatively recent version of the kernel. Give a look here :

Screenshot_2023-08-04_14-50-02-1

very thanks,man,for all the support that you gave to me. Wthout it,I wouldn't have been able. An important question is still open : to make it work I used a distribution that uses the zImage file as kernel file. And I just had to convert it to uImage. But the distributions that you create don't use such kind of file. That's why I got stuck at one point. So,I would like to know how to produce at least the zImage file from the kernel files that you use,because u-boot needs it. Some kind of conversion is needed. That's because I'm forced to use the already patched u-boot created by the v.o.s if I want to enable kvm.

hexdump0815 commented 11 months ago

congratulations! it would be nice if you could write down all the steps you did to some single document, so that others who might be interested to do the same could follow your steps.

the zImage is a result of the normal kernel build: https://github.com/hexdump0815/linux-mainline-and-mali-generic-stable-kernel/blob/master/readme.cbe#L37

Marietto2008 commented 11 months ago

Probably I haven't been able to explain my doubt. I saw that the ubuntu distros that you create on the boot folder have the following files : initrd.img ; vmlinuz and some others file not so relevant. Why you use these files and you don't use any zImage or uImage ? The userland that I've used (of Devuan 4) uses zImage instead of vmlinuz. That's what I was looking for. I think that if I want to use your userlands I should convert something. Maybe vmlinuz to zImage and zImage to uImage ? u-boot does not call vmlinuz,it calls uImage.

hexdump0815 commented 11 months ago

i think vmlinuz is the same as zImage, its just another filename for the same file

going from zImage/vmlinuz to uImage can be done similar to this: https://github.com/hexdump0815/linux-mainline-and-mali-generic-stable-kernel/blob/master/readme.av7#L60 - i have no idea, which address would be the proper one for the exynos soc in snow

Marietto2008 commented 11 months ago

-----> congratulations! it would be nice if you could write down all the steps you did to some single document, so that others who might be interested to do the same could follow your steps.

I don't think that a lot of users will be interested. The arm chromebook is very old and not even powerful. It has been only a challenge between me and the thing that nobody cares about.

hexdump0815 commented 11 months ago

you never know - for the same reason i could have said "why to build images for those old devices, nobody will be interested in it anyway" - i did anyway and looks like they are useful for some people ...

Marietto2008 commented 11 months ago

This project is not ended,yet. I've installed virt-manager and I tried to create a new virtual machine. With my big surprise,I saw the warning :

KVM is not available. This may mean the KVM package is not installed or the KVM kernel modules are not loaded.

What could the cause ? KVM seems to running great. It is detected by kvm-ok and even virt-manager can establish a connection QEMU / KVM.

The qemu version installed is the 5.2.0.

Marietto2008 commented 11 months ago

in this example I've used qemu 5.2.0 installed by default by the devuan 4 :

qemu-system-arm \
    -enable-kvm -serial stdio -kernel zImage \
    -m 512 -M vexpress-a15 -cpu cortex-a15 \
    -drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
    -device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
    -device virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
    -netdev type=user,id=net0 \
    -append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
             virtio_mmio.device=1M@0x4e000000:74:0 \
             virtio_mmio.device=1M@0x4e100000:75:1 \
             root=/dev/vda rw ip=dhcp --no-log"

qemu-system-arm: invalid accelerator kvm.
Marietto2008 commented 11 months ago

in this example I've compiled qemu-system-arm on ubuntu 12.04 as described by the vos tutorial and then I've copied the libraries produced on the devuan 4 + 5.4 kernel installation :

/12.04/usr/local/bin/./qemu-system-arm \
    -enable-kvm -serial stdio -kernel zImage \
    -m 512 -M vexpress-a15 -cpu cortex-a15 \
    -drive file=/mnt/fisso/bhyve/img/Linux/ubuntu2210.img,id=virtio-blk,if=none \
    -device virtio-blk,drive=virtio-blk,transport=virtio-mmio.0 \
    -device virtio-net,transport=virtio-mmio.1,netdev=net0,mac="52:54:00:12:34:55" \
    -netdev type=user,id=net0 \
    -append "earlyprintk=ttyAMA0 console=ttyAMA0 mem=512M \
             virtio_mmio.device=1M@0x4e000000:74:0 \
             virtio_mmio.device=1M@0x4e100000:75:1 \
             root=/dev/vda rw ip=dhcp --no-log"

(process:2843): GLib-WARNING **: 14:17:40.742: ../../../glib/gmem.c:497: custom memory allocation vtable not supported
error: kvm run failed Function not implemented