CaptChrisD

CaptChrisD

I am working on a custom device tree overlay. I have done these for years on BBB but when trying to do it on a Raspberry Pi I am running into some trouble.

I use Buildroot packages to do this so it is nicely contained.

On the BBB in my Makefile I have:

define MM_FSERIES_DTS_INSTALL_TARGET_CMDS
cp $(@D)/*.dtbo $(TARGET_DIR)/lib/firmware
endef

On the Raspberry pi I have tried to place it in the same path as the other overlays are by default:

define MM_FSERIES_DTS_INSTALL_TARGET_CMDS
cp $(@D)/*.dtbo $(TARGET_DIR)/images/rpi-firmware/overlays/
endef

I tried leaving it in the ./package/ dir:

define SV_GATEWAY_DTS_INSTALL_TARGET_CMDS
cp $(@D)/*.dtbo $(NERVES_DEFCONFIG_DIR)/package/sv-gateway-dts/
endef

Either way I cannot get fwup to find the file with an error like: fwup: can’t open path ‘$(NERVES_SYSTEM)/images/rpi-firmware/overlays/sv-gateway-01.dtbo’ in file-resource ‘sv-gateway-01.dtbo’

Anyone created custom overlays for Pi systems willing to let me in on the correct incantation?

Showing Posts 1 to 5

CaptChrisD

CaptChrisD OP

It appears the issue may be that the package is not compiling…

I am doing everything the same as when adding a custom package to a BBB system. Since there are no custom Buildroot packages already in a Pi system is there an extra step?

I created:
package directory
added source “$NERVES_DEFCONFIG_DIR/package/extra-leds-dts/Config.in” to Config.in
I even added package to package_files/0 in the mix.exs file to make sure it was used in the hash
I am using the same package layout as I am on the BBB just changing the dts file to be Pi specific

I am seeing the package appear in the menuconfig and selecting it is adding it to nerves_defconfig but when conducting the compile I don’t see it in the list with all the legal info gathering like I do in the BBB system.

fhunleth

fhunleth

Co-author of Nerves

Without seeing the code, it’s hard to say for sure, but my bet is that there’s a typo in the extra-leds-dts.mk file since I do that frequently. Maybe run make extra-leds-dts-rebuild to see or look for the build directory.

Having said that, I have a couple things:

  1. If you want the dtbo to be in the images directory, check out the Buildroot docs for $(BINARIES_DIR), but I’d copy to a different directory from the rpi-firmware package’s output directory. I’d probably just put it in the root images directory if it’s only one file.
  2. If you want the Raspberry Pi bootloader to load the dtbo, you’ll need to update the config.txt as well. That seems to be the path you’re going down.
  3. If your extra LEDs can wait to be initialized at runtime, I’d load the overlay at runtime using the dtoverlay program. I’d also compile your overlay as part of your Elixir project and put the .dtbo in a priv directory so there’s nothing you need to do with Buildroot or Nerves Systems at all.

Hope that helps.

CaptChrisD

CaptChrisD OP

Update:

I am able to compile now but still can’t get the dtbo file to land somewhere I can use it.

To enable compiling I had to add external.mk to the nerves system like the bbb system has.

So the outstanding issue is getting

define MM_FSERIES_DTS_INSTALL_TARGET_CMDS
cp $(@D)/*.dtbo $(TARGET_DIR)/images/rpi-firmware/overlays/
endef

The TARGET_DIR is not appropriate but cannot figure out what variable to use

lawik

lawik

Nerves Core Team

did you try BINARIES_DIR that Frank mentioned? That’s the images dir typically in my experience :slight_smile:

CaptChrisD

CaptChrisD OP

Finally got this working. Thanks @fhunleth for the assistance on finding the correct variable.

To make this work you have to:

  1. add external.mk file to the root of your pi system
# Include system-specific packages
include $(sort $(wildcard $(NERVES_DEFCONFIG_DIR)/package/*/*.mk))
  1. Create package dir at the root of your pi system
  2. Create your Buildroot Package (See nerves_system_bbb for an example)
  3. Add package to package_files/0 in the mix.exs file. When changes in the version occur it will be rebuilt.
  4. Add your custom package to nerves_defconfig
  5. Update your fwup.conf to include the new dtbo (see below)
  6. Update your config.txt to load the new overlay

Here is a complete Makefile for a custom device tree overlay

#############################################################
#
# custom-dts
#
#############################################################

# Remember to bump the version when anything changes in this
# directory.
CUSTOM_DTS_SOURCE =
CUSTOM_DTS_VERSION = 0.1.0
CUSTOM_DTS_DEPENDENCIES = host-dtc

define CUSTOM_DTS_BUILD_CMDS
	cp $(NERVES_DEFCONFIG_DIR)/package/custom-dts/*.dts* $(@D)
        for filename in $(@D)/*.dts; do \
            $(CPP) -I$(@D) -I $(LINUX_SRCDIR)include -I $(LINUX_SRCDIR)arch -nostdinc -undef -D__DTS__ -x assembler-with-cpp $$filename | \
              $(HOST_DIR)/usr/bin/dtc -Wno-unit_address_vs_reg -@ -I dts -O dtb -b 0 -o $${filename%.dts}.dtbo || exit 1; \
        done
endef

define CUSTOM_DTS_INSTALL_TARGET_CMDS
        cp $(@D)/*.dtbo $(BINARIES_DIR)/rpi-firmware/overlays/
endef


$(eval $(generic-package))

Then in your fwup.conf file you can access this file with

file-resource custom.dtbo {
    host-path = "${NERVES_SYSTEM}/images/rpi-firmware/overlays/custom.dtbo"
}

Then in your config.txt add: dtoverlay=custom

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
ChrisAmelia
I’ve got trouble wrapping my head around the order in which functions are called in this snippet (from Phoenix’s authentication): toke...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
dillonoconnor
Is there any way to avoid the Hologram compiler running when using iex? It seems like the front-end code could potentially be disregarded...
New
thiagogsr
** (ArgumentError) expected :max_attempts to be a positive integer, got: {:@, [line: 10, column: 19], [{:max_attempts, [line: 10, column:...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
georgeguimaraes
Just published claude-code-elixir, a plugin marketplace for Claude Code with Elixir support. These are the plugins I’ve been using for my...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews