wh0 / bookconfig

17 stars 3 forks source link

Some issues with WM8650 #1

Open ffpp2003 opened 1 year ago

ffpp2003 commented 1 year ago

I hope this project is not dead... I was able to succesfully compile kernel 5.15 and debian 11 for a laptop with the WM8650 CPU. I had to tweak some things in order to be able to boot it:

With that, and an external keyboard I was able to set up debian 11 and conect to the internet using the external Ralink adapter (RT5372L), because none of the "internal" devices seemd to work (no WiFi, no Ethernet, no keyboard). Also, I'm not being able to get anything on the serial port after the bootloader prints ## Transferring control to Linux (at address 00008000) ... and also, from the laptop itself I'm not able to see the internal serial port, only tty0 and ttyWMT0. I'll try to go back to linux 4.14 and see if any of this gets fixed, otherwise I'll have to look for some answers on the google mailing list.

One issue that I'm having that is related to this project, is that during the first boot and sometimes when installing new packages, I get the following:

debconf: unable to initialize frontend: Dialog 
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/per 15/Debconf/FrontEnd/Dialog.pm line 78.) 
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline 
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term: : ReadLine module) (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabi/perl/5.32.1 /usr/local/share/perl/5.32.1 /usr/lib/arm-linux-gnueabi/perl5/5.32 /usr/share/perl5 /usr/lib/arm-linux-gnueabi/perl-base /usr/lib /arm-linux-gnueabi/perl/5.32 /usr/share/perl/5.32 /usr/local/lib/site_perl) at /usr/share/per 15/Debconf/FrontEnd/Readline.pm line 7.) 
debconf: falling back to frontend: Teletype

(beaware of some writing errors, I used google lens to extract the text from a pic I took)

ffpp2003 commented 1 year ago

Rolling back to 4.14 fixed the keyboard. Enabling the rhine device support fixed the ethernet issue, and I was able to make the internal wifi to show up changing the systemctl start wlgpio pin, from pin 2 to pin 6. But I'm having some issues with the firmware, that for whatever reason I get:

[   74.070000] IPv6: ADDRCONF(NETDEV_UP): wlxc4604401a0a3: link is not ready
[   74.070000] rtl8192cu: MAC auto ON okay!
[   74.180000] rtl8192cu: Tx queue select: 0x05
[   74.600000] rtl8192c_common: chksum report fail! REG_MCUFWDL:0x00030000 .
[   74.600000] rtl8192c_common: Firmware is not ready to run!

even after rebuilding the kernel with the appropiate firmware an running sudo apt-get reinstall firmware-realtek after booting. Serial is still non-functional and that issue with debconf is still a thing. Just for the record, here is my .config, if anyone tries to do the same

wh0 commented 1 year ago

hi, thanks for posting. nice finds about getting this to work on a similar device. some comments:

manually renaming config.new to config

you can automate the build by extracting the changed lines and putting them in the seed file

Change where the files of the boot partition are located. I didnt know how to change it directly on the Makefile

should work to rename the "target" and dependency

-boot.zip: script/uzImage.bin script/scriptcmd
+boot.zip: uzImage.bin wmt_scriptcmd
 ...

-script/uzImage.bin: zImage_w_dtb | script
+uzImage.bin: zImage_w_dtb
 ...

-script/scriptcmd: cmd | script
+wmt_scriptcmd: cmd
 ...

-script:
-   mkdir -p $@

I'm not being able to get anything on the serial port after the bootloader prints ## Transferring control to Linux (at address 00008000) ... and also, from the laptop itself I'm not able to see the internal serial port, only tty0 and ttyWMT0.

I've never tested the serial console on my WM8505 device. It might not have worked for me either.

during the first boot and sometimes when installing new packages, I get the following:

debconf: unable to initialize frontend: Dialog

You can use apt to install whiptail or dialog to let debconf present a nice in-terminal dialog.

ffpp2003 commented 1 year ago

Thanks for the suggestions. I was able to modify the Makefile so now I can just extract the boot and rootfs files directly on my MicroSD and be ready to boot. What I didn't understand is what do I have to do with the seed file. How can I extract the changed lines?? I mean, I could manually read all the lines, but what do I take as a "base" config to then extract the changed lines? Regarding the serial console, I might have been doing something wrong, because now, by adding console=ttyWMT0,115200 to the end of the bootargs I can get a serial console. Installing dialog also fixed the errors related with debconf. I'll see if I can fix the keyboard issue. I know its a "usb based" connection, but I don't know why on linux 5.15 I can't get it to work. I'm still looking for a solution for the firmware issues with the wifi.

