quarkscript / linux-armv7-xe303c12-only

Linux kernel for old google-snow chromebook
GNU General Public License v2.0
18 stars 2 forks source link

Mouse and keyboard don't work anymore after having recompiled your kernel 5.4.244 #21

Open Marietto2008 opened 1 year ago

Marietto2008 commented 1 year ago

Hello.

I'm still trying to enable KVM on a more recent kernel version,to be precise on the 5.4.244. Quickly this is what I did :

1) 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 your zImage (converted in uImage and your exynos5250-snow.dtb files). I've got the zip file that you created for me one month ago,here :

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

I have decompress 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.

2) 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 you have re-compiled your 5.4.244 kernel,you haven'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 ?

NB : 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.

Marietto2008 commented 1 year 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).

quarkscript2 commented 1 year ago

This may happens in case kernel do not load required modules.

I do not see in dmesg:

...
[    3.331356] cros-ec-dev cros-ec-dev.3.auto: cannot get EC features: -95/1
[    3.342261] input: cros_ec as /devices/platform/soc/12ca0000.i2c/i2c-4/i2c-104/104-001e/i2c-arbitrator:i2c@0:embedded-controller@1e:keyboard-controller/input/input1
[    3.350596] cros-ec-i2c 104-001e: Chrome EC device registered
...
[    6.669725] mwifiex_sdio mmc2:0001:1: info: FW download over, size 462708 bytes
[    7.026854] mwifiex_sdio mmc2:0001:1: WLAN FW is active
[    7.386859] btmrvl_sdio mmc2:0001:2: sdio device tree data not available
[    7.435431] mwifiex_sdio mmc2:0001:1: CMD_RESP: cmd 0x242 error, result=0x2
[    7.435451] mwifiex_sdio mmc2:0001:1: mwifiex_process_cmdresp: cmd 0x242 failed during  initialization
[    7.500886] mwifiex_sdio mmc2:0001:1: info: MWIFIEX VERSION: mwifiex 1.0 (14.66.27.p18)
[    7.500899] mwifiex_sdio mmc2:0001:1: driver_version = mwifiex 1.0 (14.66.27.p18) 
...

it is from kernel 5.15.120

but you got

[    3.446961] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[    3.447787] usbcore: registered new interface driver usblp
[    3.448583] usbcore: registered new interface driver cdc_wdm
[    3.449470] usbcore: registered new interface driver uas
[    3.450253] usbcore: registered new interface driver usb-storage
[    3.451005] usbcore: registered new interface driver ums-cypress
[    3.451740] usbcore: registered new interface driver ums_eneub6250
[    3.452470] usbcore: registered new interface driver ums-freecom
[    3.453191] usbcore: registered new interface driver ums-isd200
[    3.453906] usbcore: registered new interface driver ums-usbat
[    3.455850] udc-core: couldn't find an available UDC - added [g_acm_ms] to list of pending drivers
[    3.457257] cyapa 1-0067: 1-0067 supply vcc not found, using dummy regulator
[    3.537427] input: Cypress APA Trackpad (cyapa) as /devices/platform/soc/12c70000.i2c/i2c-1/1-0067/input/input0

that should be modules

try to add lsmod to script to see if any loaded

and

[    4.248248] usb 2-1: Product:  USB OPTICAL MOUSE
[    4.255843] input:  USB OPTICAL MOUSE as /devices/platform/soc/12120000.usb/usb2/2-1/2-1:1.0/0003:0000:0538.0001/input/input2
[    4.257017] hid-generic 0003:0000:0538.0001: input,hidraw0: USB HID v1.11 Mouse [ USB OPTICAL MOUSE] on usb-12120000.usb-1/input0

at least mouse should work

I have decompress it and I've got the zImage file that was stored inside the deb file.

So i guess you did not copy lib to / ?

quarkscript2 commented 1 year ago

brtfs with compression run faster than ext4 and saves some space, that is it

I can't check if kvm exists.

you can, actually. according to your dmesg:

[    3.191378] kvm [1]: vgic interrupt IRQ16
[    3.192222] kvm [1]: Hyp mode initialized successfully

and according to

[    0.000000] OF: fdt: Machine model: Google Snow Rev 5+

