[PATCH] sunxi: enable CONFIG_NVMEM_SYSFS

Robert Marko robimarko at gmail.com
Fri Dec 30 08:47:45 PST 2022


On Fri, 30 Dec 2022 at 03:41, Jan-Niklas Burfeind <git at aiyionpri.me> wrote:
>
> in both the stable and the testing kernel
>
> h2+/h3/h5 devices have a Secure ID that can be read from
> `/sys/bus/nvmem/devices/sunxi-sid0/nvmem`.
> Enabling CONFIG_NVMEM_SYSFS grants sysfs access from userspace.
>
> Signed-off-by: Jan-Niklas Burfeind <git at aiyionpri.me>
> ---
> Hauke suggested enabling it for the whole sunxi target, as all devices
> either have enough onboard or external memory to cope with the
> additional 5KB.
>
> @robimarko
> I split off the the changes into two commits which can be found here:
> https://github.com/openwrt/openwrt/compare/master...AiyionPrime:openwrt:sunxi-nvmem_sysfs
>
> I've left the first commit including all unrelated kernel settings aside,
> due to build failures.

Something is rather broken in your build environment to get that diff,
I just tried refreshing
sunxi generic config and A7 config and the diff is minimal and it builds fine:
diff --git a/target/linux/sunxi/config-5.10 b/target/linux/sunxi/config-5.10
index caac9e1436..4ce089b53c 100644
--- a/target/linux/sunxi/config-5.10
+++ b/target/linux/sunxi/config-5.10
@@ -113,6 +113,7 @@ CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG=y
 # CONFIG_CRYPTO_DEV_SUN8I_CE is not set
 # CONFIG_CRYPTO_DEV_SUN8I_SS is not set
 CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
 CONFIG_CRYPTO_LIB_DES=y
 CONFIG_CRYPTO_MD5=y
 CONFIG_CRYPTO_RNG=y
@@ -177,6 +178,7 @@ CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
 CONFIG_GENERIC_CPU_AUTOPROBE=y
+CONFIG_GENERIC_CPU_VULNERABILITIES=y
 CONFIG_GENERIC_EARLY_IOREMAP=y
 CONFIG_GENERIC_GETTIMEOFDAY=y
 CONFIG_GENERIC_IDLE_POLL_SETUP=y
@@ -385,8 +387,6 @@ CONFIG_RESET_SUNXI=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
-CONFIG_SATA_HOST=y
-CONFIG_SATA_PMP=y
 CONFIG_SCSI=y
 CONFIG_SDIO_UART=y
 CONFIG_SECURITYFS=y
@@ -495,8 +495,6 @@ CONFIG_VFPv3=y
 CONFIG_VHOST=y
 CONFIG_VHOST_IOTLB=y
 CONFIG_VHOST_NET=y
-# CONFIG_VIDEO_SUN4I_CSI is not set
-# CONFIG_VIDEO_SUN6I_CSI is not set
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_VT=y
 CONFIG_VT_CONSOLE=y
diff --git a/target/linux/sunxi/cortexa7/config-5.10
b/target/linux/sunxi/cortexa7/config-5.10
index 90e977b566..553770d6ba 100644
--- a/target/linux/sunxi/cortexa7/config-5.10
+++ b/target/linux/sunxi/cortexa7/config-5.10
@@ -1,7 +1,6 @@
 CONFIG_B53=y
 CONFIG_B53_MDIO_DRIVER=y
 CONFIG_CRYPTO_BLAKE2S=y
-CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC=y
 CONFIG_DWMAC_SUN8I=y
 CONFIG_GRO_CELLS=y
 # CONFIG_MACH_SUN4I is not set
@@ -17,7 +16,6 @@ CONFIG_NET_DSA_TAG_BRCM_LEGACY=y
 CONFIG_NET_DSA_TAG_BRCM_PREPEND=y
 CONFIG_NET_SWITCHDEV=y
 CONFIG_NOP_USB_XCEIV=y
-CONFIG_RTC_DRV_SUN6I=y
 CONFIG_USB_MUSB_DUAL_ROLE=y
 # CONFIG_USB_MUSB_GADGET is not set
 CONFIG_USB_MUSB_HDRC=y

Regards,
Robert
>
> It works as expected, tested on a NanoPi R1.
> Path exists and is readable.
> Thanks again for all the help, I hope this is done correctly.
>
> Jan-Niklas
>
>  target/linux/sunxi/config-5.10           | 1 +
>  target/linux/sunxi/config-5.15           | 1 +
>  target/linux/sunxi/cortexa53/config-5.15 | 1 -
>  3 files changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/linux/sunxi/config-5.10 b/target/linux/sunxi/config-5.10
> index caac9e1436..84645141fb 100644
> --- a/target/linux/sunxi/config-5.10
> +++ b/target/linux/sunxi/config-5.10
> @@ -301,6 +301,7 @@ CONFIG_NO_HZ_IDLE=y
>  CONFIG_NR_CPUS=8
>  CONFIG_NVMEM=y
>  CONFIG_NVMEM_SUNXI_SID=y
> +CONFIG_NVMEM_SYSFS=y
>  CONFIG_OF=y
>  CONFIG_OF_ADDRESS=y
>  CONFIG_OF_EARLY_FLATTREE=y
> diff --git a/target/linux/sunxi/config-5.15 b/target/linux/sunxi/config-5.15
> index c7dbc5a9f1..17c4d910c8 100644
> --- a/target/linux/sunxi/config-5.15
> +++ b/target/linux/sunxi/config-5.15
> @@ -307,6 +307,7 @@ CONFIG_NO_HZ_IDLE=y
>  CONFIG_NR_CPUS=8
>  CONFIG_NVMEM=y
>  CONFIG_NVMEM_SUNXI_SID=y
> +CONFIG_NVMEM_SYSFS=y
>  CONFIG_OF=y
>  CONFIG_OF_ADDRESS=y
>  CONFIG_OF_EARLY_FLATTREE=y
> diff --git a/target/linux/sunxi/cortexa53/config-5.15 b/target/linux/sunxi/cortexa53/config-5.15
> index b93abf0765..85ace5d928 100644
> --- a/target/linux/sunxi/cortexa53/config-5.15
> +++ b/target/linux/sunxi/cortexa53/config-5.15
> @@ -52,7 +52,6 @@ CONFIG_MUSB_PIO_ONLY=y
>  CONFIG_NEED_SG_DMA_LENGTH=y
>  CONFIG_NOP_USB_XCEIV=y
>  CONFIG_NO_IOPORT_MAP=y
> -CONFIG_NVMEM_SYSFS=y
>  CONFIG_PARTITION_PERCPU=y
>  CONFIG_PHY_SUN50I_USB3=y
>  CONFIG_PINCTRL_SUN50I_A100=y
> --
> 2.39.0
>



More information about the openwrt-devel mailing list