[Nix-dev] Raspberry-Pi NixOS
Tomas Hlavaty
tom at logand.com
Tue Jul 19 23:53:59 CEST 2016
Lluís Batlle i Rossell <viric at viric.name> writes:
> The device tree blob should be built by the kernel, like with pi and pi2,
> isn't it?
This is the kernel which works for me and is taken from
raspberry-firmware/boot:
Linux version 4.4.13-v7+ (dc4 at dc4-XPS13-9333) (gcc version 4.9.3
(crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #894 SMP Mon Jun 13
13:13:27 BST 2016
and the corresponding device tree is bcm2710-rpi-3-b.dtb.
This looks like the same kernel version in
pkgs/os-specific/linux/kernel/linux-rpi.nix (modDirVersion = "4.4.13";
tag = "1.20160620-1")
Are you saying that this is not good enough?
What works: If I copy files from raspberry-firmware/boot to /boot, rpi3
starts fine. These are the files I have in /boot:
$ ls -al /boot
-rwxr-xr-x 1 root root 13221 Jun 18 22:31 bcm2708-rpi-b.dtb
-rwxr-xr-x 1 root root 13484 Jun 18 22:31 bcm2708-rpi-b-plus.dtb
-rwxr-xr-x 1 root root 13257 Jun 18 22:31 bcm2708-rpi-cm.dtb
-rwxr-xr-x 1 root root 14567 Jun 18 22:31 bcm2709-rpi-2-b.dtb
-rwxr-xr-x 1 root root 15237 Jun 18 22:31 bcm2710-rpi-3-b.dtb
-rwxr-xr-x 1 root root 17932 Jun 18 22:31 bootcode.bin
-rwxr-xr-x 1 root root 165 Jul 19 22:46 cmdline.txt
-rwxr-xr-x 1 root root 1369 Jan 11 2016 config.txt
-rwxr-xr-x 1 root root 2504 Jun 23 20:42 fixup_cd.dat
-rwxr-xr-x 1 root root 6482 Jun 23 20:42 fixup.dat
-rwxr-xr-x 1 root root 9717 Jun 23 20:42 fixup_db.dat
-rwxr-xr-x 1 root root 9717 Jun 23 20:42 fixup_x.dat
-rwxr-xr-x 1 root root 4224232 Jun 18 22:31 kernel7.img
drwxr-xr-x 2 root root 8192 Jun 18 22:31 overlays
-rwxr-xr-x 1 root root 617432 Jun 23 20:42 start_cd.elf
-rwxr-xr-x 1 root root 4926264 Jun 23 20:42 start_db.elf
-rwxr-xr-x 1 root root 2746552 Jun 23 20:42 start.elf
-rwxr-xr-x 1 root root 3877720 Jun 23 20:42 start_x.elf
I don't see, why raspberrypi/builder.sh creates defaultgeneration,
initrd and nixos-init files in /boot. It actually seems to me, that
initrd should not be there at all for the boot to work.
raspberrypi/builder.sh doesn't create fixup_x.dat, which is in the list
above; but I haven't tried booting without it.
Although pkgs/os-specific/linux/kernel/linux-rpi.nix copies DTB files,
it renames them to something that looks wrong and also it does not copy
them to /boot at all:
# I am not sure if all of these are correct...
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b.dtb
copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-b-rev2.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-a-plus.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus.dtb
copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-zero.dtb
copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
I looks like the files in raspberry-firmware/boot should work on any rpi
version so we should probably immitate that somehow in nixos and at
least get it to work out of the box even if we just take the precompiled
files from raspberrypi-firmware/boot and improve that later.
More information about the nix-dev
mailing list