Author Topic: Compiling the kernel for the GPDXD+  (Read 2681 times)

romain337 (OP)

  • *
  • Posts: 30
Compiling the kernel for the GPDXD+
« on: May 12, 2018, 02:02:04 pm »
I managed to compile the kernel for the XD+ in the skelton github.

I used the toolchain found here: https://github.com/ResurrectionRemix/aarch64-linux-android-4.9 because I can't build my own toolchain (it would take a day only to download all the source...)

That's what I've done so far:

export ARCH=arm64
export CROSS_COMPILE=/opt/android-sdk-linux/aarch64-linux-android-4.9-marshmallow/bin/aarch64-linux-android-
make clean && make mrproper
make mt8176_defconfig
make -j4

[...] compiling for a few minutes [...]

now, using Android Image Kitchen for linux:

./unpackimg.sh boot.img (from stock rom 1.10)
replace boot.img-zImage inside split_img by the Image.gz-dtb created by the compiler (and rename it to boot.img-zImage)
./repackimg

Now I have a image-new.img that I should flash on my GPDXD+

It is correct ? I don't care soft bricking the device as I said before and I can reflash the boot.img from stock firmware easy, but I just want to be sure it's *seem* good and don't want to do it like a fool with eyes closed.

Next step I want to do is to take the controller driver in your XD kernel source and try to put it in the XD+ then do all those step again but I will not bother you for that no worries.

To be sure, I can't mess with the bootloader using this image ?

skelton

  • *****
  • Posts: 6834
Re: Compiling the kernel for the GPDXD+
« Reply #1 on: May 12, 2018, 02:20:40 pm »
the bootloader is lk.bin, so as you ln as you don't flash a different lk.bin, should be ok. The only way to know if kernel works is just flashing. It should work if it compiled ok, because kernel compiles and flash ok (I didn't make any change though), but just did long time ago a simple compilation test and kernel is ok, maybe older than the one they are using in stock 1.10 though. The toolchain you used is the correct one. When I flashed a custom kernel the stock mapper stopped working in my device though, so not sure if it's something else missing in the kernel source, or just my prototype xd plus is different. GPD gave no answer at all so it seems they don't want to give xd + some love.
« Last Edit: May 12, 2018, 02:31:42 pm by skelton »
Retired

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #2 on: May 12, 2018, 02:34:55 pm »
DANG! It booted!!!

I'll use it as it for the day, and If all seem to work OK I'll try to play with the controller driver.

Thanks you very much.

skelton

  • *****
  • Posts: 6834
Re: Compiling the kernel for the GPDXD+
« Reply #3 on: May 12, 2018, 04:44:12 pm »
You are welcome. As i say, as long as lk.bin IS untouched, we are good. Too bad gpd didn't release source for bootloader or a LCD datasheet. With that i could try fixing screen refresh issue, but without new bootloader IS quite complicated.
Retired

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #4 on: May 12, 2018, 06:52:12 pm »
Top bad as you said:/

I managed to compile the kernel with the XD driver but the controller icon is now showing with a red cross in the status bar so it don't work as it.
It did it quick and dirty (just replaced the files).I think nothing changed appart adc_js.c but I need to confirm by comparing the other files in the folder and do some debug with adb maybe.

The kernel may be older than the 1.10 but if it was leaked one time it can happen again ^^ They may fix it later too, as I understand the GPD WIN 2 is coming so they can be busy *crossing fingers*

skelton

  • *****
  • Posts: 6834
Re: Compiling the kernel for the GPDXD+
« Reply #5 on: May 12, 2018, 06:57:58 pm »
yeah well, it was expectedl that the driver for old xd didn't work as it is. Some change is made for sure. No idea why they changed because on old XD was fine. In Xd plus I didn't find issues using ps3 mode though, but I rarely play android games, just emulators and a couple of games that run fine on ps3 mode. Maybe just tincore with some of their modes (P mode or S to simulate a ps3 or shield controller) may help for some problematic games. The kernel was leaked, but they haven't answered my emails for a long time, so it seems GPD is not very interested.... or they didn't like that kernel was made public.

