-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PS5000 factory updated -> rockchip uboot + 4.4 rockchip kernel opensource rebuild #51
Comments
Thanks, that confirms what we observed from another users that there are at least two different PS5000 revisions. We need to find an easy way to identify which model is which before the flash takes place. Most likely by running a PL command with android tools to check the memory address of each partition. Also, some users with that RevB model (the one with user data at 0x0002b000) that flashed the userdata with our install script seem to have a corrupted userdata partition that does not flash cleanly. While that can be easily solved at Linux level, it’s not so clear how to automate the recovery of the corrupted partition via command line on windows. It seems it may require the users to run rkdevtool or a similar rock chip tool. |
More questions:
|
For the kernel you only need the standard Linux kernel sources for 4.4.159. Just uncompress and create a symbolic link named kernel (one level above buildroot). The boot is just a reconstituted boot from a dump of the internal firmware. It just includes the kernel image and the associated dtd’s. We will document how to do it in the future but it’s not relevant for this device. The userdata does not need to contain anything other than a run and system folder. Run is mount binded to the chroot system upon boot. This is needed to obtain read/write permissions for udev population. System is basically a link to /mnt/sdcard so the default home is set to /userdata/system. We have not documented this but will do in the future. There are no scripts to roll do this currently but it’s just two folders to be added to an otherwise empty partition. |
Nope. Standard Linux sources does not contain drivers "mali", "rkflash", "hevc_service", "vpu_service" ... Only https://github.com/rockchip-linux/kernel (synchronized to 4.4.194 now) and other forks. So if you distribute kernel binaries you should also disclosure your equivalent kernel sources. |
Yes and no. For the kernel link that you need to build just rootfs you don’t need the modified kernel sources with rockchip specific patches. However, you are correct that to get those rockchip specific kernel modifications you need to compile the kernel you need those modified sources from rockchip Linux, same repo as you point out (https://github.com/rockchip-linux/kernel). Our rootfs only requires a loop module to be compiled from the kernel, and that’s a general Linux module that does not require any of the rockchip modifications. Same applies to rkscript, Linux-rga, Mali (specific rockchip flavor), etc. You can find a more up to date repo of all those in the Caesar Wang repo (https://github.com/Caesar-github), he’s one of the main rockchip contributors. The origin of the buildroot that we use comes from a blend between Caesars buildroot modifications to the main rockchip Linux buildroot, plus additional modifications based on batocera.Linux buildroot. In any case, our current goal is to document everything, but time is limited. You are welcomed to create any pull requests and contribute to the project. |
Please simply clarify (ps5000 is WX8 board):
Very thanks, Martin |
No, at least I don’t have it.
No. There is a defconfig for building the rootfs and a hierarchy of overlays for the specific consoles supported: a12/a13 and ps5000. The dts for ps5000 is not modified by the cfw, should be the same provided by the seller.
No. As above, for the time being we only build the rootfs for ps5000.
Thanks for your interest! And now the long story: we want to move to batocera to get a cleaner and more compatible environment. We are in the process. Another goal is building the whole system from scratch. Regarding documentation, we want to add instructions to unpack (and repack) the boot partition so anyone is able to extract the dts. The sources of the official firmware are not being distributed by the seller, at least not to us, so the most we can provide are the steps to get the dts from the original partition. The only modification we do over the original boot partition for ps5000 is the splash screen to add version information and easily identify what the user flashed in case they are not skilled enough. And now the longer story: we made the decision of distributing the boot image even though we didn’t get access to the sources because the seller of powkiddy a12/a13 devices introduced a modification in the dts to reset the device if you try to boot with a different rootfs. Thus, in those devices you need a modified dts to "free" the device. Until we get stuff documented, the tools you can use to unpack/repack the boot partition are 7z and imageRePackerRK. Best, |
Of course if you are able to compile a working full system for the ps5000 we will be more than happy to get rid of the OFW boot. We are focused on moving to batocera to ease the compilation process, so the full system build is still a later step for us, definitely something we want to achieve. |
Thanks for clarification. I am capable to work with lowlevel RK tools (ASUS Tinker, PINE ROCK64 ...) like u-boot/tools/, rkbin/, build/mk_uboot.sh|mk_image.sh. But I have serious problems to replicate working u-boot (with SDcard support) (dtb/dtc already extracted from vendor image and manually created some initial dts). Get many errors from close-sourced loader (Boot1 Release Time: Nov 6 2018 21:30:48, version: 2.54) and hung recompiled u-boot :-( |
I've not tried on this device yet, but I got a working u-boot for the A12 before. The issue there was not the u-boot but the kernel, even with the extracted KCONFIG from the OFW kernel the kernel was not working and something failed (probably display init). There's another developer trying to get the PS5000 to boot off an SDCARD, I'll post an update if I hear back. |
Duplicate #53 |
I tried to rebuild u-boot with SDCARD support but I failed. I used caesar-u-boot. I cleaned and enabled all needed stuff (see my WIP branch). Problems:
and
-> kernel original dts/dtb and rockchip drivers are buggy (some Please publish yours success / progress. funny note: after reboot from running linux back to u-boot it starts display and show splash image (but with some corruption, same with testing images with u-boot sad note: Aliexperess distributor refused to publish GPL sources and original designer ?"Shenzhen Sunchip Technology Co., Ltd."? did not respond. So there are candidates to report GPL violations. some build notes:
|
Thanks for the update @mcerveny , very good and detailed notes. Not much progress here, actually the opposite, I tried to compile u-boot again yesterday and after a couple of tests and flashing different combinations I ended up with a (hopefully) soft-bricked PS5000. It's currently in MSC mode (as opposed to the normal MASKROM & LOADER modes). Note: just re-read your updated notes, about the LOADER mode and using CTRL-C. I tried to do that, for some reason it's not working for me, I don't seem to be able to send any key codes to the screen session. will try again tomorrow I'll get back to try once I figure out a way to switch back from MSC to LOADER/MASKROM. I've been focused on trying to get the system to boot from the SD card. The closest I got to something in that direction is this:
Note the "run on sd0" mention. However all my efforts have resulted on what the system considers a GPT corrupted partition, and none of the actual SD card partitions are being read. Some additional resource that may be helpful for your efforts: The repo includes all the required elements to build a full sd image from scratch. |
Additional update:
Using the uboot compiled from @mcerveny sources, I was able to get to the autoboot prompt, press CTRL+C to stop and then enter The most important thing si that the SD card that I created seems to work to get the system to boot directly. Still the partitions are not pointing to the right place and after loading the uboot the system looks for the rest of the partitions from the internal memory. Note: idbloader_sdcard was generated with: |
Yes. SDcard is u-boot bootable. My script (for .img or direct to /dev/sdc):
But the problems persist. Not able to boot from sdcard (
I used spinand boot and rebooted from linux (not power on/off):
Interrupt rebooted u-boot and the sdcard works:
Something is bad in u-boot. Maybe PWM powers, interrupts, dmas ... additional hint: I did many tests and I destroyed protected bootloader in spinand :-). so MASKROM mode must be forced by GND to DI or CLK on W25N01GV and upload testing u-boot (with NONSEC support) directly to RAM over USB:
|
Ok, "repaired" SDcard boot, use only 1-bit (not 4-bit) mode (see mcerveny/caesar-u-boot@7f2236e) with actual code :-( . |
Very nice, I tried a different route by plugin a USB card to rule out whether there was a different issue, the USB booted "correctly":
Just tried your uboot patch and I can confirm that fixes the SDMMC errors. However the display is not properly initialized, the UART does not show anything (I need to change the kernel console to output to the same one) but the syslog shows the problem:
Full dmesg log: dmesg.log Note that this is booting via spinand, since I needed the MMC. In any case, impressive work @mcerveny ! |
"caesar" removed kernel git (https://github.com/Caesar-github/rockchip.git) :-( (I have local copy :-).
|
@mcerveny, @acmeplus, --Big disclaimer: I don't have any idea about how all this stuff works--
I found this patch and I wonder whether the error above may be related to something similar. |
Nope. Rockchip repo (uboot and kernel) have lot of proprietary code and WX8 authors add some additional code and does not expose it to public thus violating GPL. As I wrote @ beginning I suppose that "original kernel" heavily depends on "original u-boot" initialization of HW that is awful. This messages arise when I used Rockchip (caesar) opensource u-boot with "original kernel". Now I try to rebuild kernel from Rockchip opensources but I found many proprietary drivers/code in kernel config:
I queried Shenzhen Sunchip Technology Co., Ltd. over Alibaba chat (or direct) to get access to GPL licensed code and build script (uboot,kernel,buildroot...). Sunchip say, that they are the developer of PS5000 or here ... and 10% off in September. No answer, try it too. |
I was partially successful to rebuild linux kernel (based on rockchipl-linux). As I wrote in previous post many "close source" mods exists.
hint*: boot from original uboot/kernel and then "reboot" by command to sdcard. example of sdcard build script:
example of
sdcard.tar:
|
@mcerveny just to confirm that I can mostly reproduce your findings. Some minor differences/observations:
I'll do some additional tests this week. |
DRM works, but display is not on, attach HDMI that is capable 960x544/59HZ.
I will try to read internal register settings and others in /sys/kernel/debug/... to decode used pins :-)
Try to change UUID (partition UUID and extlinux.conf reference)
This is weird. As I see A13 board display is connected with parallel RGB and not MIPI DSI. |
Ok, will try a different monitor.
I may be able to help there. Will give it a try.
Yeah, I haven't had time but it's most likely that.
Yes, I noticed that, so it's probably something else that is activating that. It's only initialization, haven't tried to actually use the display. Busy the last few days, will try to find some time this week. BTW, you can find @alpgarcia or @acmeplus on telegram or discord. |
Resolved hint* problem. Found master "enable" GPIO (part of closed source driver "gpio-keys-volume") so I moved last two keys VOL+/VOL- to generic GPIO keys (but volume control does not work due to need of direct scaling in PCM engine) see mcerveny/rockchip-linux@432d410 .
|
The display init issue? or the GPIO?
Good, running /etc/init.d/S49alsa stop/start adds the master mixer too. Also changing the /etc/input-even-daemon to listen to /dev/input/event0 event links the volume control to the master. The way it was done on these device was via that listener. Other devices have proper mapping of volume to PCM. I've tested what I have running internally+external sdcard working via external SDCard only, of course viaHDMI only. |
MIPI DSI display. As I wrote, the MIPI DSI display was always initialized properly (in kernel, unknown in u-boot) only nothing shows due to this powersaving GPIO switch. The closed sourced driver exposes |
Yeah, I get it now... just checked and it's working both internally/externally. It's interesting because the adc-pot is misconfigured in the A12 console, and the volume control always complains about the adc-pot. I'm going to try to consolidate the batocera test firmware I have with this setup. |
Update:
|
I added first try of battery mgmt driver (branch https://github.com/mcerveny/rockchip-linux/tree/wip-chgr, commit mcerveny/rockchip-linux@db0a5e5). Because I lost my TP4056 during HW measurement I must replace chip to continue. So the driver is incomplete for now.
Discharging:
|
Very good, battery status is now displayed on supporting apps (e.g. EmulationStation and Retroarch). Battery status charging shows 64 out of a total CAPACITY of 64, but applications show the actual value instead of the percentage (e.g. 64% instead of 100%). Removed power supply and status shows 99% (as opposed to 100%). I assume that's consistent since you indicate the driver is incomplete. Let me know if you need me to test anything else. |
Updated charger+battery+powerswitch mcerveny/rockchip-linux@2147595. Due to HW design faults it is not perfect. Open questions:
PS: Drivers "wx8joy" and "wx8-charger" and DTB "rk3128-wx8.dtb" (kernel and uboot) are tested with WX8 board only. I do not own Powkiddy A12/A13 or other similar rk3128 based handhelds. |
I've done some tests and it looks good. I've not seen any regressions compared with wx8, and the additional fixes you have included improve the system. One thing we have noticed is that there is no headphone plug event. It's probably something that can be added to the DTS but I'm not sure if that's one of those things that are missing/not available.
Need to leave the system running to get to a low battery state. I believe ES has a low battery warning, not sure about RetroArch.
We will try to find someone to do this task.
Need to check that. I believe RetroPie has a power save method but it's handled at the board level, not at the Frontend/Emulator level.
You are the expert there. Either method seems logical, but I'm not sure about the implications in terms of performance.
Default analogue mode is preferred. RA passes that configuration directly to some emulators like flycast or ppsspp that can use analogue controls directly.
Those make sense to me. Some observations about the mappings:
|
I've tried to modify the DTS to get the A12 to boot. Some comments in case you may give us some hints:
For the PS7000, we don't have that board but we have backups of the firmware. Probably the same as X20 and X2. There's also the Q400 that seems to be similar too. |
Headphone event is working in "rockchip,rk3128-codec" (see sound/soc/codecs/rk312x_codec.c):
So what are you missing ? |
Update: New configurable version of keys/joystick/keys-emulation is in new branch https://github.com/mcerveny/rockchip-linux/tree/ps7000 commit mcerveny/rockchip-linux@5d6c510. |
Nevermind @mcerveny. It's just an issue with missing udev rules as well as the other arm-headphone scripts that were present in the modified ruka but not on the batocera rootfs. Sorry to waste your time. I'll add the missing pieces to the batocera fsoverlay and it should work as it used to do on the OFW or ruka FW. |
EDID is generally OK. EEPROM and HPD is powered (~5V) from USB or from DCDC booster (no additional GPIO switches needed). The problem is only in one situation if DSI connector is set to
HDMI audio works OK.
|
I did some experiments with the batocera build with HDMI and I can confirm that behavior. HDMI behavior seems consistent and the method of turning off DSI, turning off HDMI, turning on HDMI enables the HDMI display correctly. |
I done time-based battery calibration. Updated to "wx8" and "wx8-updates" branches mcerveny/rockchip-linux@026c5f3 + mcerveny/rockchip-linux@95eae0f.
One measure like:
|
Expected - see my test #51 (comment).
Maybe another solution - PS: I received PS7000 with wx8 board (manufactured >=12/2020) and begin to modify DTS, Display is RGB (24bit, mode clock 51200 kHz,H: 1024 1184 1204 1344, V: 0600 0612 0615 0635). |
Very nice @mcerveny. That will help us to figure out the display issues on the A12/A13. Everything else on the A12/A13 seems to be working with the same firmware. |
PS7000 & PS5000 are now supported. |
Very nice progress!!! I can wait to promote to alpha and test something!!! There are so many folks that will appreciate that :) |
PS7000 (parallel RGB display) backlight PWM is supported !
|
wx7 board (used in PS7000/Q900 <12/2020, ...) seems to be nearly same to wx8 (used in PS7000 >=12/2020, PS5000...):
Did someone try to replace tragic non IPS display in PS7000 with IPS display ? |
@mcerveny according to @fakemaria a user in one of the forums replaced that screen with this IPS one: |
I corrected keys, analog joysticks and joystick key emulation ( Not feedback for joystick driver:
|
In Retroarch you can set a deadzone vía |
I've been adding support for the Powkiddy A13 console. It is worth noting a12 and a13 has different hardware revisions, including different displays with different resolutions. Mine for instance is what we called rev B (1024x600). I guess we should add a section in the wiki to describe what we know is different on each model. Said that, this is my first time touching the device tree, so big disclaimer here, help and advice more than welcome. I forked @mcerveny's repos and added some changes to uboot on https://github.com/alpgarcia/caesar-u-boot/tree/powkiddy-a13 (alpgarcia/caesar-u-boot@9724e7a) and to the kernel on https://github.com/alpgarcia/rockchip-linux/tree/powkiddy-a13 (alpgarcia/rockchip-linux@fcacd11). Of course my intention is sending PRs to the original repos when ready and use my forks for development purposes only. I tried to not touch the dts hierarchy to keep my changes isolated for the moment. I created separate configs and dts files with the changes. In the case of the kernel I overwrote those definitions where I found some pins that were different from the already supported boards. I don't know what is the best way to add these changes, just tried to touch the minimum number of files possible at this point. Some things I noticed:
The boot log still needs to be reviewed to find other errors in the definitions. Nevertheless, the screen and controls are working on my Powkiddy a13 without the drifting problems I mentioned above. Please @mcerveny and @acmeplus let me know your thoughts and advices :) |
First you must get original DTB for u-boot (usually attached at the end of u-boot.bin) and kernel blobs (usually in android resource partition) and decompile with
Weird. All pins are mapable via PIN bank virtual IRQ https://elixir.bootlin.com/linux/v4.4.293/source/drivers/pinctrl/pinctrl-rockchip.c#L1440
I was aware of this code but this code is incompatible (old). There is no DTS configs ... |
I was comparing stuff manually (grep and friends) from the sources, I hadn't thought of decompiling the final dtb instead, thanks a lot for the hint!
They are, and the events work, but sometimes the release event is not detected. The log of
The second event (0) in this log happens after a second joystick movement, not after the initial one (it is an arcade stick with push buttons). The first movement only seems to generate the press event. And of course, this occurs "randomly", sometimes the release event is there, sometimes not, causing the drifting effect. I thought I might have missed some other wrong definition of those pins somewhere, but I guess there would be a message in the logs and the controller definition would be rolled back during boot. |
There is fixed pull up/down problem in RK3128 - see https://rockchip.fr/RK312X%20TRM/chapter-01-introduction.pdf
I suppose that GPIO2_C7 (and GPIO2_C6, GPIO2_D0, GPIO2_D1) is pull down but on board is explicit pull up resistor. So pulled in both direction and due to some parasitic capacity the result does not work as expected (check original kernel DTB). Try to set "&pcfg_pull_none" to this pin. I had the same problem with R3. |
Happy new year @mcerveny ! :) |
@mcerveny hope you are doing well. We have been updating the build and is now getting ready to get it to merge into the main batocera repo, the main branch is here and you can follow the conversation in this issue. However, there are few issues that I don't understand:
Anyway, let me know if you have some ideas. You can find releases for ps5000, ps7000, etc. in the releases page. |
Hello.
Update script
ruka_install_ps5000.sh (ruka_cfw_3.0_beta_1_20210806.tgz)
partition table does not match for userdata_ps5000_20210806.img partition (offset 0x00028800).I received updated version with different LBA offset 0x0002b000 !
The text was updated successfully, but these errors were encountered: