Hi,

On Thu, May 16, 2013 at 12:02 AM, Zoltan HERPAI <wigy...@uid0.hu> wrote:
> Adding target support for i.MX23, with initial profiles for the
> different Olinuxino boards.
>
> Signed-off-by: Zoltan HERPAI <wigy...@uid0.hu>
>
> ---
>
> Index: target/linux/imx23/image/Makefile
> ===================================================================
> --- target/linux/imx23/image/Makefile   (revision 0)
> +++ target/linux/imx23/image/Makefile   (revision 0)
> @@ -0,0 +1,42 @@
> +#
> +# Copyright (C) 2010 OpenWrt.org

It's 2013 ...

> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +include $(TOPDIR)/rules.mk
> +include $(INCLUDE_DIR)/image.mk
> +
> +JFFS2_BLOCKSIZE=128k 16k

Maybe order them by size?

> +JFFS2OPTS += -n

Long option names are preferred (at least by me). Actually do you need
jffs2 at all? None of the boards seem to have internal flash.

> +
> +#define Image/BuildKernel
> +#      mkdir -p $(BIN_DIR)
> +#      cp $(KDIR)/vmlinuz $(BIN_DIR)/$(IMG_PREFIX)-zImage
> +#endef
> +
> +#define Image/Prepare
> +#      cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/vmlinuz
> +#endef

Please remove dead code.
> +
> +
> +define Image/Build/jffs2-64k
> +       dd if=$(KDIR)/root.jffs2-64k
> of=$(BIN_DIR)/openwrt-$(BOARD)-jffs2-64k.img bs=65536 conv=sync

This patch is line broken, please fix your mailer. Also since you
don't include 64k block size in JFFS_BLOCKSIZE, this is basically read
code, so you can remove it, especially as none of the devices seem to
have integrated flash. You can prevent building them by clearing
JFFS2_BLOCKSIZE.

> +endef
> +
> +define Image/Build/jffs2-128k
> +       dd if=$(KDIR)/root.jffs2-128k
> of=$(BIN_DIR)/openwrt-$(BOARD)-jffs2-128k.img bs=131072 conv=sync
> +endef
> +
> +define Image/Build/squashfs
> +       $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
> +       dd if=$(KDIR)/root.squashfs
> of=$(BIN_DIR)/openwrt-$(BOARD)-squashfs.img bs=131072 conv=sync
> +endef

Same these two, you are never actually calling them them.

> +
> +define Image/Build
> +       $(call Image/Build/$(1))
> +       dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/$(IMG_PREFIX)-root.$(1)
> bs=128k
> conv=sync
> +endef
> +
> +
> +$(eval $(call BuildImage))
> Index: target/linux/imx23/profiles/003-Micro.mk
> ===================================================================
> --- target/linux/imx23/profiles/003-Micro.mk    (revision 0)
> +++ target/linux/imx23/profiles/003-Micro.mk    (revision 0)
> @@ -0,0 +1,19 @@
> +#
> +# Copyright (C) 2009 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +# FiXME: need to add usb soc
> +
> +define Profile/MICRO
> +  NAME:=OLinuXino-MICRO board
> +#  PACKAGES:=kmod-rtl8187
> +endef
> +
> +define Profile/MICRO/Description
> +       Base packages for -MICRO boards.
> +endef
> +$(eval $(call Profile,MICRO))
> +
> Index: target/linux/imx23/profiles/000-Maxi.mk
> ===================================================================
> --- target/linux/imx23/profiles/000-Maxi.mk     (revision 0)
> +++ target/linux/imx23/profiles/000-Maxi.mk     (revision 0)
> @@ -0,0 +1,19 @@
> +#
> +# Copyright (C) 2009 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +# FiXME: need to add usb soc and snd
> +
> +define Profile/MAXI
> +  NAME:=OLinuXino-MAXI board
> +  PACKAGES:=kmod-usb-net-smsc95xx
> +endef
> +
> +define Profile/MAXI/Description
> +       Base packages for -MAXI boards.
> +endef
> +$(eval $(call Profile,MAXI))
> +
> Index: target/linux/imx23/profiles/002-Mini.mk
> ===================================================================
> --- target/linux/imx23/profiles/002-Mini.mk     (revision 0)
> +++ target/linux/imx23/profiles/002-Mini.mk     (revision 0)
> @@ -0,0 +1,19 @@
> +#
> +# Copyright (C) 2009 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +# FiXME: need to add usb soc and snd
> +
> +define Profile/MINI
> +  NAME:=OLinuXino-MINI board
> +  PACKAGES:=kmod-rtl8187

Why does the mini non-wifi include the wifi driver?

