openwrt/package/kernel/ubootenv-nvram/Makefile
Bjørn Mork b2e810f495 kernel: ubootenv-nvram: driver for RAM backed environments
The vendor U-Boot implementaion on Telenor branded ZyXEL EX5700
devices does not store its environment on flash. It is instead
kept in a memory region.  This is persistent over reboots, but
not over power cycling.

The dual partition failsafe system used by the vendor U-Boot
requires the OS to modify a variable in this memory environment.
This driver allows the ordinary uboot-envtools to access a
memory region like it was a partition on NOR flash.

The specific vendor U-Boot adds a "no-map" /reserved-memory
section and a top level /ubootenv node pointing to the memory
environment.  The driver uses this device specific fact to
locate the region.  The matching and probing code will likely
have to be adjusted for any other devices to be supported.

Example partial device tree:

 / {
    ..
    ubootenv {
        memory-region = <&uenv>;
        compatible = "ubootenv";
    };
    ..
    reserved-memory {
        ..
        uenv: ubootenv@7ffe8000 {
            no-map;
            reg = <0 0x7ffe8000 0 0x4000>;
        };

Signed-off-by: Bjørn Mork <bjorn@mork.no>
2023-08-20 01:14:06 +02:00

31 lines
803 B
Makefile

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ubootenv-nvram
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
include $(INCLUDE_DIR)/package.mk
define KernelPackage/ubootenv-nvram
SUBMENU:=Other modules
TITLE:=NVRAM environment for uboot-envtools
FILES:=$(PKG_BUILD_DIR)/ubootenv-nvram.ko
AUTOLOAD:=$(call AutoLoad,30,ubootenv-nvram,1)
KCONFIG:=
endef
define KernelPackage/ubootenv-nvram/description
Support vendor modified U-Boot storing the environment
in RAM. This driver exports the environment memory
region as a misc device named "ubootenv", pretending
it is a NOR mtd device to let existing userspace tools
work without modifications.
endef
define Build/Compile
$(KERNEL_MAKE) M="$(PKG_BUILD_DIR)" modules
endef
$(eval $(call KernelPackage,ubootenv-nvram))