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
Re: make ... modules_install doesn't copy Linux to SD card
Did you continue after that line?
"Next, install the kernel modules onto the SD card:"
"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
Re: make ... modules_install doesn't copy Linux to SD card
No, I didn't continue.Did you continue after that line?
"Next, install the kernel modules onto the SD card:"
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.
Re: make ... modules_install doesn't copy Linux to SD card
From the instructions just above those commandscrane wrote: ↑Sat Jan 28, 2023 7:26 pmNo, I didn't continue.Did you continue after that line?
"Next, install the kernel modules onto the SD card:"
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.
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.Finally, copy the kernel and Device Tree blobs onto the SD card, making sure to back up your old 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!
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!
Re: make ... modules_install doesn't copy Linux to SD card
Ok, that makes sense.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.
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.
Re: make ... modules_install doesn't copy Linux to SD card
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!
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!
Re: make ... modules_install doesn't copy Linux to SD card
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.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).
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.
Re: make ... modules_install doesn't copy Linux to SD card
If you followed the instructions you started with
Code: Select all
git clone --depth=1 https://github.com/raspberrypi/linux
cd linux
Code: Select all
mkdir mnt
mkdir mnt/fat32
mkdir mnt/ext4
sudo mount /dev/sdb1 mnt/fat32
sudo mount /dev/sdb2 mnt/ext4
Re: make ... modules_install doesn't copy Linux to SD card
Yes, you are right. The mount folder doesn't match the one created before. It ends up being my mistake as always:-)So mnt should be under your current working directory linux and mnt/ext4 is correct as it should not be mounted at /mnt/ext4
Thanks Undertow!