[OpenWrt-Devel] [PATCH 1/2] layerscape: add ls1043ardb-64b target

Jonas Gorski jonas.gorski at gmail.com
Wed Jul 13 06:42:02 EDT 2016


Hi,

On 13 July 2016 at 19:56,  <yutang.jiang at nxp.com> wrote:
> From: Yutang Jiang <yutang.jiang at nxp.com>
>
> Add support for NXP layerscape ls1043ardb-64b Dev board.

Nice to see support for it here. A few things first, though

>
> ls1043ardb-64b target is using 4.1 kernel and rcw/u-boot/fman images from
>  NXP QorIQ SDK V2.0 release.

Please update your codebase to 4.4 first. The next release kernel is
currently planned to be 4.4.

> All of 4.1 kernel patches will be in the second patch, it have more than
>  100 kernel patches: platform/flash/dpaa/mmc/usb/pcie etc, porting from
>  SDK release or upstream.

Please add them at the same time. If it's too large for an email, you
can also put the commit in a public git repository. You can also
create a pull request on github.

I guess several of the patches will be obsolete with the switch to 4.4 anyway?

>
> Signed-off-by: Yutang Jiang <yutang.jiang at nxp.com>
> ---
>  target/linux/layerscape-64b/Makefile               |   26 +
>  target/linux/layerscape-64b/README.ls1043ardb      |  860 ++++++
>  target/linux/layerscape-64b/base-files/etc/inittab |    6 +
>  target/linux/layerscape-64b/image/Makefile         |   64 +
>  .../linux/layerscape-64b/image/checkimagesize.sh   |   16 +
>  .../linux/layerscape-64b/ls1043ardb/config-default | 3146 ++++++++++++++++++++
>  target/linux/layerscape-64b/ls1043ardb/target.mk   |   16 +
>  7 files changed, 4134 insertions(+)
>  create mode 100644 target/linux/layerscape-64b/Makefile
>  create mode 100644 target/linux/layerscape-64b/README.ls1043ardb
>  create mode 100644 target/linux/layerscape-64b/base-files/etc/inittab
>  create mode 100644 target/linux/layerscape-64b/image/Makefile
>  create mode 100755 target/linux/layerscape-64b/image/checkimagesize.sh
>  create mode 100644 target/linux/layerscape-64b/ls1043ardb/config-default
>  create mode 100644 target/linux/layerscape-64b/ls1043ardb/target.mk
>
> diff --git a/target/linux/layerscape-64b/Makefile b/target/linux/layerscape-64b/Makefile
> new file mode 100644
> index 0000000..63d55b9
> --- /dev/null
> +++ b/target/linux/layerscape-64b/Makefile
> @@ -0,0 +1,26 @@
> +#
> +# Copyright (C) 2016 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +include $(TOPDIR)/rules.mk
> +
> +ARCH:=aarch64
> +BOARD:=layerscape-64b
> +BOARDNAME:=layerscape 64b
> +CFLAGS:=-Os -pipe -fno-caller-saves
> +DEVICE_TYPE:=developerboard
> +KERNEL_PATCHVER:=4.1
> +KERNELNAME:=Image dtbs
> +FEATURES:=squashfs
> +SUBTARGETS:=ls1043ardb
> +MAINTAINER:=Jiang Yutang <yutang.jiang at nxp.com>
> +
> +include $(INCLUDE_DIR)/target.mk
> +
> +define Target/Description
> +       Build firmware images for $(BOARDNAME) SoC devices.
> +endef
> +
> +$(eval $(call BuildTarget))
> diff --git a/target/linux/layerscape-64b/README.ls1043ardb b/target/linux/layerscape-64b/README.ls1043ardb
> new file mode 100644
> index 0000000..9f6a0af
> --- /dev/null
> +++ b/target/linux/layerscape-64b/README.ls1043ardb
> @@ -0,0 +1,860 @@
(snip)

I think a lot of this information (like the bootlog) is better served
on the wiki, or shouldn't be here at all (like the contents of various
uci files, which are subject to change, and nobody will remember to
update the example output here).