exynos5250-snow-rev5.dtb probably should fit better

Marietto2008 commented 1 year 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. Now what I should do is to install qemu 4 as you have suggested some time ago. Anyway I want to ask you if you want to explain to me how is the procedure that you use to create your devuan builds. I see that they use zImage instead of vmlinuz. To be able to use zImage or uImage as kernel file has been the key for me for enabling KVM. Thats because I'm not sure if u-boot can chainload vmlinuz. For a long time I've been frozen because I didn't know how to convert vmlinuz to zImage or uImage.

quarkscript2 commented 1 year ago

Great! Congratulations!

https://github.com/quarkscript/xe303c12_play_linux video demo is present; updated less tested ver - https://gitlab.com/quarkscript/linarm/-/blob/master/xe303c12/kali-linux/gadebli changing some strings on gadebli script you could gen ubuntu or mxlinux or any other debian based distro. Since different debian-based distros containe defferent debootstrap package you may have issues in case building not same armhf distro as host distro; i.e. building Devuan armhf target system from Kali x86(64) may fail; in same time building Kali from Kali should be succes.

Actually Devuan uses kernel_image, it is a packed zImage with dtb, chromeos signing keys and kernel bootstring. Kernel package containes script that could gen new kernel_image from zImage if needed and flash it to kernel partiton.

Last couple kernel packages from gitlab mirror has uImage too. but i did not check is it right generated.

Marietto2008 commented 1 year ago

I tried to boot devuan using "kernel_image",but it didn't boot. Instead,zImage is able to boot but only when it is converted to uImage. Do you think that if I use ubuntu instead of devuan as userland,it will work ? I'm not sure that the installation of your deb file will work because I'm using a different configuration than your. In any case I prefer to don't use automatic scripts that may cause problems because they haven't been written with the exact configuration that I need to use to enable KVM.

---> Last couple kernel packages from gitlab mirror has uImage too. but i did not check is it right generated.

can you give me the link of the gitlab mirror ? my next experiment is to change devuan 4 userland with your devuan 5. I want to try to upgrade it,keeping the kernel 5.4.244,thatì's the only kernel that we can use.

quarkscript2 commented 1 year ago

https://gitlab.com/quarkscript/linarm/ or you may look here too https://github.com/quarkscript2/xe303c12_arm_linux

https://gitlab.com/quarkscript/linarm/-/blob/master/pkg/README.md

kernel_image works with regular chromeos uboot but did not with nv-uboot

Links to test disk images same as here. There is only one Devuan 5 (unstable) disk image i made and it was for trying bunsenlabs ui. If you want just update it could be done in same way as other debian based distro: edit /etc/apt/sources.list and replace chimaera with ceres or daedalus then execute sudo apt update sudo apt upgrade

Reason i use devuan 4 is old mesa that could be patched to enable limited video hw acceleration that is used with ffplay, mpv or vlc.

Marietto2008 commented 1 year ago

I'm installing devuan 5 on the sd card. I will have problems with the mesa libs ? I will be able to play youtube videos or offline videos ? Is there the needing to patch the mesa libs if I use devuan 5 ?

quarkscript2 commented 1 year ago

You will be able play video without patched mesa.

Marietto2008 commented 1 year ago

What about mesa libs on devuan 4 ? Do i need to patch it ? where is the patch ? how to install mesa libs ?

quarkscript2 commented 1 year ago

It should already be installed. Difference in cpu utilization dufing video playing with vlc, mpv or ffplay.

In case you want to rebuild it patch could be https://github.com/quarkscript/linux-armv7-xe303c12-only/blob/master/archlinuxarm/some_forked_apps/mesa/gpuac.patch

or patch and instruction how to build deb packages https://gitlab.com/quarkscript/linarm/-/blob/master/pkg/README.md#how-mesa-2035-was-rebuilded

deb packages itself https://gitlab.com/quarkscript/linarm/-/tree/master/pkg/mesa

For install execute sudo apt install ./packagename.deb ./packagename2.deb and so on.

To hold/unhold packages using interactive aptitude could be a little bit easier than apt

Marietto2008 commented 1 year 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 1 year 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 1 year 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