Maybe the underclock must be removed at least...... I have some ideas (mt_vcore_dvfs.c file) but don't have my xd+ with me to test.
« Last Edit: May 12, 2018, 07:08:50 pm by skelton »
Retired

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #6 on: May 13, 2018, 05:17:32 pm »
Little update:

I managed to replace adc_js by adc_js.c from your kernel source (keeping the others file from the leaked kernel). Fixing some compilation errors and it is not working yet but at least I got some response from the Dpad but it's buggy (and still a red cross in the status bar). I'll continue to mess with it to see how far I can go.

I looked into the file you mentionned to remove the underclocking, I think I have just to replace this value:

#define FDDR_S0_KHZ      1792000

by the original cpu speed in hz, right ? at least I can give a try. For now I focus on the controller cause I'm playing minecraft essentially and none of the ps3 or xbox mode is working nice (but it's playable with ps3 if you don't use the dpad).

skelton

  • *****
  • Posts: 6834
Re: Compiling the kernel for the GPDXD+
« Reply #7 on: May 13, 2018, 05:52:05 pm »
Not sure because that same vlue appear in mi pad 3 Kernel And IS not underclocked. I think that value could reference to ddr speed in dual Channel, but i haven't looked too much. The only difference i found between mi pad 3 Kernel And XD one Was that XD one had eliminated one value under vcore if i remember well. About josytick driver, apart from mides theybalso include the values for their gpd mapper, so replicating all that without source IS a pain un the ass. They should just make the driver available to everyone. I emailed them about that but no answer at all. Seems GPD IS not being very collaborative.

Edit. after checking mt_vcore_dvfs.c in both mi pad 3 kernel and xd one, they are identical, so the underclock must be somewhere else, maybe in mt_cpufreq.c .
Edit, I think I found it in mt_cpufreq.c

Code: [Select]
#if 0
      /* big CPU LEVEL 0 *//* 2.1G, SB */
static struct mt_cpu_freq_info opp_tbl_big_e1_0[] = {
OP(DVFS_BIG_SB_F10, DVFS_BIG_SB_V10),
OP(DVFS_BIG_SB_F11, DVFS_BIG_SB_V11),
OP(DVFS_BIG_SB_F12, DVFS_BIG_SB_V12),
OP(DVFS_BIG_SB_F13, DVFS_BIG_SB_V13),
OP(DVFS_BIG_SB_F14, DVFS_BIG_SB_V14),
OP(DVFS_BIG_SB_F15, DVFS_BIG_SB_V15),
OP(DVFS_BIG_SB_F16, DVFS_BIG_SB_V16),
OP(DVFS_BIG_SB_F17, DVFS_BIG_SB_V17),
};

      /* big CPU LEVEL 0 *//* 2G */
static struct mt_cpu_freq_info opp_tbl_big_e1_1[] = {
OP(DVFS_BIG_F0, DVFS_BIG_V0),
OP(DVFS_BIG_F1, DVFS_BIG_V1),
OP(DVFS_BIG_F3, DVFS_BIG_V3),
OP(DVFS_BIG_F5, DVFS_BIG_V5),
OP(DVFS_BIG_F7, DVFS_BIG_V7),
OP(DVFS_BIG_F8, DVFS_BIG_V8),
OP(DVFS_BIG_F10, DVFS_BIG_V10),
OP(DVFS_BIG_F11, DVFS_BIG_V11),
};

      /* big CPU LEVEL 1 *//* 1.9G */
static struct mt_cpu_freq_info opp_tbl_big_e1_2[] = {
OP(DVFS_BIG_F01, DVFS_BIG_V01),
OP(DVFS_BIG_F2, DVFS_BIG_V2),
OP(DVFS_BIG_F4, DVFS_BIG_V4),
OP(DVFS_BIG_F6, DVFS_BIG_V6),
OP(DVFS_BIG_F8, DVFS_BIG_V8),
OP(DVFS_BIG_F9, DVFS_BIG_V9),
OP(DVFS_BIG_F10, DVFS_BIG_V10),
OP(DVFS_BIG_F11, DVFS_BIG_V11),
};
#endif
Removing the if 0 and the final endif should do the trick for 2,1 ghz, unless there is more code somewhere else

