LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
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


Reply
  Search this Thread
Old 10-12-2022, 12:01 PM   #1
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,155
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
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.
 
Old 10-12-2022, 01:55 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,359

Rep: Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333
did you use sudo? Error 1 is permissions, IIRC.
 
Old 10-12-2022, 02:32 PM   #3
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,155

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
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.
 
Old 10-12-2022, 02:36 PM   #4
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,155

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by business_kid View Post
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..)
 
Old 10-12-2022, 02:48 PM   #5
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,155

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
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.
 
Old 10-13-2022, 04:03 AM   #6
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,359

Rep: Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333Reputation: 2333
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.
 
Old 10-15-2022, 10:44 AM   #7
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,155

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
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.
 
Old 10-15-2022, 11:08 AM   #8
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,155

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
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.
 
  


Reply

Tags
make, raspberry pi 2, raspbian



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Issue installing Wine in Box86 on a raspbian pi2; HowTo? floppy_stuttgart Linux - Embedded & Single-board computer 12 12-07-2022 05:14 AM
[SOLVED] raspbian buster issue with scanning on hp deskjet 2544 in raspberry pi2 printer/scanner server floppy_stuttgart Linux - Embedded & Single-board computer 1 01-17-2021 07:41 PM
LXer: Raspbian GNU/Linux upgrade from Jessie to Raspbian Stretch 9 LXer Syndicated Linux News 0 03-01-2018 07:50 PM
LXer: Raspbian GNU/Linux upgrade from Wheezy to Raspbian Jessie 8 LXer Syndicated Linux News 1 06-09-2016 12:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 02:44 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration