kumquat-buildroot/package/rpi-firmware/rpi-firmware.mk

60 lines
2.3 KiB
Makefile
Raw Normal View History

################################################################################
#
# rpi-firmware
#
################################################################################
RPI_FIRMWARE_VERSION = 22d8c910f4c53118f9cf85c038d7d8e307efc110
RPI_FIRMWARE_SITE = $(call github,raspberrypi,firmware,$(RPI_FIRMWARE_VERSION))
RPI_FIRMWARE_LICENSE = BSD-3c
RPI_FIRMWARE_LICENSE_FILES = boot/LICENCE.broadcom
RPI_FIRMWARE_INSTALL_TARGET = NO
RPI_FIRMWARE_INSTALL_IMAGES = YES
RPI_FIRMWARE_DEPENDENCIES += host-rpi-firmware
ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTBS),y)
define RPI_FIRMWARE_INSTALL_DTB
$(INSTALL) -D -m 0644 $(@D)/boot/bcm2708-rpi-b.dtb $(BINARIES_DIR)/rpi-firmware/bcm2708-rpi-b.dtb
$(INSTALL) -D -m 0644 $(@D)/boot/bcm2708-rpi-b-plus.dtb $(BINARIES_DIR)/rpi-firmware/bcm2708-rpi-b-plus.dtb
$(INSTALL) -D -m 0644 $(@D)/boot/bcm2709-rpi-2-b.dtb $(BINARIES_DIR)/rpi-firmware/bcm2709-rpi-2-b.dtb
endef
endif
ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_DTB_OVERLAYS),y)
define RPI_FIRMWARE_INSTALL_DTB_OVERLAYS
for ovldtb in $(@D)/boot/overlays/*.dtb; do \
$(INSTALL) -D -m 0644 $${ovldtb} $(BINARIES_DIR)/rpi-firmware/overlays/$${ovldtb##*/} || exit 1; \
done
endef
endif
ifeq ($(BR2_PACKAGE_RPI_FIRMWARE_INSTALL_VCDBG),y)
define RPI_FIRMWARE_INSTALL_TARGET_CMDS
$(INSTALL) -d -m 0700 $(@D)/$(if BR2_ARM_EABIHF,hardfp/)opt/vc/bin/vcdbg \
$(TARGET_DIR)/usr/sbin/vcdbg
endef
endif # INSTALL_VCDBG
define RPI_FIRMWARE_INSTALL_IMAGES_CMDS
$(INSTALL) -D -m 0644 $(@D)/boot/bootcode.bin $(BINARIES_DIR)/rpi-firmware/bootcode.bin
$(INSTALL) -D -m 0644 $(@D)/boot/start$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).elf $(BINARIES_DIR)/rpi-firmware/start.elf
$(INSTALL) -D -m 0644 $(@D)/boot/fixup$(BR2_PACKAGE_RPI_FIRMWARE_BOOT).dat $(BINARIES_DIR)/rpi-firmware/fixup.dat
$(INSTALL) -D -m 0644 package/rpi-firmware/config.txt $(BINARIES_DIR)/rpi-firmware/config.txt
$(INSTALL) -D -m 0644 package/rpi-firmware/cmdline.txt $(BINARIES_DIR)/rpi-firmware/cmdline.txt
$(RPI_FIRMWARE_INSTALL_DTB)
$(RPI_FIRMWARE_INSTALL_DTB_OVERLAYS)
endef
package/rpi-firmware: add DT-aware marking script The Raspberry Pi can boot a kernel with device tree support. But at the same time, the RPi folks wante to keep the old-fashioned, ATAG-based way of booting (don't ask...). So, the bootloader needs to know whether the kernel it is loading has DT support or not. For that, it looks at the end of the kernel image for a magic footer. If found, it loads a device tree and sets the registers appropriately so that the kernel finds the DTB. If not found, it loads the kernel with the traditional ATAGS. Where it becomes a bit tricky, is that the DTB is different for models A/B and A+/B+ (that is A and B use the same DTB, while the A+ and B+ use a second DTB). The bootloader is capable to load the correct DTB from a specially named file. That is: - on A/B, it loads bcm2708-rpi-b.dtb - on A+/B+, it loads bcm2708-rpi-b-plus.dtb If the DTB is differently named, the bootloader won't find it, will not load any DTB at all, and revert to booting with ATAGS. It is possible to specify what DTB to load, by adding an new config option 'device_tree=file.dtb' in config.txt, but then the firmware on the SDcard is no longer bootable on both the original models and the Plus models. So, add a script that appends the appropriate footer to the kernel image. The script is vampirised from the RPi's tools repository, but a new package is *not* added just for that script: the whole repository is 300+ MiB, and a checkout is 600+ MiB; it is not pertinent to add this as a new package for a script that weights a few KiB... Install that script as a host utility, too. Notes: lots of information is available in this thread on the RPi forums: http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93015 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-01-09 23:46:19 +01:00
# We have no host sources to get, since we already
# bundle the script we want to install.
HOST_RPI_FIRMWARE_SOURCE =
HOST_RPI_FIRMWARE_DEPENDENCIES =
define HOST_RPI_FIRMWARE_INSTALL_CMDS
$(INSTALL) -D -m 0755 package/rpi-firmware/mkknlimg $(HOST_DIR)/usr/bin/mkknlimg
endef
$(eval $(generic-package))
package/rpi-firmware: add DT-aware marking script The Raspberry Pi can boot a kernel with device tree support. But at the same time, the RPi folks wante to keep the old-fashioned, ATAG-based way of booting (don't ask...). So, the bootloader needs to know whether the kernel it is loading has DT support or not. For that, it looks at the end of the kernel image for a magic footer. If found, it loads a device tree and sets the registers appropriately so that the kernel finds the DTB. If not found, it loads the kernel with the traditional ATAGS. Where it becomes a bit tricky, is that the DTB is different for models A/B and A+/B+ (that is A and B use the same DTB, while the A+ and B+ use a second DTB). The bootloader is capable to load the correct DTB from a specially named file. That is: - on A/B, it loads bcm2708-rpi-b.dtb - on A+/B+, it loads bcm2708-rpi-b-plus.dtb If the DTB is differently named, the bootloader won't find it, will not load any DTB at all, and revert to booting with ATAGS. It is possible to specify what DTB to load, by adding an new config option 'device_tree=file.dtb' in config.txt, but then the firmware on the SDcard is no longer bootable on both the original models and the Plus models. So, add a script that appends the appropriate footer to the kernel image. The script is vampirised from the RPi's tools repository, but a new package is *not* added just for that script: the whole repository is 300+ MiB, and a checkout is 600+ MiB; it is not pertinent to add this as a new package for a script that weights a few KiB... Install that script as a host utility, too. Notes: lots of information is available in this thread on the RPi forums: http://www.raspberrypi.org/forums/viewtopic.php?f=29&t=93015 Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-01-09 23:46:19 +01:00
$(eval $(host-generic-package))