[OpenWrt-Devel] Pogoplug V4 support

nwf 8S9K8UGO5JGPI3U067229BBACKMQIGVH at cmx.ietfng.org
Sat Oct 25 18:00:33 EDT 2014


Salutations openwrt-devel@,

I've gotten an initial Pogoplug V4 build into good enough shape that I think
it's worth sharing.  It uses a lightly-tweaked fork of uBoot for the moment
(though I'm hoping the tweaks eventually make it back into mainline) and uses
FDT to bring up the kernel.  Thoughts are welcome.

--nwf;


diff --git a/package/boot/uboot-kirkwood-mibodhi/Makefile b/package/boot/uboot-kirkwood-mibodhi/Makefile
new file mode 100644
index 0000000..6855a91
--- /dev/null
+++ b/package/boot/uboot-kirkwood-mibodhi/Makefile
@@ -0,0 +1,103 @@
+#
+# Copyright (C) 2010-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=u-boot
+PKG_VERSION:=2014.07-mibodhi
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=git at github.com:nwf/u-boot-kirkwood.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=23217407aab5494d7c17b0c5b0b1aabb13e4c26e
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define uboot/Default
+  TITLE:=
+  CONFIG:=
+  IMAGE:=
+endef
+
+define uboot/pogo4
+  TITLE:=U-Boot for Cloud Engines Pogoplug V4
+  CONFIG:=pogo_v4
+endef
+
+UBOOTS:= pogo4
+
+define Package/uboot/template
+define Package/uboot-kirkwood-$(1)
+  SECTION:=boot
+  CATEGORY:=Boot Loaders
+  DEPENDS:=@TARGET_kirkwood
+  TITLE:=$(2)
+  URL:=http://www.denx.de/wiki/U-Boot
+  VARIANT:=$(1)
+endef
+endef
+
+define BuildUBootPackage
+	$(eval $(uboot/Default))
+	$(eval $(uboot/$(1)))
+	$(call Package/uboot/template,$(1),$(TITLE))
+endef
+
+ifdef BUILD_VARIANT
+$(eval $(call uboot/$(BUILD_VARIANT)))
+UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
+UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
+endif
+
+define Build/Configure
+	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+		$(UBOOT_CONFIG)_config
+endef
+
+define Build/Compile
+	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+		u-boot.kwb \
+		CROSS_COMPILE=$(TARGET_CROSS)
+	mkimage -A $(ARCH) -O linux -T kernel -C none \
+		-a 0x600000 -e 0x600000 \
+		-n 'OpenWrt Das U-Boot uImage' \
+		-d $(PKG_BUILD_DIR)/u-boot.bin $(PKG_BUILD_DIR)/u-boot.img
+endef
+
+define Package/uboot/install/default
+	$(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
+	$(CP) $(PKG_BUILD_DIR)/u-boot.bin \
+		$(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
+	$(CP) $(PKG_BUILD_DIR)/u-boot.kwb \
+		$(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.kwb
+	$(CP) $(PKG_BUILD_DIR)/u-boot.img \
+		$(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
+	$(INSTALL_DIR) $(BIN_DIR)/u-boot-kwboot/
+	$(CP) $(PKG_BUILD_DIR)/tools/kwboot \
+		$(BIN_DIR)/u-boot-kwboot/
+endef
+
+define Package/uboot/install/template
+define Package/uboot-kirkwood-$(1)/install
+	$(call Package/uboot/install/default,$(2))
+endef
+endef
+
+$(foreach u,$(UBOOTS), \
+	$(eval $(call Package/uboot/install/template,$(u),$(u))) \
+)
+
+$(foreach u,$(UBOOTS), \
+	$(eval $(call BuildUBootPackage,$(u))) \
+	$(eval $(call BuildPackage,uboot-kirkwood-$(u))) \
+)
diff --git a/package/boot/uboot-kirkwood-mibodhi/patches/200-openwrt-config.patch b/package/boot/uboot-kirkwood-mibodhi/patches/200-openwrt-config.patch
new file mode 100644
index 0000000..8abbfe6
--- /dev/null
+++ b/package/boot/uboot-kirkwood-mibodhi/patches/200-openwrt-config.patch
@@ -0,0 +1,109 @@
+--- /dev/null
++++ b/include/configs/openwrt-kirkwood-common.h
+@@ -0,0 +1,47 @@
++/*
++ * Copyright (C) 2013 Luka Perkov <luka at openwrt.org>
++ *
++ * SPDX-License-Identifier:	GPL-2.0+
++ */
++
++#ifndef __OPENWRT_KIRKWOOD_COMMON_H
++#define __OPENWRT_KIRKWOOD_COMMON_H
++
++/* Commands */
++#define CONFIG_CMD_BOOTZ
++
++#if defined(CONFIG_CMD_NET)
++#define CONFIG_CMD_DHCP
++#define CONFIG_CMD_PING
++#endif
++
++/* Auto boot */
++#undef CONFIG_BOOTDELAY
++#define CONFIG_BOOTDELAY	3
++
++/* Ethernet */
++#if defined(CONFIG_CMD_NET)
++#define CONFIG_SERVERIP		192.168.1.2
++#define CONFIG_IPADDR		192.168.1.1
++#endif
++
++/* second stage loader */
++#if defined(CONFIG_SECOND_STAGE)
++#undef CONFIG_ENV_IS_IN_NAND
++#undef CONFIG_ENV_SECT_SIZE
++#define CONFIG_ENV_IS_NOWHERE
++#endif
++
++/* Flattened Device Tree */
++#define CONFIG_OF_LIBFDT
++
++/* Flattened uImage Tree */
++#define CONFIG_FIT
++#define CONFIG_FIT_VERBOSE
++
++/* Various */
++#define CONFIG_BZIP2
++#define CONFIG_LZMA
++#define CONFIG_LZO
++
++#endif /* __OPENWRT_KIRKWOOD_COMMON_H */
+--- a/include/configs/pogo_v4.h
++++ b/include/configs/pogo_v4.h
+@@ -94,19 +94,40 @@
+  * Default environment variables
+  */
+ #define CONFIG_BOOTCOMMAND \
+-	"setenv bootargs ${bootargs_console}; " \
+-	"run bootcmd_mmc; " \
+-	"bootm 0x00800000 0x01100000"
++    "mmc rescan; usb start;" \
++    "loaderprefix= ; run boot_try_mmc; run boot_try_usb;" \
++    "loaderprefix=/boot; run boot_try_mmc; run boot_try_usb; run boot_try_ubi"
+ 
+ #define CONFIG_EXTRA_ENV_SETTINGS \
+-	"mtdparts=mtdparts=orion_nand:2M(u-boot),3M(uImage)," \
+-	"3M(uImage2),8M(failsafe),112M(root)\0"\
++	"mtdparts=mtdparts=orion_nand:1M(u-boot),127M(root)\0"\
+ 	"mtdids=nand0=orion_nand\0"\
++    \
+ 	"bootargs_console=console=ttyS0,115200\0" \
+-	"bootcmd_mmc=mmc init; ext2load mmc 0:1 0x00800000 /uImage; " \
+-	"ext2load mmc 0:1 0x01100000 /uInitrd\0" \
+-	"bootcmd_usb=usb start; ext2load usb 0:1 0x00800000 /uImage; " \
+-	"ext2load usb 0:1 0x01100000 /uInitrd\0" 
++    \
++    "boot_condload=if ${loadercmd} 0x00800000 ${loaderprefix}/uImage; then " \
++      "if ${loadercmd} 0x01100000 ${loaderprefix}/uInitrd; then " \
++        "setenv bootmargs 0x00800000 0x01100000; " \
++      "else setenv bootmargs 0x00800000 -; fi; " \
++      "if ${loadercmd} 0x00700000 ${loaderprefix}/pogov4.dtb; then " \
++        "fdt addr 0x00700000; fdt resize; fdt chosen; " \
++        "setenv bootmargs ${bootmargs} 0x00700000; fi; " \
++      "run bootcmd_do_bootm; fi\0" \
++    "bootcmd_do_bootm=" \
++      "setenv bootargs $bootargs_console $mtdids $mtdparts $loaderbootargs;" \
++      "bootm ${bootmargs}\0" \
++    \
++    "boot_try_mmc=if mmc info; then"\
++      "setenv loadercmd \"ext4load mmc 0:1\";" \
++      "setenv loaderbootargs \"root=/dev/mmcblk0p1 rootfstype=ext4 rootwait\";" \
++      "run boot_condload; fi\0" \
++    "boot_try_usb=if usb storage; then" \
++      "setenv loadercmd \"ext4load usb 0:1\";" \
++      "setenv loaderbootargs \"root=/dev/sda1 rootfstype=ext4 rootwait\";" \
++      "run boot_condload; fi\0" \
++    "boot_try_ubi=if ubi part root ; ubifsmount ubi:rootfs ; then"\
++      "setenv loadercmd \"ubifsload\";" \
++      "setenv loaderbootargs \"ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs\";" \
++      "run boot_condload; fi\0"
+ 
+ /*
+  * Ethernet Driver configuration
+@@ -167,4 +184,6 @@
+ 
+ #define CONFIG_KIRKWOOD_GPIO
+ 
++#include "openwrt-kirkwood-common.h"
++
+ #endif /* _CONFIG_POGO_V4_H */
diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile
index e3c6f0b..81f86bb 100644
--- a/target/linux/kirkwood/image/Makefile
+++ b/target/linux/kirkwood/image/Makefile
@@ -132,6 +132,9 @@ Image/InstallKernel/Template/ICONNECT=$(call Image/InstallKernel/Template,iconne
 Image/BuildKernel/Template/POGOE02=$(call Image/BuildKernel/Template,pogo_e02)
 Image/InstallKernel/Template/POGOE02=$(call Image/InstallKernel/Template,pogo_e02)
 
+Image/BuildKernel/Template/POGO4=$(call Image/BuildKernel/Template,pogov4)
+Image/InstallKernel/Template/POGO4=$(call Image/InstallKernel/Template,pogov4)
+
 define Image/BuildKernel
 	$(call Image/BuildKernel/Template/$(PROFILE))
 endef
diff --git a/target/linux/kirkwood/patches-3.14/160-pogoplug_v4.patch b/target/linux/kirkwood/patches-3.14/160-pogoplug_v4.patch
new file mode 100644
index 0000000..cf3f1e2
--- /dev/null
+++ b/target/linux/kirkwood/patches-3.14/160-pogoplug_v4.patch
@@ -0,0 +1,179 @@
+With much help from others at https://forum.openwrt.org/viewtopic.php?pid=250745#p250745
+
+--- linux-3.14.18/arch/arm/boot/dts/Makefile.orig
++++ linux-3.14.18/arch/arm/boot/dts/Makefile
+@@ -114,6 +114,7 @@
+ 	kirkwood-openblocks_a6.dtb \
+ 	kirkwood-openblocks_a7.dtb \
+ 	kirkwood-pogo_e02.dtb \
++	kirkwood-pogov4.dtb \
+ 	kirkwood-sheevaplug.dtb \
+ 	kirkwood-sheevaplug-esata.dtb \
+ 	kirkwood-topkick.dtb \
+
+
+--- /dev/null
++++ linux-3.14.18/arch/arm/boot/dts/kirkwood-pogov4.dts
+@@ -0,0 +1,161 @@
++/dts-v1/;
++
++#include "kirkwood.dtsi"
++#include "kirkwood-6281.dtsi"
++
++/ {
++    model = "Pogoplug V4";
++    compatible = "cloudengines,pogoplugv4", "marvell,kirkwood-88f6192", "marvell,kirkwood";
++
++    memory {
++        device_type = "memory";
++        reg = <0x00000000 0x8000000>;
++    };
++
++    chosen {
++        bootargs = "console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p1 rootdelay=10";
++    };
++
++    mbus {
++        pcie-controller {
++            status = "okay";
++
++            pcie at 1,0 {
++                status = "okay";
++            };
++        };
++    };
++
++    ocp at f1000000 {
++        pinctrl: pinctrl at 10000 {
++            pmx_led_green: pmx-led-green {
++                marvell,pins = "mpp22";
++                marvell,function = "gpio";
++            };
++            pmx_led_red: pmx-led-red {
++                marvell,pins = "mpp24";
++                marvell,function = "gpio";
++            };
++            pmx_sdio_cd: pmx-sdio-cd {
++                marvell,pins = "mpp27";
++                marvell,function = "gpio";
++            };
++            pmx_sdio_wp: pmx-sdio-wp {
++                marvell,pins = "mpp28";
++                marvell,function = "gpio";
++            };
++            pmx_button_eject: pmx-button-eject {
++                marvell,pins = "mpp29";
++                marvell,function = "gpio";
++            };
++        };
++
++        spi at 10600 {
++            status = "okay";
++
++            m25p05 at 0 {
++                compatible = "m25p05-nonjedec";
++                reg = <0>;
++                spi-max-frequency = <20000000>;
++                mode = <0>;
++            };
++        };
++
++        serial at 12000 {
++            status = "ok";
++        };
++
++        sata at 80000 {
++            status = "okay";
++            nr-ports = <1>;
++        };
++
++        i2c0: i2c at 11000 {
++            status = "ok";
++        };
++
++        mvsdio at 90000 {
++            pinctrl-0 = <&pmx_sdio &pmx_sdio_cd &pmx_sdio_wp>;
++            pinctrl-names = "default";
++            status = "okay";
++            cd-gpios = <&gpio0 27 1>;
++            wp-gpios = <&gpio0 28 1>;
++        };
++    };
++
++    gpio-leds {
++        compatible = "gpio-leds";
++        pinctrl-0 = <&pmx_led_green &pmx_led_red>;
++        pinctrl-names = "default";
++        health {
++            label = "status:green:health";
++            gpios = <&gpio0 22 1>;
++            linux,default-trigger = "default-on";
++        };
++        fault {
++            label = "status:red:fault";
++            gpios = <&gpio0 24 1>;
++            linux,default-trigger = "none";
++        };
++    };
++
++    gpio_keys {
++        compatible = "gpio-keys";
++        #address-cells = <1>;
++        #size-cells = <0>;
++        pinctrl-0 = <&pmx_button_eject>;
++        pinctrl-names = "default";
++
++        button at 1 {
++            label = "Eject Button";
++            linux,code = <KEY_EJECTCD>;
++            gpios = <&gpio0 29 1>;
++        };
++    };
++};
++
++&mdio {
++    status = "okay";
++
++    ethphy0: ethernet-phy at 0 {
++        device_type = "ethernet-phy";
++        reg = <0>;
++    };
++};
++
++&eth0 {
++    status = "okay";
++    ethernet0-port at 0 {
++        phy-handle = <&ethphy0>;
++    };
++};
++
++&nand {
++    status = "okay";
++
++    partition at 0 {
++        label = "u-boot";
++        reg = <0x0000000 0x200000>;
++        read-only;
++    };
++
++    partition at 200000 {
++        label = "uImage";
++        reg = <0x200000 0x300000>;
++    };
++
++    partition at 500000 {
++        label = "uImage2";
++        reg = <0x500000 0x300000>;
++    };
++
++    partition at 800000 {
++        label = "failsafe";
++        reg = <0x800000 0x800000>;
++    };
++
++    partition at 2500000 {
++        label = "root";
++        reg = <0x1000000 0x7000000>;
++    };
++};
+
diff --git a/target/linux/kirkwood/profiles/110-nas.mk b/target/linux/kirkwood/profiles/110-nas.mk
index eff5952..a31a7f2 100644
--- a/target/linux/kirkwood/profiles/110-nas.mk
+++ b/target/linux/kirkwood/profiles/110-nas.mk
@@ -84,3 +84,29 @@ POGOE02_UBIFS_OPTS:="-m 2048 -e 126KiB -c 4096"
 POGOE02_UBI_OPTS:="-m 2048 -p 128KiB -s 512"
 
 $(eval $(call Profile,POGOE02))
+
+define Profile/POGO4
+  NAME:=Cloud Engines Pogoplug v4
+  PACKAGES:= \
+    kmod-ata-marvell-sata \
+    kmod-crypto-mv-cesa \
+    kmod-i2c-mv64xxx \
+    kmod-thermal-kirkwood \
+	kmod-usb2 kmod-usb3 \
+    kmod-usb-storage \
+    uboot-kirkwood-pogo4 \
+    uboot-envtools
+  DEPENDS:= \
+    + at TARGET_ROOTFS_INCLUDE_KERNEL \
+    + at TARGET_ROOTFS_INCLUDE_UIMAGE \
+    + at TARGET_ROOTFS_INCLUDE_DTB
+endef
+
+define Profile/POGO4/Description
+ Package set compatible with Cloud Engines Pogoplug v4 board.
+endef
+
+POGO4_UBIFS_OPTS:="-m 2048 -e 126KiB -c 4096"
+POGO4_UBI_OPTS:="-m 2048 -p 128KiB -s 512"
+
+$(eval $(call Profile,POGO4))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20141025/9c379a5e/attachment.sig>
-------------- next part --------------
_______________________________________________
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