> +endef
> +
> +define Profile/MINI/Description
> +       Base packages for -MINI boards.
> +endef
> +$(eval $(call Profile,MINI))
> +
> Index: target/linux/imx23/profiles/001-Mini-Wifi.mk
> ===================================================================
> --- target/linux/imx23/profiles/001-Mini-Wifi.mk        (revision 0)
> +++ target/linux/imx23/profiles/001-Mini-Wifi.mk        (revision 0)
> @@ -0,0 +1,19 @@
> +#
> +# Copyright (C) 2009 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +
> +# FiXME: need to add usb soc and snd
> +
> +define Profile/MINI-WIFI
> +  NAME:=OLinuXino-MINI-WIFI board
> +  PACKAGES:=kmod-rtl8187
> +endef
> +
> +define Profile/MINI-WIFI/Description
> +       Base packages for -MINI-WIFI boards.
> +endef
> +$(eval $(call Profile,MINI-WIFI))
> +

Also there is no need to give each profile its own file, just create
one 001-olinuxino.mk or so. Actually do you really need a profile for
each board? The difference is only whether the wifi or usb-net driver
is included. And since you will be putting it on a multigigabyte SD
card, why not have a single profile including both.

> Index: target/linux/imx23/config-default
> ===================================================================
> --- target/linux/imx23/config-default   (revision 0)
> +++ target/linux/imx23/config-default   (revision 0)
> @@ -0,0 +1,266 @@
(snip 266 lines)

Please run make kernel_menuconfig to ensure the config only includes
the the differences to the generic config.

> Index: target/linux/imx23/base-files/etc/inittab
> ===================================================================
> --- target/linux/imx23/base-files/etc/inittab   (revision 0)
> +++ target/linux/imx23/base-files/etc/inittab   (revision 0)
> @@ -0,0 +1,3 @@
> +::sysinit:/etc/init.d/rcS S boot
> +::shutdown:/etc/init.d/rcS K shutdown
> +ttyAMA0::askfirst:/bin/ash --login
> Index: target/linux/imx23/Makefile
> ===================================================================
> --- target/linux/imx23/Makefile (revision 0)
> +++ target/linux/imx23/Makefile (revision 0)
> @@ -0,0 +1,35 @@
> +#
> +# Copyright (C) 2006-2011 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +include $(TOPDIR)/rules.mk
> +
> +ARCH:=arm
> +BOARD:=imx23
> +BOARDNAME:=Olinuxino i.MX233
> +FEATURES:=ext4 rtc usb2

usb2 isn't a known feature, did you mean usb?

> +CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s -fno-caller-saves
> +MAINTAINER:=Zoltan Herpai <wigy...@uid0.hu>
> +LINUX_VERSION:=3.8.11

Current in trunk is 3.8.12.

> +DEPENDS:=imx-bootlets

Huh, does that even work?

> +
> +define Target/Description
> +endef
> +
> +define Image/BuildKernel
> +       make -C $(LINUX_DIR) CROSS_COMPILE=$(KERNEL_CROSS)
> ARCH=$(LINUX_KARCH)
> imx23-olinuxino.dtb
> +       cat $(LINUX_DIR)/arch/arm/boot/zImage
> $(LINUX_DIR)/arch/arm/boot/dts/imx23-olinuxino.dtb >
> $(STAGING_DIR)/zImage_dtb
> +       (cd $(STAGING_DIR); \
> +               ../host/bin/elftosb -z -c ./linux_prebuilt.db -o linux.sb \
> +               dd if=/dev/zero of=sd_mmc_bootstream.raw bs=512 count=4; \
> +               dd if=linux.sb of=$(BIN_DIR)/openwrt-imx23-sbImage ibs=512
> seek=4; \
> +       )

This all belongs in image/Makefile. Also you can skip the first part
by defining

KERNELNAME:= "zImage dtb"

then the dtb will already be compiled automatically during kernel build.


> +endef
> +
> +include $(INCLUDE_DIR)/target.mk
> +
> +DEFAULT_PACKAGES += dnsmasq kmod-usb-chipidea kmod-usb-net
> kmod-usb-net-smsc95xx imx-bootlets kmod-rtc-stmp3xxx kmod-sound-core
> kmod-sound-soc-sgtl5000
> +
> +$(eval $(call BuildTarget))
> Index: package/kernel/modules/other.mk
> ===================================================================
> --- package/kernel/modules/other.mk     (revision 36641)
> +++ package/kernel/modules/other.mk     (working copy)
> @@ -436,6 +436,23 @@
>
>  $(eval $(call KernelPackage,rtc-marvell))
>
> +define KernelPackage/rtc-stmp3xxx
> +  SUBMENU:=$(OTHER_MENU)
> +  TITLE:=STMP3xxx SoC built-in RTC support
> +  $(call AddDepends/rtc)
> +  KCONFIG:=\
> +       CONFIG_RTC_CLASS=y \
> +       CONFIG_RTC_DRV_STMP=m

remove the =m, it is automatically added.

