Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A64 => Topic started by: Noone on July 15, 2020, 03:18:11 PM

Title: How to install bootable kernel?
Post by: Noone on July 15, 2020, 03:18:11 PM
Hi,

I tried to build new kernel for my boards but I keep failing in the process.

So far I've done:
- Source from https://github.com/OLIMEX/linux-olimex
- make localmodconfig
- make
- make modules_install
- make install
- reboot (until here everything works)
- Last text line is "Booting kernel ..." and after that nothing. After tens of seconds automatic reboot.

I'm using serial connection. I tried also with HDMI but same thing happened. Image in use is A64-OLinuXino-focal-minimal-20200701-190521.

What I'm missing here?

(I can't find instructions pointed in the post "Can I Put A Custom Kernel on the A64?" (https://www.olimex.com/forum/index.php?topic=7500.msg28329#msg28329))

brgs,
-
Title: Re: How to install bootable kernel?
Post by: LubOlimex on July 15, 2020, 03:29:20 PM
I feel you missed this post: https://olimex.wordpress.com/2020/04/21/olimage-mainline-linux-images-building-script-for-all-of-our-olinuxino-and-som-boards/

Check the build.sh and run.sh script here:

https://github.com/OLIMEX/olimage
Title: Re: How to install bootable kernel?
Post by: Noone on July 16, 2020, 04:10:25 PM
Thanks.

I was able to generate new image easily. I couldn't figure out how to change kernel config though. Is it possible somehow?

I would like to compile extra modules with it.

brgs,
-
Title: Re: How to install bootable kernel?
Post by: HeHoPMaJIeH on July 17, 2020, 05:05:37 PM
Hi, you need yo build debian package from sources.
You can use  https://github.com/OLIMEX/linux-olimex/blob/release-20200630-v5.6.14/build-package.sh and install package using dpkg.


~Best
Title: Re: How to install bootable kernel?
Post by: Noone on July 20, 2020, 01:29:16 PM
I tried build-package approach and it's almost working. I had to modify DEFCONFIG="linux-sunxi-olinuxino_defconfig" -> DEFCONFIG="olinuxino_defconfig" since linux-sunxi-olinuxino_defconfig was non-existent.


Compiling goes well but there is a problem when creating package:
-----
.
.
.
 fakeroot -u debian/rules binary
make KERNELRELEASE=5.6.14-olimex ARCH=arm       KBUILD_BUILD_VERSION=kaje -f ./Makefile intdeb-pkg
sh ./scripts/package/builddeb
mkdir: cannot create directory '/lib/modules/5.6.14-olimex/': Permission denied
make[4]: *** [scripts/Makefile.package:87: intdeb-pkg] Error 1
make[3]: *** [Makefile:1425: intdeb-pkg] Error 2
make[2]: *** [debian/rules:9: binary-arch] Error 2
dpkg-buildpackage: error: fakeroot -u debian/rules binary subprocess returned exit status 2
make[1]: *** [scripts/Makefile.package:83: bindeb-pkg] Error 2
make: *** [Makefile:1425: bindeb-pkg] Error 2
-----

Obviously I don't want to install crosscompiled package to the amd64 system. Source tree directories are owned by me and with the default permissions. I'm compiling in Ubuntu 20.04.

What now? I'm still lost.

brgs,
-

Title: Re: How to install bootable kernel?
Post by: kuleszdl on July 20, 2020, 02:36:20 PM
Well, the problem seems to be that the package.sh script installs this stuff to lib which is okay for a "throwaway-CI" system but not for your production machine. :-) Below is the approach I followed to build kernel packages for kernel 5.8-0-rc5.

Get dependencies:

apt install build-essential gcc-aarch64-linux-gnu git unzip

Copy kernel config (looks like you already have one?)
Configure the options you want in your config (e. g. using "make menuconfig", requires a few more libs)

Make sure to set this variable to an empty string (do not uncomment it) in the kernel config file:

CONFIG_SYSTEM_TRUSTED_KEYS=""   

Build the debian package (replace "-j16" by the number of available CPU threads):

make -j16 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg

Then, you should get the deb packages from it and can manually install the main one with "dpkg -i" on your target machine.
Title: Re: How to install bootable kernel?
Post by: kjwiik on August 23, 2021, 03:28:16 PM
Sorry to revive an old thread but the subject fits to my problem exactly.

I compiled a kernel with make bindeb-pkg according to previous message to add some IIO synth drivers, but it does not boot. There seems to be a loop that flashes eth led periodically. Is the default branch in linux-olimex the correct one (release-20210821-v5.10.60)? The board is a20 olinuxino micro.

Thanks,
Kaj
Title: Re: How to install bootable kernel?
Post by: kjwiik on August 25, 2021, 06:59:04 PM
In fact I succeeded in building a bootable kernel after all: the problem was most probably the EHCI boot loop bug. I also noticed a change in the kernel sources and rebuilt the kernel. After that (without any USB device attached) the kernel booted with my modules.

For the record here's my recipe:

git clone https://github.com/OLIMEX/linux-olimex.git

cd linux-olimex

scp a20-olinuxino:/boot/config-5.10.47-olimex .config

make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- oldconfig
make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabihf- menuconfig
(add modules and save)

make -j 6 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bindeb-pkg

Cheers,
Kaj