mpc85xx: Patch HiveAP 330 u-boot to fix boot
[openwrt/openwrt.git] / target / linux / mpc85xx / image / p1020.mk
1 define Build/MultiImage
2 rm -rf $@.fakerd $@.new
3
4 dd if=/dev/zero of=$@.fakerd bs=32 count=1 conv=sync
5
6 -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T multi -C $(1) \
7 -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) -n '$(BOARD_NAME) initramfs' \
8 -d $@:$@.fakerd:$(KDIR)/image-$(firstword $(DEVICE_DTS)).dtb $@.new
9 mv $@.new $@
10 rm -rf $@.fakerd
11 endef
12
13 define Device/aerohive_hiveap-330
14 DEVICE_VENDOR := Aerohive
15 DEVICE_MODEL := HiveAP-330
16 DEVICE_PACKAGES := kmod-tpm-i2c-atmel
17 BLOCKSIZE := 128k
18 KERNEL := kernel-bin | uImage none
19 KERNEL_INITRAMFS := kernel-bin | MultiImage none
20 KERNEL_SIZE := 16m
21 IMAGES := sysupgrade.bin
22 IMAGE/sysupgrade.bin := append-dtb | pad-to 256k | append-kernel | \
23 append-rootfs | pad-rootfs | check-size | append-metadata
24 IMAGE_SIZE = 63m
25 DEVICE_COMPAT_VERSION := 2.0
26 DEVICE_COMPAT_MESSAGE := \n$\
27 !The partitioning of the HiveAP 330 has changed! \n$\
28 To upgrade, please take a look at the install instructions over \
29 at the device's wiki: <https://openwrt.org/toh/aerohive/hiveap-330> \n$\
30 An abridged version for the console is provided here for comfort. \n$\
31 Run the following script into a shell on the device and retry this \
32 sysupgrade again: \n$\
33 cat <<- "EOF" > /tmp/uboot-fix.sh; sh /tmp/uboot-fix.sh \n$\
34 . /lib/functions.sh \n$\
35 . /lib/functions/system.sh \n$\
36 opkg update && opkg install uboot-envtools kmod-mtd-rw || exit 2 \n$\
37 insmod mtd-rw i_want_a_brick=y || exit 3 \n$\
38 echo "/dev/mtd$$$$(find_mtd_index u-boot-env) 0x0 0x20000 0x10000" > "/etc/fw_env.config" \n$\
39 fw_setenv owrt_boot 'setenv bootargs console=ttyS0,9600;bootm 0xEC040000 - 0xEC000000' \n$\
40 cp "/dev/mtd$$$$(find_mtd_index 'u-boot')" /tmp/uboot \n$\
41 cp /tmp/uboot /tmp/uboot_patched \n$\
42 strings -td < /tmp/uboot | grep '^ *[0-9]* *\\(run owrt_boot\\|setenv bootargs\\).*cp\\.l' | \n$\
43 awk '{print $$$$1}' | \n$\
44 while read offset; do \n$\
45 echo -n "run owrt_boot; " | dd of=/tmp/uboot_patched bs=1 seek=$$$${offset} conv=notrunc \n$\
46 done \n$\
47 mtd write /tmp/uboot_patched u-boot \n$\
48 uci set system.@system[0].compat_version=2.0; uci commit; \n$\
49 EOF \n$\
50 \n$\
51 Note that if this fails, you will need to use the serial console \n$\
52 to re-install OpenWrt. \n$\
53 Note that after this sysupgrade, the AP will be unavailable for 7 \n$\
54 minutes to reformat flash."
55
56 endef
57 TARGET_DEVICES += aerohive_hiveap-330
58
59 define Device/enterasys_ws-ap3710i
60 DEVICE_VENDOR := Enterasys
61 DEVICE_MODEL := WS-AP3710i
62 BLOCKSIZE := 128k
63 KERNEL = kernel-bin | lzma | fit lzma $(KDIR)/image-$$(DEVICE_DTS).dtb
64 IMAGES := sysupgrade.bin
65 IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
66 endef
67 TARGET_DEVICES += enterasys_ws-ap3710i
68
69 define Device/ocedo_panda
70 DEVICE_VENDOR := OCEDO
71 DEVICE_MODEL := Panda
72 DEVICE_PACKAGES := kmod-rtc-ds1307
73 KERNEL = kernel-bin | gzip | fit gzip $(KDIR)/image-$$(DEVICE_DTS).dtb
74 PAGESIZE := 2048
75 SUBPAGESIZE := 512
76 BLOCKSIZE := 128k
77 IMAGES := fdt.bin sysupgrade.bin
78 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
79 IMAGE/fdt.bin := append-dtb
80 endef
81 TARGET_DEVICES += ocedo_panda
82