lukechilds / dockerpi

A Virtualised Raspberry Pi inside a Docker image
MIT License
1.85k stars 193 forks source link

Yocto/Poky support - non-standard kernel file #44

Open HappyDias opened 3 years ago

HappyDias commented 3 years ago

Hi

Thanks first of all for this container image, it's a very useful tool for the lazy (me :grin:), who can't be bothered with setting up QEMU!

I am a relative newbie in the embedded linux space and am trying to leverage this tool to run some automated tests in our ARM based, Raspberry Pi 3 aimed images. We use the Yocto project to create these images which use a different flavor operating system than the one endorsed by the raspberry pi foundation (raspbian), which is why I think I am running into this issue.

As described in the Readme of this repo, I use the following command line to attempt to run a custom Raspberry Pi 3 image:

docker run -it -v /path/to/rpi/image:/sdcard/filesystem.img lukechilds/dockerpi pi3

When running that command I get the following error:

image: /sdcard/filesystem.img
file format: raw
virtual size: 2 GiB (2147483648 bytes)
disk size: 1.12 GiB
Extracting partitions
dd: invalid number '703,3,32'
Extracting boot filesystem
Error: ! Unable to open the input file: /fat.img for reading
Searching for kernel='kernel8.img'
Searching for dtb='bcm2710-rpi-3-b-plus.dtb'
Missing kernel='' or dtb=''

Which makes sense, since when exploring this image via a flashed sd card, I find the following files (apologies for the Windows output format):

 Directory of I:\

2011-04-05  23:00            52,456 bootcode.bin
2011-04-05  23:00                 0 bootfiles-20210527.stamp
2011-04-05  23:00                93 cmdline.txt
2011-04-05  23:00            36,233 config.txt
2011-04-05  23:00             7,314 fixup.dat
2011-04-05  23:00             5,448 fixup4.dat
2011-04-05  23:00             3,191 fixup4cd.dat
2011-04-05  23:00             8,452 fixup4db.dat
2011-04-05  23:00             8,452 fixup4x.dat
2011-04-05  23:00             3,191 fixup_cd.dat
2011-04-05  23:00            10,298 fixup_db.dat
2011-04-05  23:00            10,300 fixup_x.dat
2011-04-05  23:00         2,953,312 start.elf
2011-04-05  23:00         2,229,120 start4.elf
2011-04-05  23:00           793,340 start4cd.elf
2011-04-05  23:00         3,722,664 start4db.elf
2011-04-05  23:00         2,981,480 start4x.elf
2011-04-05  23:00           793,340 start_cd.elf
2011-04-05  23:00         4,794,632 start_db.elf
2011-04-05  23:00         3,705,000 start_x.elf
2011-04-05  23:00            26,093 bcm2708-rpi-zero-w.dtb
2011-04-05  23:00            25,195 bcm2708-rpi-b.dtb
2011-04-05  23:00            25,458 bcm2708-rpi-b-plus.dtb
2011-04-05  23:00            26,333 bcm2709-rpi-2-b.dtb
2011-04-05  23:00            27,980 bcm2710-rpi-3-b.dtb
2011-04-05  23:00            28,599 bcm2710-rpi-3-b-plus.dtb
2011-04-05  23:00            47,516 bcm2711-rpi-4-b.dtb
2011-04-05  23:00            24,928 bcm2708-rpi-cm.dtb
2011-04-05  23:00            26,289 bcm2710-rpi-cm3.dtb
2011-04-05  23:00    <DIR>          overlays
2011-04-05  23:00           479,540 kernel7.img
2011-04-05  23:00               263 boot.scr
2011-04-05  23:00         6,094,312 uImage
2011-04-05  23:00                44 image-version-info
1601-01-01  01:00            16,384 uboot.env

I believe the file that should be 'found' here is kernel7.img which is instead of kernel8.img. Seems like this search is somewhat hardcoded, which makes me think that:

  1. Not possible in current release - I am aware that pi2 & pi3 support is experimental,
  2. Somehow configurable at container startup via something like an environment variable.

So, is it 1. or 2.? :sweat_smile:

Also, if someone with Yocto experience on this container reads this, could you either:

  1. Supply a list of changes required to my image to be supported by this container, and/or,
  2. Supply reading material (please not the Mega-Manual! :weary:) that could help me get to that point?

Here I provide a minimal working image (~400MB download, be warned!), that runs a bare bones distribution, without our private code. This image file can be:

  1. Used as the custom image file in the docker command to reproduce this issue
  2. Flashed onto an SD card and tested in a physical Raspberry Pi 3 to ensure it works (I tried it) - just sign is as root (no password).

Thanks for reading this if you got this far, please let me know if I have not explained myself enough (I tend to ramble :sweat_smile:) and/or if you have any issue collecting the image file for testing.

Regards

tajnymag commented 2 days ago

Ubuntu Server 24.04.1 also fails to boot due to the same error