crane
Posts: 22
Joined: Thu Dec 22, 2022 3:10 am

make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 5:27 pm

Hello,

I am following the instructions on this page to build a Linux for Raspberry Pi 4B:
https://www.raspberrypi.com/documentati ... ernel.html

After running the below command, the Linux is not copied to the SD card.
sudo env PATH=$PATH make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/ext4 modules_install
The SD card has one 256M boot partition FAT32 and a rootfs partition of EXT4. The command runs for a few minutes and there is information shown on the screen. But when it's done, it seems nothing happened.

I did the process before and it did copy. But this time, it didn't copy at all. Did I missing anything?
I tried to open Makefile to check if there is anything wrong. It is obviously too hard for me to understand.
Is it possible something wrong with the SD card? I uses the same card last time.

Appreciate any input for this issue!

Thanks!
Crane

pidd
Posts: 4522
Joined: Fri May 29, 2020 8:29 pm
Location: Wirral, UK

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 6:40 pm

Did you continue after that line?

"Next, install the kernel modules onto the SD card:"

Code: Select all

sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
sudo cp arch/arm64/boot/Image mnt/fat32/$KERNEL.img
sudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/fat32/
sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
sudo cp arch/arm64/boot/dts/overlays/README mnt/fat32/overlays/
sudo umount mnt/fat32
sudo umount mnt/ext4

crane
Posts: 22
Joined: Thu Dec 22, 2022 3:10 am

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 7:26 pm

Did you continue after that line?

"Next, install the kernel modules onto the SD card:"
No, I didn't continue.

From the command "sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img", suppose Linux kernel image is already on the SD card boot partition. I don't think it will make sense to continue.

User avatar
Paeryn
Posts: 3540
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 8:33 pm

crane wrote:
Sat Jan 28, 2023 7:26 pm
Did you continue after that line?

"Next, install the kernel modules onto the SD card:"
No, I didn't continue.

From the command "sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img", suppose Linux kernel image is already on the SD card boot partition. I don't think it will make sense to continue.
From the instructions just above those commands
Finally, copy the kernel and Device Tree blobs onto the SD card, making sure to back up your old kernel:
That first command is the "making sure to backup your old kernel", the instructions are given assuming you are updating an existing kernel. If you haven't got an existing kernel on the card then you obviously don't do any lines that are involved in backing up an existing system.
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

crane
Posts: 22
Joined: Thu Dec 22, 2022 3:10 am

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 9:11 pm

That first command is the "making sure to backup your old kernel", the instructions are given assuming you are updating an existing kernel. If you haven't got an existing kernel on the card then you obviously don't do any lines that are involved in backing up an existing system.
Ok, that makes sense.

sudo cp mnt/fat32/$KERNEL.img mnt/fat32/$KERNEL-backup.img
sudo cp arch/arm64/boot/Image mnt/fat32/$KERNEL.img
sudo cp arch/arm64/boot/dts/broadcom/*.dtb mnt/fat32/
sudo cp arch/arm64/boot/dts/overlays/*.dtb* mnt/fat32/overlays/
sudo cp arch/arm64/boot/dts/overlays/README mnt/fat32/overlays/

The reason I didn't continue is also because of this: Even if I did the next four commands and copied the kernel image and device tree blobs, those will be the only files on the SD card and nothing else. It won't be able to boot.

User avatar
Paeryn
Posts: 3540
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 9:59 pm

crane wrote:
Sat Jan 28, 2023 9:11 pm
The reason I didn't continue is also because of this: Even if I did the next four commands and copied the kernel image and device tree blobs, those will be the only files on the SD card and nothing else. It won't be able to boot.
You've built and installed the kernel, that is all that page is about. The kernel is just part of an OS, you need to build all the non-kernel parts as well like libraries and programs if you want a fully working OS (or copy & configure them from an existing distro, though some bits might not work fully if your kernel isn't built with the same features of the donor distro's kernel).
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

crane
Posts: 22
Joined: Thu Dec 22, 2022 3:10 am

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 10:59 pm

You've built and installed the kernel, that is all that page is about. The kernel is just part of an OS, you need to build all the non-kernel parts as well like libraries and programs if you want a fully working OS (or copy & configure them from an existing distro, though some bits might not work fully if your kernel isn't built with the same features of the donor distro's kernel).
Thank you Paeryn. Your words reminded me that what this page says is just to update the Linux kernel, not build a OS from scratch.

I found the problem with the command:
sudo env PATH=$PATH make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/ext4 modules_install

"INSTALL_MOD_PATH=mnt/ext4" should be "INSTALL_MOD_PATH=/mnt/ext4"
It is an error there.

Undertow
Posts: 323
Joined: Thu Feb 18, 2021 2:00 pm

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 11:10 pm

crane wrote:
Sat Jan 28, 2023 10:59 pm

I found the problem with the command:
sudo env PATH=$PATH make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- INSTALL_MOD_PATH=mnt/ext4 modules_install

"INSTALL_MOD_PATH=mnt/ext4" should be "INSTALL_MOD_PATH=/mnt/ext4"
It is an error there.
If you followed the instructions you started with

Code: Select all

git clone --depth=1 https://github.com/raspberrypi/linux
cd linux
Then later

Code: Select all

mkdir mnt
mkdir mnt/fat32
mkdir mnt/ext4
sudo mount /dev/sdb1 mnt/fat32
sudo mount /dev/sdb2 mnt/ext4
So mnt should be under your current working directory linux and mnt/ext4 is correct as it should not be mounted at /mnt/ext4

crane
Posts: 22
Joined: Thu Dec 22, 2022 3:10 am

Re: make ... modules_install doesn't copy Linux to SD card

Sat Jan 28, 2023 11:49 pm

So mnt should be under your current working directory linux and mnt/ext4 is correct as it should not be mounted at /mnt/ext4
Yes, you are right. The mount folder doesn't match the one created before. It ends up being my mistake as always:-)
Thanks Undertow!

Return to “Troubleshooting”