Author Topic: Compile a Kernel  (Read 897 times)

AthenaX7500 (OP)

  • *
  • Posts: 53
Compile a Kernel
« on: July 10, 2018, 06:33:33 pm »
Hello,

I have installed

- ubuntu 18.04
- kernel source from https://github.com/skelton/RK_g7_KK
- build-essential kernel-package libncurses5-dev bzip2
- android-ndk-r10b

After applying this commands the building process just stop without a kernel image.

$ export CROSS_COMPILE=[folder location]/androidkernel/android-ndk-r10b/toolchains/arm-linux-androideabi--jX ARCH=arm
$ make g7KK_defconfig
$ make menuconfig
$ make -jX ARCH=arm

Do I need any additional software?








skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #1 on: July 10, 2018, 09:12:30 pm »
It could be that for ubuntu 18.10 you need additional libs, I used 12.04, old but for kitkat kernel more than enough. I haven't used ubuntu 18.10 myself.

For the toolchain use arm-eabi 4.6 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/

At the end run make kernel.img and the number of jobs.. That is needed for rockchip images. Have in mind that if you are going to flash it in a stock firmware you need to remove the kernel from the stock boot.img of g7. Because boot,img of stock has a kernel binary inside that takes priority over kernel.img.

« Last Edit: July 10, 2018, 09:14:17 pm by skelton »
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #2 on: July 10, 2018, 10:05:48 pm »
Hi Skelton,

I tried 12.04 first but unfurtunally the apt-get feature did not work.
Did you install the build-essential kernel-package libncurses5-dev bzip2, or would the toolchain be enough?

What do you mean with number of jobs?

thanks

skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #3 on: July 10, 2018, 10:22:58 pm »
Number of jobs is the number of processes (so to speak) you run at the same time to speed up the compilation.
For example make kernel.img -j4 (where 4 is the number of processes)

Apt-get should work fine on any linux try running with sudo first.

Basically try with this for ubuntu 12:

sudo apt-get install git gnupg flex bison gperf build-essential \
   zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
   libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
   g++-multilib mingw32 tofrodos gcc-multilib ia32-libs\
   python-markdown libxml2-utils xsltproc zlib1g-dev:i386

   sudo apt-get install lzop libncurses5-dev

   sudo apt-get install libssl1.0.0 libssl-dev

This is the essential stuff to compile a kernel.

Then use the toolchain that I pointed before. Probably the one you use also works, but I think Rockchip used the other one.

This is an example for a radxa rock RK3188 board but is the same for the g7:

http://wiki.radxa.com/Rock/Android_Build#Build_the_kernel

Also, if you make changes to the source, commit your changes according to GPL.


« Last Edit: July 10, 2018, 10:24:38 pm by skelton »
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #4 on: July 10, 2018, 10:39:50 pm »
I intall ubuntu 12.04 right now and try it with your suggestions.

Will reply later if I progress further.

Many thanks.


AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #5 on: July 11, 2018, 07:46:54 pm »
Hi skelton,

the kernel compile was successfull.
I had an error during building:

CC      net/xfrm/xfrm_state.o
make[2]: *** No rule to make target `net/xfrm/xfrm_hash.c', needed by `net/xfrm/xfrm_hash.o'.  Stop.
make[1]: *** [net/xfrm] Error 2
make: *** [net] Error 2

Solved this by exchange the xfrm directory in /RK_g7_KK-master/net with the xfrm directory found in RK3188_Tablet kernel source from your github.
I use sd_boot and flashed the kernel.img generated in /RK_g7_KK-master with

$ sudo dd if=kernel.img of=/dev/sdb seek=$((0x2000+0x00004000)) conv=sync,fsync

it boots successfull and the date of its building time is show in the about tablet tab in settings.
The method with the exchange directory seems to be a bad way to resolve this error.
Perhaps you know the cause of this and show me a better way.




Ps.:
Install packages with apt-get on ubuntu 12.04 gave 404 errors.
Solved this by edit /etc/apt/source.list

$ sudo gedit /etc/apt/sources.list

 and replace the entries with:

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://old-releases.ubuntu.com/ubuntu/ precise main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ precise main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://old-releases.ubuntu.com/ubuntu/ precise universe
deb-src http://old-releases.ubuntu.com/ubuntu/ precise universe
deb http://old-releases.ubuntu.com/ubuntu/ precise-updates universe
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://old-releases.ubuntu.com/ubuntu/ precise multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise multiverse
deb http://old-releases.ubuntu.com/ubuntu/ precise-updates multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ precise-backports main restricted universe multiverse

