diff --git a/package/boot/uboot-envtools/files/mpc85xx b/package/boot/uboot-envtools/files/mpc85xx index 004ec241316..df6e5f670bb 100644 --- a/package/boot/uboot-envtools/files/mpc85xx +++ b/package/boot/uboot-envtools/files/mpc85xx @@ -12,6 +12,9 @@ ocedo,panda) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" ;; +aerohive,hiveap-330) + ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x20000" "0x10000" + ;; esac config_load ubootenv diff --git a/target/linux/mpc85xx/Makefile b/target/linux/mpc85xx/Makefile index b89bfc3ed15..6bf096740e4 100644 --- a/target/linux/mpc85xx/Makefile +++ b/target/linux/mpc85xx/Makefile @@ -19,6 +19,7 @@ include $(INCLUDE_DIR)/target.mk DEFAULT_PACKAGES += \ kmod-input-core kmod-input-gpio-keys kmod-button-hotplug \ - kmod-leds-gpio swconfig kmod-ath9k wpad-basic-wolfssl kmod-usb2 + kmod-leds-gpio swconfig kmod-ath9k wpad-basic-wolfssl kmod-usb2 \ + uboot-envtools $(eval $(call BuildTarget)) diff --git a/target/linux/mpc85xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mpc85xx/base-files/etc/uci-defaults/05_fix-compat-version new file mode 100644 index 00000000000..253c22900df --- /dev/null +++ b/target/linux/mpc85xx/base-files/etc/uci-defaults/05_fix-compat-version @@ -0,0 +1,11 @@ +. /lib/functions.sh +. /lib/functions/system.sh + +case "$(board_name)" in +aerohive,hiveap-330) + uci set system.@system[0].compat_version="2.0" + uci commit system + ;; +esac + +exit 0 diff --git a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts index 9eb6e2613a6..359b123bc62 100644 --- a/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts +++ b/target/linux/mpc85xx/files/arch/powerpc/boot/dts/hiveap-330.dts @@ -22,10 +22,6 @@ label-mac-device = &enet0; }; - chosen { - bootargs-override = "console=ttyS0,9600"; - }; - memory { device_type = "memory"; }; @@ -47,36 +43,41 @@ #address-cells = <1>; #size-cells = <1>; + firmware@0 { + reg = <0x0 0x3f00000>; + label = "firmware"; + /* + * This unknown/invalid compatible prevents + * openwrt's mtdsplit_fit to go off a tangent if it + * finds a magic value inside the uncompressed kernel + * at a blocksized aligned place. + */ + compatible = "areohive,hiveap-330-image"; + }; + partition@0 { reg = <0x0 0x40000>; label = "dtb"; }; partition@40000 { - reg = <0x40000 0x40000>; - label = "initrd"; - }; - - partition@80000 { - reg = <0x80000 0x27c0000>; - label = "rootfs"; - }; - - partition@2840000 { - reg = <0x2840000 0x800000>; + compatible = "openwrt,uimage", "denx,uimage"; + reg = <0x40000 0x3ec0000>; label = "kernel"; }; - partition@3040000 { - reg = <0x3040000 0xec0000>; - label = "stock-jffs2"; - read-only; - }; - - hwinfo: partition@3f00000 { + partition@3f00000 { reg = <0x3f00000 0x20000>; label = "hw-info"; read-only; + + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_hwinfo_0: macaddr@0 { + reg = <0x0 0x6>; + }; }; partition@3f20000 { @@ -101,11 +102,6 @@ label = "u-boot"; read-only; }; - - firmware@0 { - reg = <0x0 0x3040000>; - label = "firmware"; - }; }; }; }; @@ -242,13 +238,3 @@ }; }; /include/ "fsl/p1020si-post.dtsi" - -&hwinfo { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_hwinfo_0: macaddr@0 { - reg = <0x0 0x6>; - }; -}; diff --git a/target/linux/mpc85xx/image/p1020.mk b/target/linux/mpc85xx/image/p1020.mk index a127723e897..fff2c3931f8 100644 --- a/target/linux/mpc85xx/image/p1020.mk +++ b/target/linux/mpc85xx/image/p1020.mk @@ -1,17 +1,58 @@ +define Build/MultiImage + rm -rf $@.fakerd $@.new + + dd if=/dev/zero of=$@.fakerd bs=32 count=1 conv=sync + + -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T multi -C $(1) \ + -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) -n '$(BOARD_NAME) initramfs' \ + -d $@:$@.fakerd:$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@.new + mv $@.new $@ + rm -rf $@.fakerd +endef + define Device/aerohive_hiveap-330 DEVICE_VENDOR := Aerohive DEVICE_MODEL := HiveAP-330 DEVICE_PACKAGES := kmod-tpm-i2c-atmel BLOCKSIZE := 128k - KERNEL := kernel-bin | gzip | uImage gzip - KERNEL_SIZE := 8m - KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs | uImage none - IMAGES := fdt.bin sysupgrade.bin - IMAGE/fdt.bin := append-dtb - IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | check-size 256k | \ - append-uImage-fakehdr ramdisk | pad-to 256k | check-size 512k | \ - append-rootfs | pad-rootfs $$(BLOCKSIZE) | pad-to 41216k | check-size 41216k | \ - append-kernel | append-metadata + KERNEL := kernel-bin | uImage none + KERNEL_INITRAMFS := kernel-bin | MultiImage none + KERNEL_SIZE := 16m + IMAGES := sysupgrade.bin + IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | append-kernel | \ + append-rootfs | pad-rootfs | check-size | append-metadata + IMAGE_SIZE = 63m + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := \n$\ + !The partitioning of the HiveAP 330 has changed! \n$\ + To upgrade, please take a look at the install instructions over \ + at the device's wiki: \n$\ + An abridged version for the console is provided here for comfort. \n$\ + Run the following script into a shell on the device and retry this \ + sysupgrade again: \n$\ + cat <<- "EOF" > /tmp/uboot-fix.sh; sh /tmp/uboot-fix.sh \n$\ + . /lib/functions.sh \n$\ + . /lib/functions/system.sh \n$\ + opkg update && opkg install uboot-envtools kmod-mtd-rw || exit 2 \n$\ + insmod mtd-rw i_want_a_brick=y || exit 3 \n$\ + echo "/dev/mtd$$$$(find_mtd_index u-boot-env) 0x0 0x20000 0x10000" > "/etc/fw_env.config" \n$\ + fw_setenv owrt_boot 'setenv bootargs console=ttyS0,9600;bootm 0xEC040000 - 0xEC000000' \n$\ + cp "/dev/mtd$$$$(find_mtd_index 'u-boot')" /tmp/uboot \n$\ + cp /tmp/uboot /tmp/uboot_patched \n$\ + strings -td < /tmp/uboot | grep '^ *[0-9]* *\\(run owrt_boot\\|setenv bootargs\\).*cp\\.l' | \n$\ + awk '{print $$$$1}' | \n$\ + while read offset; do \n$\ + echo -n "run owrt_boot; " | dd of=/tmp/uboot_patched bs=1 seek=$$$${offset} conv=notrunc \n$\ + done \n$\ + mtd write /tmp/uboot_patched u-boot \n$\ + uci set system.@system[0].compat_version=2.0; uci commit; \n$\ + EOF \n$\ + \n$\ + Note that if this fails, you will need to use the serial console \n$\ + to re-install OpenWrt. \n$\ + Note that after this sysupgrade, the AP will be unavailable for 7 \n$\ + minutes to reformat flash." + endef TARGET_DEVICES += aerohive_hiveap-330 @@ -28,7 +69,7 @@ TARGET_DEVICES += enterasys_ws-ap3710i define Device/ocedo_panda DEVICE_VENDOR := OCEDO DEVICE_MODEL := Panda - DEVICE_PACKAGES := kmod-rtc-ds1307 uboot-envtools + DEVICE_PACKAGES := kmod-rtc-ds1307 KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb PAGESIZE := 2048 SUBPAGESIZE := 512 diff --git a/target/linux/mpc85xx/p1020/config-default b/target/linux/mpc85xx/p1020/config-default index d0bf7707688..31fce8b60ab 100644 --- a/target/linux/mpc85xx/p1020/config-default +++ b/target/linux/mpc85xx/p1020/config-default @@ -24,6 +24,7 @@ CONFIG_MTD_NAND_FSL_ELBC=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_FIT_FW=y +CONFIG_MTD_SPLIT_UIMAGE_FW=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BEB_LIMIT=20 CONFIG_MTD_UBI_BLOCK=y