yoav64
Posts: 2
Joined: Wed Jul 01, 2020 4:29 am

Build Linux image for Raspberry Pi Model B

Wed Jul 01, 2020 5:34 am

Hello guys,

I have an old Raspberry Pi Model B board, that I purchased seven years ago.
Both OpenElec media center and Raspbian Linux prebuilt images were installed on different SD cards and work fine.
I DID NOT use NOOBS, therefore - my SD card consists of only two partitions, the first one is named "boot" and the other one is "ext4"

Then, I issued the following steps in order to build the Linux image by using git repository's contents:
==================================================================================
I used the following instructions as appearing in https://www.raspberrypi.org/documentati ... uilding.md - using the cross compiler
Remove all the contents from "boot" and "ext4" partitions.
>sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev
>git clone https://github.com/raspberrypi/tools ~/tools
>git clone --depth=1 https://github.com/raspberrypi/linux
I also cloned the following in order to get the files used by the GPU:
>git clone https://github.com/raspberrypi/firmware.git

>cd linux
>KERNEL=kernel
>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcmrpi_defconfig
>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs

>sudo env PATH=$PATH make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/media/yoav64/ext4 modules_install
>sudo cp arch/arm/boot/zImage /media/yoav64/boot/$KERNEL.img
>sudo cp arch/arm/boot/dts/*.dtb /media/yoav64/boot/
>sudo cp arch/arm/boot/dts/overlays/*.dtb* /media/yoav64/boot/overlays/
>sudo cp arch/arm/boot/dts/overlays/README /media/yoav64/boot/overlays/
And added the files used by the GPU:
>sudo cp ../firmware/boot/*.dat /media/yoav64/boot/
>sudo cp ../firmware/boot/*.bin /media/yoav64/boot/
>sudo cp ../firmware/boot/start.elf /media/yoav64/boot/
>sudo cp ../firmware/boot/start_x.elf /media/yoav64/boot/

The Raspberry Pi model B was powered up - and looked as if it's working fine. The video worked fine, and I managed to communicate with the board using ssh.

The problem:
===========
But, it seems to me that some behavior of the kernel was weird - using the dmesg dumps. It seems that the probe routines of loadable drivers were not called - though their compatible ID was matching the device tree ( I added printk to check it).

My questions:
============
Am I using the correct repository?
Is the process I've followed correct?
Is bcmrpi_defconfig the correct configuration? Trying to use bcm2835_defconfig made it worse - the boot process was not completed and nothing was displayed on the screen - just a rainbow of colors.
Should I put more effort on that? Maybe the mission I took was impossible?

Thank you all,
Yoav Segal

yoav64
Posts: 2
Joined: Wed Jul 01, 2020 4:29 am

Re: Build Linux image for Raspberry Pi Model B

Wed Jul 01, 2020 12:11 pm

Guys,
Thank you all for watching this post.

Just found the solution.
Started everything again from scratch - based on the https://elinux.org/Raspberry_Pi_Kernel_Compilation.
This site is not an easy one to access.

So, here is what I did to build the kernel:
git init
git clone --depth 1 git://github.com/raspberrypi/linux.git
cd linux
git init
git fetch git://github.com/raspberrypi/linux.git rpi-3.6.y:refs/remotes/origin/rpi-3.6.y
git checkout -b rpi-3.6.y
cp arch/arm/configs/bcmrpi_defconfig .config
export CCPREFIX=arm-linux-gnueabihf-
make ARCH=arm CROSS_COMPILE=${CCPREFIX} -
zImage and the modules were built. The zImage is working well on the RaspberryPi Model B platform

Since this is a very old version - no device trees are used. So, it is absolutely different then newer platform.
I used the *.txt, *.elf and *.bin files from the original image.

So, the issue is closed.

ejolson
Posts: 5128
Joined: Tue Mar 18, 2014 11:47 am

Re: Build Linux image for Raspberry Pi Model B

Wed Jul 01, 2020 5:23 pm

What advantages do you see with the 3.x kernel and the older Pi compared to just installing the latest version of the official Raspberry Pi OS?

Return to “General discussion”