> +  FILES:=$(LINUX_DIR)/drivers/rtc/rtc-stmp3xxx.ko
> +  AUTOLOAD:=$(call AutoLoad,60,rtc-stmp3xxx)
> +endef

Also this package should depend on @TARGET_IMX23 (or whatever it was
called). Maybe even move it to target/linux/imx23/modules.mk


> +
> +define KernelPackage/rtc-stmp3xxx/description
> + Kernel module for STMP3xxx RTC.
> +endef
> +
> +$(eval $(call KernelPackage,rtc-stmp3xxx))
> +
>  define KernelPackage/rtc-pcf8563
>    SUBMENU:=$(OTHER_MENU)
>    TITLE:=Philips PCF8563/Epson RTC8564 RTC support
> Index: package/kernel/modules/usb.mk
> ===================================================================
> --- package/kernel/modules/usb.mk       (revision 36641)
> +++ package/kernel/modules/usb.mk       (working copy)
> @@ -87,7 +87,6 @@
>
>  $(eval $(call KernelPackage,usb-uhci,1))
>
> -
>  define KernelPackage/usb-ohci
>    TITLE:=Support for OHCI controllers
>    DEPENDS:=+TARGET_brcm47xx:kmod-usb-brcm47xx
> @@ -127,7 +126,46 @@
>
>  $(eval $(call KernelPackage,usb2-fsl))
>
> +define KernelPackage/usb-chipidea
> +  TITLE:=Support for ChipIdea controllers
> +  DEPENDS:=+kmod-usb2 +kmod-usb-mxs-phy
> +  KCONFIG:= \
> +       CONFIG_USB_SUPPORT \

This is a bool, and should be already set to =y by the board code, so
remove this one,

> +       CONFIG_USB_CHIPIDEA=m \

=m needs to be dropped.

> +       CONFIG_USB_CHIPIDEA_HOST=y \
> +       CONFIG_USB_CHIPIDEA_DEBUG=y
> +  FILES:=\
> +       $(LINUX_DIR)/drivers/usb/chipidea/ci_hdrc.ko \
> +       $(LINUX_DIR)/drivers/usb/chipidea/ci13xxx_imx.ko
> +  AUTOLOAD:=$(call AutoLoad,51,ci_hdrc ci13xxx_imx,1)
> +  $(call AddDepends/usb)
> +endef
>
> +define KernelPackage/usb-chipidea/description
> + Kernel support for USB ChipIdea controllers
> +endef
> +
> +$(eval $(call KernelPackage,usb-chipidea,1))
> +
> +define KernelPackage/usb-mxs-phy
> +  TITLE:=Support for Freescale MXS USB PHY controllers
> +  DEPENDS:=+kmod-usb2
> +  KCONFIG:= \
> +       CONFIG_USB_MXS_PHY=m \

=m needs to be dropped.

> +       CONFIG_USB_OTG_UTILS=y \
> +       CONFIG_USB_OTG=y

Not sure if these belong in here. Also this one needs to depend on
@TARGET_IMX23 again.

> +       FILES:=$(LINUX_DIR)/drivers/usb/otg/mxs-phy.ko
> +  AUTOLOAD:=$(call AutoLoad,50,mxs-phy,1)
> +  $(call AddDepends/usb)
> +endef
> +
> +define KernelPackage/usb-mxs-phy/description
> + Kernel support for Freescale MXS USB PHY controllers
> +endef
> +
> +$(eval $(call KernelPackage,usb-mxs-phy,1))
> +
> +
>  define KernelPackage/usb2
>    TITLE:=Support for USB2 controllers
>    DEPENDS:=+TARGET_brcm47xx:kmod-usb-brcm47xx
> +TARGET_mpc85xx:kmod-usb2-fsl
> @@ -902,7 +940,21 @@
>
>  $(eval $(call KernelPackage,usb-net-ipheth))
>
> +define KernelPackage/usb-net-smsc95xx
> +  TITLE:=SMSC95xx USB/2.0 Ethernet driver
> +  KCONFIG:=CONFIG_USB_NET_SMSC95XX
> +  FILES:=$(LINUX_DIR)/drivers/net/usb/smsc95xx.ko
> +  AUTOLOAD:=$(call AutoLoad,64,smsc95xx)
> +  $(call AddDepends/usb-net)
> +endef
>
> +define KernelPackage/usb-net-smsc95xx/description
> +  Kernel support for SMSC95xx USB/2.0 Ethernet driver
> +endef
> +
> +$(eval $(call KernelPackage,usb-net-smsc95xx))
> +
> +
>  define KernelPackage/usb-hid
>    TITLE:=Support for USB Human Input Devices
>    KCONFIG:=CONFIG_HID_SUPPORT=y CONFIG_USB_HID CONFIG_USB_HIDDEV=y


Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to