deb http://old-releases.ubuntu.com/ubuntu precise-security main restricted
deb-src http://old-releases.ubuntu.com/ubuntu precise-security main restricted
deb http://old-releases.ubuntu.com/ubuntu precise-security universe
deb-src http://old-releases.ubuntu.com/ubuntu precise-security universe
deb http://old-releases.ubuntu.com/ubuntu precise-security multiverse
deb-src http://old-releases.ubuntu.com/ubuntu precise-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://old-releases.ubuntu.com/ubuntu precise partner
# deb-src http://old-releases.ubuntu.com/ubuntu precise partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://old-releases.ubuntu.com/ubuntu precise main
# deb-src http://old-releases.ubuntu.com/ubuntu precise main

after:

$ sudo apt-get update

your suggested packages were installable.



« Last Edit: July 11, 2018, 07:48:54 pm by AthenaX7500 »

skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #6 on: July 11, 2018, 08:50:58 pm »
maybe the file that gave you error was badly uploaded. using the same one from RK3188_tablet is ok, the files are identical.

Just curious any need to compile the kernel by your own instead of using the one on legacyROM?
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #7 on: July 11, 2018, 09:16:54 pm »
I replaced the stock analog stick with alps sticks on the GPD g7 and the GPD g7A.

On the GPD G7A the range showned in Tincore Keymapper calibration menu goes from 0 till 1000 after a little case modding.
With the GPD G7 the range goes only from 150 till 550.

described here https://boards.dingoonity.org/gpd-android-devices/gpd-g7-g7a-analog-stick-replacement-issue/new/#new

I thought maybe a change in the kernel could resolve this issue.
I had watched a youtube video were you flashed a kernel image to resolve right stick isue on GPD-G5A

https://www.youtube.com/watch?v=SIyxwX7BnYo

Frankly, the kernel compilation was my first attempt on this stuff and I have no idea what to look next.
It would be nice if you could point me in the right direction.

skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #8 on: July 11, 2018, 10:25:53 pm »
Well. The fix for g5a Was because It didn't support axis more than 0.66 And never reached 1.0. maybe on the case of g7a they chanfed sonething, but never had g7a source Code , so o cannot say What changes. Tincore wrote the driver for g7 so probably IS the one who ask rather than me.
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #9 on: July 11, 2018, 10:50:14 pm »
That sounds like the exact issue I have.

With the joystick test app the range of the alps analogs in GPD G7 did not reach the max throw, too.
With the stock sticks the range goes from 0 till 1.
Perhaps these new analog sticks have another resolution than the stock sticks, for example 10bit instead 8bit.
I did research in this direction and found something towards the term ADC, which one can probably edit in the joystick driver at  RK_g7_KK/drivers/input/soc/adc_js.c .
.
Could you tell me what you fixed in the GPD G5A or does this fix based on the tincore driver.
 
It is possible to pull a defconfig from an running GPD G7A device in order to know what used in the kernel menu?

skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #10 on: July 12, 2018, 09:36:56 am »
I don't think the g7a firmware include a defconfg. Check is there is a kconfig folder in stock firmware, but I doubt it. Even so, there must be something else that is changed in g7a, because firmwar is not the same,

About the joystick issue, in g7 the range was already from 0 to 1. In the case of new joysticks my guess is that those joysticks are not 100 compatible and doesn't do all the range. Not sure what to change there to be honest, tincore wrote the driver. Maybe you can try chaging those values;

input_set_abs_params(kp->input_joystick, ABS_X, -256, 255, 0, 0);
   input_set_abs_params(kp->input_joystick, ABS_Y, -256, 255, 0, 0);

Trying to increase it and see what happens, but gamepad driver is also related to g7 gpd mapper, so maybe one thing breaks the other.
« Last Edit: July 12, 2018, 11:04:24 am by skelton »
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #11 on: July 12, 2018, 03:19:17 pm »
Tanks for this info.
Will try this and reply later.

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #12 on: July 22, 2018, 04:08:47 pm »
Hello skelton.