> diff --git a/target/linux/layerscape-64b/image/Makefile b/target/linux/layerscape-64b/image/Makefile
> new file mode 100644
> index 0000000..43e7269
> --- /dev/null
> +++ b/target/linux/layerscape-64b/image/Makefile
> @@ -0,0 +1,64 @@
> +#
> +# Copyright (C) 2016 OpenWrt.org
> +#
> +# 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
> +
> +# make uImage and dtb
> +define Image/uImage-dtb
> +       gzip -9c < $(KDIR)/Image > $(KDIR)/Image.gz
> +       $(eval ARCH_BACK = $(ARCH))
> +       $(eval ARCH = $(LINUX_KARCH))
> +       $(call Image/BuildKernel/MkuImage, gzip, $(KERNEL_LOADADDR), \
> +               $(KERNEL_ENTRY_POINT), $(KDIR)/Image.gz, \
> +               $(KDIR)/$(IMG_PREFIX)-uImage)
> +       $(eval ARCH = $(ARCH_BACK))
> +
> +       $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$(KDIR)/$(IMG_PREFIX)-dtb)
> +endef
> +
> +# $(1) source image name
> +# $(2) partition image name
> +# $(3) partition image size(M)
> +define Image/Build/flashpartitionimage
> +       ./checkimagesize.sh $(1) $(3)
> +       dd if=/dev/zero bs=1M count=$(3) | sed 's/\x00/\xff/g' > $(2)
> +       dd if=$(1) of=$(2) conv=notrunc
> +endef
> +
> +# make squashfs then merge uImage/dtb/squashfs to one firmware image arranged
> +# by individual partition
> +define Image/Build/squashfs
> +       $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
> +
> +       $(call Image/Build/flashpartitionimage,$(KDIR)/$(IMG_PREFIX)-dtb,$(KDIR)/$(IMG_PREFIX)-dtb-par,$(DTB_PARTITION_SIZE))
> +       $(call Image/Build/flashpartitionimage,$(KDIR)/$(IMG_PREFIX)-uImage,$(KDIR)/$(IMG_PREFIX)-uImage-par,$(KERNEL_PARTITION_SIZE))
> +       $(call Image/Build/flashpartitionimage,$(KDIR)/root.squashfs,$(KDIR)/root.squashfs-par,$(SQUASHFS_PARTITION_SIZE))
> +       cat $(KDIR)/$(IMG_PREFIX)-dtb-par $(KDIR)/$(IMG_PREFIX)-uImage-par \
> +               $(KDIR)/root.squashfs-par > $(BIN_DIR)/$(IMG_PREFIX)-firmware
> +       $(RM) $(KDIR)/$(IMG_PREFIX)-dtb-par $(KDIR)/$(IMG_PREFIX)-uImage-par \
> +               $(KDIR)/root.squashfs-par
> +endef
> +
> +# target macros
> +define Target/Default
> +       KERNEL_LOADADDR = 0x80080000
> +       KERNEL_ENTRY_POINT = 0x80080000
> +endef
> +
> +# callback function: Image/BuildKernel
> +define Image/BuildKernel
> +       $(eval $(call Target/Default))
> +       $(eval $(call Subtarget/Default))
> +       $(call Image/uImage-dtb)
> +endef
> +
> +# callback function: Image/Build
> +define Image/Build
> +       $(call Image/Build/$(1),$(1))
> +endef
> +
> +$(eval $(call BuildImage))

Please update your image build code to the new image code with
defining appropriate Device/* sections. This will then also eliminate

> diff --git a/target/linux/layerscape-64b/image/checkimagesize.sh b/target/linux/layerscape-64b/image/checkimagesize.sh
> new file mode 100755
> index 0000000..e65c7fe
> --- /dev/null
> +++ b/target/linux/layerscape-64b/image/checkimagesize.sh

this file, as there is a size check build step available.

> diff --git a/target/linux/layerscape-64b/ls1043ardb/config-default b/target/linux/layerscape-64b/ls1043ardb/config-default
> new file mode 100644
> index 0000000..1543907
> --- /dev/null
> +++ b/target/linux/layerscape-64b/ls1043ardb/config-default
> @@ -0,0 +1,3146 @@
> +#
> +# Automatically generated file; DO NOT EDIT.
> +# Linux/arm64 4.1.23 Kernel Configuration
> +#
> (snip)

Please minimize this config by running "make kernel_defconfig
CONFIG_TARGET=subtarget" (or put this as the "main" config as
target/layerscape-64b/config-default, then run just "make
kernel_defconfig").

> diff --git a/target/linux/layerscape-64b/ls1043ardb/target.mk b/target/linux/layerscape-64b/ls1043ardb/target.mk
> new file mode 100644
> index 0000000..9f2580b
> --- /dev/null
> +++ b/target/linux/layerscape-64b/ls1043ardb/target.mk
> @@ -0,0 +1,16 @@
> +#
> +# Copyright (C) 2016 OpenWrt.org
> +#
> +# This is free software, licensed under the GNU General Public License v2.
> +# See /LICENSE for more information.
> +#
> +BOARDNAME += $(SUBTARGET)
> +
> +# subtarget macros
> +# PARTITION_SIZE unit: (M)
> +define Subtarget/Default
> +       DEVICE_DTS = freescale/fsl-ls1043a-rdb
> +       DTB_PARTITION_SIZE = 1
> +       KERNEL_PARTITION_SIZE = 5
> +       SQUASHFS_PARTITION_SIZE = 54
> +endef

Please don't use subtargets for single boards - subtargets should be
limited for variants that require different, incompatible compiler
options or kernel options (e.g. little vs big endian, 32 vs 64 bit
etc).

Just make this the default device/profile of the target then.


Regards
Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list