Raspberry Pi: Input file is not a valid disk image

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
Sammyueru
Posts: 6
Joined: Wed Jun 09, 2021 2:25 pm

Raspberry Pi: Input file is not a valid disk image

Post by Sammyueru »

Hello,
I have been creating a OS for the raspberry pi but whenever I put the .img file into the raspberry pi imager I get this error:

Code: Select all

Input file is not a valid disk image.
File size 532516 bytes is not a multiple of 512 bytes.
I have been using the gcc cross compiler for aarch64 and I'm trying to compile to the Raspberry Pi 4.
If you need more information please just ask.
Anyways thanks in advance.
-Sam()

Code: Select all

{
    Programmer();
}
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Raspberry Pi: Input file is not a valid disk image

Post by Octocontrabass »

The Raspberry Pi imager expects a complete disk image, not just a kernel image.

If all you have is a kernel image, you'll need to prepare an SD card with an appropriate boot partition and boot files, then copy your kernel image into that partition.
User avatar
Sammyueru
Posts: 6
Joined: Wed Jun 09, 2021 2:25 pm

Re: Raspberry Pi: Input file is not a valid disk image

Post by Sammyueru »

Octocontrabass wrote:The Raspberry Pi imager expects a complete disk image, not just a kernel image.

If all you have is a kernel image, you'll need to prepare an SD card with an appropriate boot partition and boot files, then copy your kernel image into that partition.
Sorry but how would I go about doing that?
-Sam()

Code: Select all

{
    Programmer();
}
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Raspberry Pi: Input file is not a valid disk image

Post by Octocontrabass »

Create a FAT32 partition if one doesn't already exist, download the necessary boot files, and copy everything necessary over to the FAT32 partition. If your SD card is 32GB or less, it should already be partitioned in a way that will work, since that's the standard for SDHC.

The information on the wiki is not always the most up-to-date, so I suggest looking at the official documentation for which files you need instead of using the list on the wiki.
Post Reply