« Last Edit: May 13, 2018, 06:51:03 pm by skelton »
Retired

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #8 on: May 13, 2018, 09:17:08 pm »
Thanks ! I'll try it I think when I come back home :)

[edit] done!
https://github.com/notnotme/android_kernel_mt8176_common
« Last Edit: May 13, 2018, 11:12:44 pm by romain337 »

PsyOps

  • ** Moderator
  • Posts: 894
    • Section Eight
Re: Compiling the kernel for the GPDXD+
« Reply #9 on: May 14, 2018, 03:57:14 am »
let me know if there is a compiled kernel you would like me to test.
Is it lk.bin ?

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #10 on: May 14, 2018, 06:20:20 am »
Hello PsyOps,

Nop, the kernel is inside a boot.img. I will provide a boot.img in my github repo inside the release tabs (eventually with a scatter file to ease the thing). Just give me some time to upload it, today I'm at work :)
You will have to use sp flash tool and download the boot.img to your device.

I tested the 2.1Ghz (that apply only to 2 cpu) and it seem to not change anything in game :) But it was a quick test.

PsyOps

  • ** Moderator
  • Posts: 894
    • Section Eight
Re: Compiling the kernel for the GPDXD+
« Reply #11 on: May 14, 2018, 07:13:22 am »
K cool. But you can verify that it was clocked at 2.1 then?

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #12 on: May 14, 2018, 07:33:25 am »
I checked using cpu-z.

PsyOps

  • ** Moderator
  • Posts: 894
    • Section Eight
Re: Compiling the kernel for the GPDXD+
« Reply #13 on: May 14, 2018, 07:55:50 am »
Any idea what version kernel this is? The 1.10 changelog is :
1、Modified the issue that gsensor couldn't Calibrate.
2、Modified the issue that the device couldn't turn off forcedly on the BootLoader mode.

any idea if you can fix that?

Is the gfx drivers that are causing the refresh problem also in the kernel, any hopes in squashing that?

skelton

  • *****
  • Posts: 6834
Re: Compiling the kernel for the GPDXD+
« Reply #14 on: May 14, 2018, 08:21:45 am »
Psyops, the gfx drivers are userspace libraries (.so) files that are in the firmware,not in the kernel. Refresh issues are in LCD timings which are in kernel though and in lk.bin.

Good to know that my idea to remove underclock worked. Probably there is no much diference, mainly in android games that are more GPU than CPU. I suppose some becnhmark like geekbench should show some difference
Retired

romain337 (OP)

  • *
  • Posts: 30

PsyOps

  • ** Moderator
  • Posts: 894
    • Section Eight
Re: Compiling the kernel for the GPDXD+
« Reply #16 on: May 14, 2018, 09:15:26 am »
Thnx bud. Maybe ill include in a light mod with no bloat. Thnx a bunch.

Any handle (nickname) you want me to include for kernel source?

I know its nothing big but maybe it's the first step to a new rom.


Oh forgot one thing. Will magisk let me patch this boot? or will it recognize it as not being stock boot?
« Last Edit: May 14, 2018, 09:20:02 am by PsyOps »

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #17 on: May 14, 2018, 09:35:17 am »
To answer your first 2 question that I've not answered:

1: I don't know, but sensor seem calibrated when I look into cpu-z sensors tab
2: I don't know, someone have to try :p

About magisk, I don't know as I not tested to root the device yet because I use my sdcard as internal storage and don't want to lose all my data (~50GB and it take 8 hours to copy that on it because all the roms...).

Nickname is romain337.
« Last Edit: May 14, 2018, 10:03:37 am by romain337 »

PsyOps

  • ** Moderator
  • Posts: 894
    • Section Eight
Re: Compiling the kernel for the GPDXD+
« Reply #18 on: May 14, 2018, 09:37:19 am »
Ok i just tested. Magisk patches it just fine.

romain337 (OP)

  • *
  • Posts: 30
Re: Compiling the kernel for the GPDXD+
« Reply #19 on: May 14, 2018, 10:21:20 am »
haha, just rooted the device with an sdcard as internal storage :p

in fact, it save the patched image in the internal storage even if you have the sdcard used as internal. So using adb you can pull /sdcard/MagiskManager/patched_boot.img to your computer then flash the image :p

 

Post a new topic
Post a new topic