I managed the problem with the range of the sticks without editing the kernel. (I will try this later)
After calibration with tincore keymapper, the  joystick test app show values up to 1.
Before this calibration the joystick test app show only values up to 0.550.

The problem is that the value starts from 0.150 instead from 0.001.
It seems that there is a deadzone between this values.
It is not like a regular deadzone, where the sticks can be pushed till a specific range and the input will only registred after this range.
Its more like a start up value, because it is registerd immeadiately.

For example in GTA San Andreas.
Steering with a motorcycle, looking at the tire In front of view.
Value 0.001 - 1.000: push the analog stick till an input registred: the tire moves just a little bit.
Value 0.150 - 1.000: push the analog stick till an input registred :the tire moves much more   

I tested roms with GPD-G5A, which is based on rk3188-t like the GPD-G7A.

Values from joystick test app:

Legacy Rom 2.0 GPD-G5A : value goes from 0.150 - 0.550.
Stock GPD G5A                  : value goes from 0.001 - 1.000.

I also just flash the kernel.img from Stock GPD G5A in combination with Legacy Rom 2.0 GPD-G5A system.img.

                                       : value goes from 0.001 - 1.000

With a playstation 3 controller and a logitech rumble pad connect to a otg cable:

                                        : value goes from 0.001 - 1.000

Summary:

- It does not depend on the hardware.
- It does not depend on system.img
- With the GPD-G7A Stock 5.3.1:    the stick value goes from  0.001 - 1.000
- With the GPD-G5A Stock 5.3.0:    the stick value goes from  0.001 - 1.000
- With the GPD-G5A Legacy 2.0 :    the stick value goes from  0.150 - 1.000
- With the GPD-G7 Stock 2.0.1:      the stick value goes from  0.150 - 1.000
- With the GPD-G7 Legacy 1.5:       the stick value goes from  0.150 - 1.000


It seems that GPD has changed the values in devices released after the GPD-G7.

Do you know where the deadzone or the start up value can be altered?

skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #13 on: July 22, 2018, 04:28:38 pm »
That is very strange because the joystick driver in g5a is exactly the same in legacyROM as in stock g5a. Unless they changed source code after that in latest stock firmwares (that probably added xbox mode aswell like in GPD XD), code that I don't have access for g5a. I personally when I used g5a and g7 with legacyrom and an app called joystick tests, it always gave me a value between 0 and 1, never 0.150.

Are you using the original joysticks or other ones?

Values should be around here:

input_set_abs_params(kp->input_joystick, ABS_X, -256, 255, 0, 0);
   input_set_abs_params(kp->input_joystick, ABS_Y, -256, 255, 0, 0);

But that should be enough for 0 and 1. In fact I had 0 and 1 in legacyrom with joystick test app. Maybe the new driver GPD wrote is different and they changed other stuff, to include xbox mode etc. But I don't have access to that ads_jc for g5a or g7 devices. Maybe you can take a look to the XD one and try to recreate it.

https://github.com/skelton/XD_444/blob/8f9417b815650b8bdcd7d0aef4fc1163b9106370/kernel/drivers/input/soc/adc_js.c

Another option if you have tincore is just as you say calibrating it and use one the joystick modes (S, P, M) and see how they work. I no longer have a GPD android device to recreate it myself.
« Last Edit: July 22, 2018, 04:30:18 pm by skelton »
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #14 on: July 22, 2018, 09:49:25 pm »
Hi skelton, sorry for the late reply.

I have two GPD-G7, a GPD-G5A and a GPD-G7A.

The alps sticks are insalled in one GPD-G7 and in the GPD-G7A.
The other GPD-G7 and the GPD-G5A have the original stock sticks installed.
The roms were tested with the stock sticks.
The following tests also with the stock sticks.

The biggest problem with this "deadzone" is it goes till the end of each axes.
For example:

The normal behavier: Input right till the end give a value of 0.000 - 1.000 (x axes), in this position input down let the y axes value raise from 0.000 till 1.000.

The "deadzone" behavier: Input right till the end give a value of 0.150 - 1.000 (x axes), in this position input down let the y axes value raise from 0.150 till 1.000.

Its not easy to explain, I attached a small draw.
It seems this is a Axial Dead Zone.
I found infos about this here:

http://www.third-helix.com/2013/04/12/doing-thumbstick-dead-zones-right.html

Another thing to mention is that tincore keymapper can override this "deadzone" with a real deadzone.
If I set a deadzone within tincore keymapper with value of 0 - 150, the sticks first recognized input value are 0 and goes till 1000.
But with this method I loose stick throw and unfortunally the Axial Dead Zone still remains.
The difference is that the stick input registered after a value of 150 and then start from 0 till 1000, instead registerd at 0 and start from 150 - 1000.
It is even worse.

Will try your suggestions now and report the results.

Manny thanks for your input.

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #15 on: July 23, 2018, 02:29:02 am »
The problem solved.
I searched for a newer stock firmware for the GPD-G7 and found a chinese G7 V4.1.0 rom.
With this rom the values of the sticks goes from 0.000 - 1.000.

https://pan.baidu.com/s/1bnApHO7

With the alps sticks the range goes from 0.000 - 0.800.
Enlarging the holes of the GPD-G7 case might do the trick to bring the values to 0.000 - 1.000 and use the whole throw of the alps sticks.

Flashing just the kernel.img of this rom and the system.img from G7 V2.01 work.
It seems really related to the kernel.

Do you know which files need to convert the chinese to english or german language?

skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #16 on: July 23, 2018, 09:44:33 am »
In theory the chinese firmware should be multilingual too, usually they only didn't include play store .

If it's only in chinese there is no much to do, because that depends on the framework and that firmware should be recompile from zero. You can try to install an app like more locale to include more languages.
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #17 on: July 23, 2018, 09:19:36 pm »
Just a change in the language settings was needed.

The rom works very well, but a little annoying thing bother me.

With the GPD-G7 Stock 2.0.1 firmware, the GPU Clock Speed is 128 - 446 Mhz.
With the GPD-G7 Stock G7 V4.1.0 chinese firmware, the GPU Clock Speed is just 128 - 297 Mhz.

I tried to overclock with rkpatchomatic tool, the kernel was patched succesfully and boot, but the stock settings dont change.
Is something more needed to get the GPU Clock Speed of 128 - 446 Mhz?




skelton

  • *****
  • Posts: 6811
Re: Compile a Kernel
« Reply #18 on: July 23, 2018, 10:45:43 pm »
RKpatchomatic doesn't work with GPD kernels or most RK3188-t. Also, stock firmware use boot.img as the kernel (it has a kernel inside the boot.img that has preference over kernel.img), not the kernel.img. You will need to unpack boot,img and patch the zImage inside boot,img, but probably won't work, because rkpatchomatic doesn't work with al Rockchip devices, mainly on those that underclock via dvfs and not via frequency tables)
I guess they decided to underclock GPU in latest firmware probably, no idea why, probably it has cpu underclock too like stock firmwares. Nothing you can do except compile from 0. But the source in my github doesn't include latest gamepad driver for g7 or g5a, but I didn't need it either, I personally didn't find issues with my deadzones in both devices.

From the T models I used, only q88 accepted even 600 mhz, though didn't make a big difference in the poor mali400.

https://github.com/skelton/RK3188_TABLET/commit/307d755bd1420fe62e91ff47b5bb81c940bbb56e

.
« Last Edit: July 23, 2018, 10:52:43 pm by skelton »
Retired

AthenaX7500 (OP)

  • *
  • Posts: 53
Re: Compile a Kernel
« Reply #19 on: July 23, 2018, 11:56:54 pm »
I thougt that the GPD-G7 is a RK3188 and not a RK3188-t.

I found this in adc_js.c starting at line 334.

static void scan_joystick_absnormal(struct kp *kp, int channel)
{
   int js_value;

   js_value = kp->value[channel];
   if (js_value >= 0) {
      if ((js_value >= HALF_ADC_MAX - MID_BLIND) && (js_value <= HALF_ADC_MAX + MID_BLIND)) {
         kp->js_value[channel] = 0;
      } else {
         if (js_value <= MINEDG_BLIND)
            js_value = -170;
         else if (js_value >= MAXEDG_BLIND)
            js_value = 169;
         else
            js_value = (js_value - HALF_ADC_MAX) * 3 / 2;
kp->js_value[channel] = js_value;


Before I compile a kernel with value of js_value = 0, could you tell me if its worth a try or if it will make no sense.