Linux - Embedded & Single-board computer This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
10-12-2022, 12:01 PM
|
#1
|
Senior Member
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,186
Rep: 
|
Cross-compiling a custom-kernel for Raspbian PI2; HowTo?
Hello,
according this https://www.raspberrypi.com/document...ux_kernel.html
I am trying to cross-compile a new custom-kernel for my pi2 (3G/1G instead of the standard 2G/2G).
sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev
sudo apt install crossbuild-essential-armhf
git clone --depth=1 https://github.com/raspberrypi/linux
make bcm2709_defconfig
give the error..
Quote:
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTLD scripts/kconfig/conf
***
*** Can't find default configuration "arch/x86/configs/bcm2709_defconfig"!
***
make[1]: *** [scripts/kconfig/Makefile:94: bcm2709_defconfig] Fehler 1
make: *** [Makefile:619: bcm2709_defconfig] Fehler 2
|
I suppose I have to get the .config file from the raspberry pi2 and store it locally where I am in the cross-compiler. Correct ?
Or there is any other method to create that .config file for my pi2 locally on my cross-compiler (debian11 64bits desktop) ?
How?
Any hint and support is welcome.
UPDATE:
the command above was wrong. A new command seems ok. I will close in few hours if all fine.
Code:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
Code:
#
# configuration written to .config
#
Last edited by floppy_stuttgart; 10-12-2022 at 12:07 PM.
|
|
|
10-12-2022, 01:55 PM
|
#2
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,529
|
did you use sudo? Error 1 is permissions, IIRC.
|
|
|
10-12-2022, 02:32 PM
|
#3
|
Senior Member
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,186
Original Poster
Rep: 
|
So far, it cross-compiled.
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.
|
|
|
10-12-2022, 02:36 PM
|
#4
|
Senior Member
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,186
Original Poster
Rep: 
|
Quote:
Originally Posted by business_kid
did you use sudo? Error 1 is permissions, IIRC.
|
No.
In fact, I used wrongly
Code:
make bcm2709_defconfig
instead of
Code:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
(both local user compiling in an area /home/user/Downloads/linux..)
|
|
|
10-12-2022, 02:48 PM
|
#5
|
Senior Member
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,186
Original Poster
Rep: 
|
Or perhaps this is a PI1 ? I am confused..
cat /proc/cpuinfo
Quote:
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
|
according this
https://linuxhint.com/identify-raspberry-pi/
the BCM2835 is a PI1 with 2x USB. Which is the case.
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.
|
|
|
10-13-2022, 04:03 AM
|
#6
|
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 17,529
|
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.
|
|
|
10-15-2022, 10:44 AM
|
#7
|
Senior Member
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,186
Original Poster
Rep: 
|
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.
I missed something at the install recommend https://www.raspberrypi.com/document...ux_kernel.html
Quote:
sudo env PATH=$PATH make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=mnt/ext4 modules_install
|
I must see how to adapt it to my setup.
|
|
|
10-15-2022, 11:08 AM
|
#8
|
Senior Member
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,186
Original Poster
Rep: 
|
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.
|
|
|
All times are GMT -5. The time now is 03:08 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.
|
Latest Threads
LQ News
|
|