[SOLVED] Cross-compiling a custom-kernel for Raspbian PI2; HowTo?
Linux - Embedded & Single-board computerThis forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I identified a pi2 based on
cat /sys/firmware/devicetree/base/model
Quote:
Raspberry Pi Model B Rev 2
I moved the created cross-compiled ZImage to kernel7.img on the /boot/ directory of the pi2 SD card but, after a boot, by making dmesg I see
Quote:
Linux version 5.15.72+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1591 Wed Oct 5 12:01:13 BST 2022
In order for the pi2 to boot with correct kernel, I included in sudo nano /boot/config.txt
...
[pi2]
kernel=kernel7.img
..
If anybody have an explanation why it is not Oct 12 which would be todays time (because the customized kernel7.img was created today oct 12).
Perhaps is the pi2 booting with another kernel?
Last edited by floppy_stuttgart; 10-12-2022 at 02:42 PM.
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2835
Revision : 000e
Serial : 000000002a35d1af
Model : Raspberry Pi Model B Rev 2
I will have to review all my doing. Looks like my thinking of a PI2 was wrong.
Thats a PI1 and it was looking at boot at the kernel.img which was the old one.
Modifying config.txt
... with ...
[pi2]
kernel=kernel7.img
..
was then for sure useless.
Lets redo the whole thing.
Last edited by floppy_stuttgart; 10-12-2022 at 02:59 PM.
The change was that the folks at RazPi stopped using the BCM2836 in the Pi 2 in favour of the BCM2837 which had the A53 core. You can just google for specs.
You want at least the Pi 4 w/8G. If there's a little more cash about, there's an Arm A-72 16 core chip from NXP (runs @2 Ghz). It's built into a tiny server being sold fairly cheap by http://www.solid-run.com in Israel and you can get decent memory for that. Video is not really supplied, however, as it's a server.
Last edited by business_kid; 10-13-2022 at 04:07 AM.
Yes. Its working. Its a PI1 (I have another PI4 where my project is working but would like to make it working on that PI1) and the correct kernel is recognized at boot.
Linux version 5.15.73+ (xxxx) (arm-linux-gnueabihf-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #2 Thu Oct 13 10:55:19 CEST 2022
Now its booting a bit weird and new errors are coming up.
systemd[1]: Failed to start Load Kernel Modules.
systemd[1]: Failed to mount Arbitrary Executable File Formats File System.
mkdir mnt
mkdir mnt/fat32
mkdir mnt/ext4
sudo mount /dev/sdd1 mnt/fat32
sudo mount /dev/sdd2 mnt/ext4
sudo env PATH=$PATH make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install
No errors anymore.
The correct cross-compiled kernel is in use.
End-summary:
- my original assumption was wrong: that was a pi1 instead of a pi2
- cross-compile a kernel for a pi1; after 2 days of compiling, I CTRL-C the local pi1 compilation (on a 6core 64bits linux PC that MUCH better; then I transfered all data onto the SD card)
- the link for cross-compiling had to be followed step by step; missing one step was creating errors
Last edited by floppy_stuttgart; 10-15-2022 at 11:11 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.