wh0 commented 1 year ago

what do I have to do with the seed file. How can I extract the changed lines?

For the various things you change in the menuconfig, there's a key you can press to get help about the option. H would have made sense, or maybe it was question mark? In the help for that option, it shows the config name. Put that config name with a CONFIG_ prefix in the seed file, either CONFIG_(whatever)=y or # CONFIG_(whatever) is not set.

You can also look at the diff between the original and modified config files to help remind you of what you changed. It should suffice to run touch seed && make config to regenerate the "base" config file. But there are usually a lot of dependencies that the config system toggles automatically which you won't need to enter explicitly in the seed file. Including those shouldn't hurt, but it might make maintaining the seed file less obvious.

Good progress on the serial console and dialog stuff.

I'll see if I can fix the keyboard issue. I know its a "usb based" connection

Weird, I've used a USB mouse on mine. I don't remember trying a USB keyboard though.

I'm still looking for a solution for the firmware issues with the wifi.

What's the consequence of that by the way? From the logs on the mailing list it looks like it's still able to connect. Does it get limited to lower speeds or something?

ffpp2003 commented 1 year ago

Thanks for the clarification on the seed file. I'll try later to add the modified lines. The issue with the keyboard is weird. I can use a usb (usb 2 ps2 adaptor) keyboard just fine, but it seems like linux 5.15 is not initating the second usb hub where the keyboard and mousepad are connected. I'm kind of lost there. Regarding the WiFi, its really weird. I dont know if if can connect to my wifi. All I can see is "firmware is not ready" and a checksum error. One thing to note, just after installing again realtek-firmware, a different output is generated. It seems like it can authenticate and associate to the wireless network, but after the link becomes ready it spits out deauthenticated from <MAC> (reason: 15=4WAY_HANDSHAKE_TIMEOUT), and then it tries six more times to authenticate after the driver (i think) times out and the adapter resets itself (usb 1-4: USB disconnect, device number 5) and stays silent. I've tried to copy the firmware files for rtlwifi from here, but nothing seems to have changed. I'm also kind of lost here

ffpp2003 commented 1 year ago

I was able to fix the usb keyboard issue following this modification to the uhci-platform.c file. Now keyboard works and mousepad is being detected, but i havent tested it yet. WiFi is still non functional. Only one question, is it possible to add a "soft shutdown" command to debian? It seems like the power button just de-energyzes the whole system instead of providing a safe shutdown to the system

wh0 commented 1 year ago

comment out [the code the enables some clock]

woa that's some heavy duty fixing

is it possible to add a "soft shutdown" command to debian?

I'm seeing systemd docs say systemctl poweroff. not sure what hardware support is needed though

wh0 commented 1 year ago

I can reproduce the uhci problem on my device. but I'm also sidetracked with rebasing the kernel on 6.1 and getting the i8042 devicetree support working again

ffpp2003 commented 1 year ago

omg, kernel 6.1? isn't that a little bit overkill for a 300MHz cpu???

wh0 commented 1 year ago

added this patch for the UHCI startup

https://github.com/wh0/bookconfig/commit/68a90a8c3979ab259a0e794a631552514958fa8f

added this patch for the debconf Dialog frontend complains

https://github.com/wh0/bookconfig/commit/657c233236e4510cbf1c108f768bd7d0f726d340

these are in the new v7 release

ffpp2003 commented 1 year ago

I have to ask this because its really weird. When trying to install packages using apt, that have a lot of dependencies that need to be downloaded and installed, do you get a segmentation fault at any part of the process? Could you try running sudo apt install inxi for instance? I'm having issues with inxi, xorg, or any package that requires many dependencies (lets say, more than 70) to be installed. Using multistrap solves this. I only get the segmentation faults on linux 5.15 and 6.1. Linux 4.14 seems unaffected by this issue

wh0 commented 1 year ago

haven't gotten segmentation fault. but I did get dpkg 'extract' running out of memory trying to unpack libllvm15 though

using multistrap solves this

wait is this on the netbook or on the computer that builds the root filesystem?

ffpp2003 commented 1 year ago

its on the netbook How do you know that dpkg runs out of memory? Does it tell you or you checked with free -h?

wh0 commented 1 year ago

It makes a big printout when the kernel runs out of memory and chooses something to kill

I later set up a swapfile