How to install bootable kernel?

Started by Noone, July 15, 2020, 03:18:11 PM

Previous topic - Next topic

Noone

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?")

brgs,
-

LubOlimex

Technical support and documentation manager at Olimex

Noone

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,
-

HeHoPMaJIeH

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

Noone

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,
-


kuleszdl

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.

kjwiik

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

kjwiik

#7
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