I am aware that ad74413r
is a very specific device. I'm very new to this, and this is for a very important project. it's driving me a little crazy that I can't figure out how to do this. I don't want to come across as ill read. I'm asking because I want to learn. I'll have so far is a Makefile that I think will work but I'm not figuring out how to register this as a package in the openwrt package directory.
include $(TOPDIR)/rules.mk
PKG_NAME:=ad74413r
PKG_VERSION:=1.0.0
PKG_RELEASE:=1.
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/kernel.mk
define KernelPackage/ad74413r
SUBMENU:=Industrial I/O Modules
CATEGORY:=Kernel Modules
TITLE:=AD74413R Driver
FILES:=$(PKG_BUILD_DIR)/ad74413r.ko
AUTOLOAD:=$(call AutoProbe,ad74413r)
KCONFIG:=CONFIG_AD74413R
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
modules
endef
$(eval $(call KernelPackage,ad74413r))
Any help would be appreciated. And I would like to make it worth peoples time to respond to this
You need to add it to a package feed. For testing, create a local package feed - see the Wiki for details.
This probably add some missing mandatory things
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=ad74413r
PKG_VERSION:=1.0.0
PKG_RELEASE:=1.
PKG_SOURCE:=ad74413r.tar
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/kernel.mk
define KernelPackage/ad74413r
SUBMENU:=Industrial I/O Modules
CATEGORY:=Kernel Modules
TITLE:=AD74413R Driver
FILES:=$(PKG_BUILD_DIR)/ad74413r.ko
AUTOLOAD:=$(call AutoProbe,ad74413r)
PKG_KCONFIG:=AD74413R
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" V=1 \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
modules
endef
$(eval $(call KernelPackage,ad74413r))
tar is content from linux/drivers/iio/addac at master ยท analogdevicesinc/linux ยท GitHub
also
place this makefile in folder package/kernel/ad74413r
make package/kernel/ad74413r/compile -j1 -V=s
1 Like
Following said instructions.
make package/kernel/ad74413r/Compile V=s FIXUP=1
I get the following errors.
ERROR: please fix package/kernel/ad74413r/Makefile - see logs/package/kernel/ad74413r/dump.txt for details
Collecting package info: done
make[2]: Entering directory '/home/***/***/***/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '/home/***/***/***/scripts/config'
make[1]: Entering directory '/home/***/***/***'
make[1]: *** No rule to make target 'package/kernel/ad74413r/Compile'. Stop.
make[1]: Leaving directory '/home/***/***/***'
make: *** [/home/***/***/***/include/toplevel.mk:230: package/kernel/ad74413r/Compile] Error 2
Looking at include/toplevel.mk:230
, cp .config tmp/.config
. was I supposed to write a config file?
Reading https://openwrt.org/docs/guide-developer/packages#creating_packages_for_kernel_modules. The makefile structures are not making sense to me. I do understand that including rules
and kernel
are what are needed and what produces this unique makefile structure. I'm just trying to find my path from init of the makefile to the compile of the kernel. I could probably handle compile time errors if I got to them.
The dir structure is
kernel/ad74413r/
โโโ ad74413r.tar
โโโ Makefile
1 directory, 2 files
with the tar structure as so:-
tar -tvf ad74413r.tar
-rw-r--r-- ***/*** 52753 2023-06-07 21:38 ad74115.c
-rw-r--r-- ***/*** 37895 2023-06-07 21:38 ad74413r.c
-rw-r--r-- ***/*** 1161 2023-06-07 21:37 Kconfig
-rw-r--r-- ***/*** 269 2023-06-07 21:37 Makefile
-rw-r--r-- ***/*** 5389 2023-06-07 21:39 one-bit-adc-dac.c
ad74413r.tar
should be in openwrt/dl
directory .config
is generated from what it's declared in Makefile
I was communicating with someone else online about the issue. And this is where I'm up to....
This is the package/kernel
../ad74413r/
โโโ Makefile
โโโ src
โโโ ad74115.c
โโโ ad74413r.c
โโโ Makefile
โโโ one-bit-adc-dac.c
The outer Makefile is
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel-defaults.mk
PKG_NAME:=ad74413r
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/kernel.mk
define KernelPackage/ad74413r
SUBMENU:=Industrial I/O Modules
CATEGORY:=Kernel modules
TITLE:=AD74413R Driver
FILES:=$(PKG_BUILD_DIR)/ad74413r.ko
AUTOLOAD:=$(call AutoProbe,ad74413r)
PKG_KCONFIG:=AD74413R
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" V=1 \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
modules
endef
$(eval $(call KernelPackage,ad74413r))
And the inner Makefile is
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for industrial I/O ADDAC drivers
#
# When adding new entries keep the list in alphabetical order
obj-$(CONFIG_AD74115) += ad74115.o
obj-$(CONFIG_AD74413R) += ad74413r.o
obj-$(CONFIG_ONE_BIT_ADC_DAC) += one-bit-adc-dac.o
# Add ad74413r to modules
obj-m += ad74413r.o
but I not getting any *.o or *.ko in the related build_dir
I can provide snipped debugged verbose make outputs if so desires. I'm just running them now.
All I wish right now is that I could be getting a compile time error, but most of my errors just state "hey I can't find this" because make isn't building it, but not saying why. its not returning anything directly back from the compiler. either this is because its still something in the build system or I haven't enabled the many options to provide more verbose log
I feel like I'm coming to the conclusion that using openwrt build system is not very modular, with near impossible integration of foriegn modules.
(n00by (like myself)) developers require a better feedback process in the build process to know what we are doing wrong. not "didn't build"... yea I can see that!
It is modular, and its telling you that your Makefile is broken with a path to open for more details.
what path? https://pastebin.com/eFZsPAKS is snippet of the log. pastebin has limits...
apologies I didn't provide the log before. I did put this on openwrt's subreddit.
Remove V=1
and run the build with make V=s
I never run it with V=1. I ran it with V=sc. s for verboseness. I know.
Reading the error carefully I saw
make[2]: *** [Makefile:33:
make[1]: *** [package/Makefile:116:
make: *** [[root]/include/toplevel.mk:230:
line 33 has
include rules.mk
and line 116 of package does not exist.
running make again with the specific V=s
But you have V=1 in the compile step in the Makefile.
Just run make package/kernel/ad74413r/compile V=s
and post the log here.
Your quite right. Well tinkering it looks like it does nothing. and I have run
make package/kernel/ad74413r/compile V=s
here is the output (EDITED)
make[2]: Entering directory '[root]/scripts/config'
make[2]: 'conf' is up to date.
make[2]: Leaving directory '[root]/scripts/config'
make[1]: Entering directory '[root]'
make[2]: Entering directory '[root]/package/kernel/ad74413r'
rm -rf [root]/build_dir/target-aarch64_cortex-a72_musl/linux-bcm27xx_bcm2711/ad74413r-1.0.0/.pkgdir/kmod-ad74413r.installed [root]/build_dir/target-aarch64_cortex-a72_musl/linux-bcm27xx_bcm2711/ad74413r-1.0.0/.pkgdir/kmod-ad74413r
mkdir -p [root]/build_dir/target-aarch64_cortex-a72_musl/linux-bcm27xx_bcm2711/ad74413r-1.0.0/.pkgdir/kmod-ad74413r
ERROR: module '[root]/build_dir/target-aarch64_cortex-a72_musl/linux-bcm27xx_bcm2711/ad74413r-1.0.0/ad74413r.ko' is missing.
make[2]: *** [Makefile:33: [root]/build_dir/target-aarch64_cortex-a72_musl/linux-bcm27xx_bcm2711/ad74413r-1.0.0/.pkgdir/kmod-ad74413r.installed] Error 1
make[2]: Leaving directory '[root]/package/kernel/ad74413r'
time: package/kernel/ad74413r/compile#1.18#0.17#1.34
ERROR: package/kernel/ad74413r failed to build.
make[1]: *** [package/Makefile:116: package/kernel/ad74413r/compile] Error 1
make[1]: Leaving directory '[root]'
make: *** [[root]/include/toplevel.mk:230: package/kernel/ad74413r/compile] Error 2
Remove the --debug
, it just makes it hard to follow.
Also, please post the current Makefile you are using
Edited look at previous message
Post the Makefile you are using
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/kernel-defaults.mk
PKG_NAME:=ad74413r
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
include $(INCLUDE_DIR)/kernel.mk
define KernelPackage/ad74413r
SUBMENU:=Industrial I/O Modules
CATEGORY:=Kernel modules
TITLE:=AD74413R Driver
FILES:=$(PKG_BUILD_DIR)/ad74413r.ko
AUTOLOAD:=$(call AutoProbe,ad74413r)
PKG_KCONFIG:=AD74413R
endef
define Build/Compile
$(MAKE) -C "$(LINUX_DIR)" V=sc \
ARCH="$(LINUX_KARCH)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
SUBDIRS="$(PKG_BUILD_DIR)" \
modules
endef
$(eval $(call KernelPackage,ad74413r))
and in src/Makefile
# SPDX-License-Identifier: GPL-2.0
#
# Makefile for industrial I/O ADDAC drivers
#
# When adding new entries keep the list in alphabetical order
obj-$(CONFIG_AD74115) += ad74115.o
obj-$(CONFIG_AD74413R) += ad74413r.o
obj-$(CONFIG_ONE_BIT_ADC_DAC) += one-bit-adc-dac.o
# Add ad74413r to modules
obj-m += ad74413r.o
Well, that is your problem.
Just replace the compile step with:
define Build/Compile
$(KERNEL_MAKE) M=$(PKG_BUILD_DIR) modules
endef
1 Like
Yes! this is much more promising, thank you! compiler errors at last!