diff --git a/Config.in b/Config.in new file mode 100644 index 0000000..6e7c514 --- /dev/null +++ b/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_SHARP_DRM + bool "sharp_drm" + default y + depends on BR2_LINUX_KERNEL + select BR2_PACKAGE_LIBDRM + select BR2_PACKAGE_SPI + select BR2_PACKAGE_GPIO + select BR2_PACKAGE_RASPI_GPIO + help + DRM driver for Sharp Memory LCD diff --git a/Makefile b/Makefile index ed351ea..a7589f1 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,11 @@ obj-m += sharp.o -sharp-objs += main.o drm_iface.o params_iface.o ioctl_iface.o +sharp-objs += src/main.o src/drm_iface.o src/params_iface.o src/ioctl_iface.o +ccflags-y := -DDEBUG -g -std=gnu99 -Wno-declaration-after-statement -export KROOT=/lib/modules/$(shell uname -r)/build +.PHONY: all clean -all: modules +all: + $(MAKE) -C '$(LINUX_DIR)' M='$(PWD)' modules -modules modules_install clean:: - @$(MAKE) -C $(KROOT) M=$(shell pwd) $@ - -clean:: - rm -rf Module.symvers modules.order +clean: + $(MAKE) -C '$(LINUX_DIR)' M='$(PWD)' clean diff --git a/init/S01sharp b/init/S01sharp new file mode 100755 index 0000000..1679bb4 --- /dev/null +++ b/init/S01sharp @@ -0,0 +1,35 @@ +#!/bin/sh +# +# sharp_drm Loads sharp_drm driver. +# + +umask 077 + +start() { + /sbin/modprobe sharp + echo "OK" +} +stop() { + echo "OK" +} +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/sharp.mk b/sharp.mk new file mode 100644 index 0000000..dc1a985 --- /dev/null +++ b/sharp.mk @@ -0,0 +1,25 @@ +SHARP_VERSION = 1.0 +SHARP_SITE = $(BR2_EXTERNAL_BB_DRIVERS_PATH)/package/sharp +SHARP_SITE_METHOD = local + +SHARP_INSTALL_IMAGES = YES +SHARP_MODULE_SUBDIRS = . + +define SHARP_BUILD_CMDS + for dts in $(@D)/*.dts; do \ + $(HOST_DIR)/bin/dtc -@ -I dts -O dtb -W no-unit_address_vs_reg -o $${dts%.dts}.dtbo $${dts}; \ + done +endef + +define SHARP_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/init/S01sharp $(TARGET_DIR)/etc/init.d/; +endef + +define SHARP_INSTALL_IMAGES_CMDS + for dtbo in $(@D)/*.dtbo; do \ + $(INSTALL) -D -m 0644 $${dtbo} $(BINARIES_DIR)/rpi-firmware/overlays; \ + done +endef + +$(eval $(kernel-module)) +$(eval $(generic-package)) diff --git a/drm_iface.c b/src/drm_iface.c similarity index 100% rename from drm_iface.c rename to src/drm_iface.c diff --git a/drm_iface.h b/src/drm_iface.h similarity index 100% rename from drm_iface.h rename to src/drm_iface.h diff --git a/indicators.h b/src/indicators.h similarity index 100% rename from indicators.h rename to src/indicators.h diff --git a/ioctl_iface.c b/src/ioctl_iface.c similarity index 100% rename from ioctl_iface.c rename to src/ioctl_iface.c diff --git a/ioctl_iface.h b/src/ioctl_iface.h similarity index 100% rename from ioctl_iface.h rename to src/ioctl_iface.h diff --git a/main.c b/src/main.c similarity index 100% rename from main.c rename to src/main.c diff --git a/params_iface.c b/src/params_iface.c similarity index 100% rename from params_iface.c rename to src/params_iface.c diff --git a/params_iface.h b/src/params_iface.h similarity index 100% rename from params_iface.h rename to src/params_iface.h