Author Topic: Compile a Kernel  (Read 220 times)

AthenaX7500 (OP)

  • *
  • Posts: 42
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: 6743
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: 42
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: 6743
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: 42
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: 42
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: 6743
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: 42
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: 6743
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: 42
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: 6743
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: 42
Re: Compile a Kernel
« Reply #11 on: July 12, 2018, 03:19:17 pm »
Tanks for this info.
Will try this and reply later.