Re: [LEDE-DEV] [PATCH v2 2/3] ipq806x: Add support for new device: tew827dru
10.09.2016 03:35, J Mo: diff --git a/target/linux/ipq806x/patches-4.4/800-devicetree.patch b/target/linux/ipq806x/patches-4.4/800-devicetree.patch index 85f2534..ae174fd 100644 --- a/target/linux/ipq806x/patches-4.4/800-devicetree.patch +++ b/target/linux/ipq806x/patches-4.4/800-devicetree.patch @@ -12,7 +12,7 @@ Signed-off-by: Jonas Gorski --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile -@@ -506,7 +506,13 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -506,7 +506,14 @@ dtb-$(CONFIG_ARCH_QCOM) += \ qcom-apq8084-ifc6540.dtb \ qcom-apq8084-mtp.dtb \ qcom-ipq8064-ap148.dtb \ @@ -23,6 +23,7 @@ Signed-off-by: Jonas Gorski + qcom-ipq8064-r7500.dtb \ + qcom-ipq8064-r7500v2.dtb \ + qcom-ipq8065-r7800.dtb \ ++ qcom-ipq8064-tew827dru.dtb \ qcom-msm8660-surf.dtb \ qcom-msm8960-cdp.dtb \ qcom-msm8974-sony-xperia-honami.dtb After your change: Applying patch platform/800-devicetree.patch patching file arch/arm/boot/dts/Makefile patch: malformed patch at line 29: qcom-msm8974-sony-xperia-honami.dtb If you edit the patch by hand, you should adjust the patch header as well: -@@ -506,7 +506,13 @@ dtb-$(CONFIG_ARCH_QCOM) += \ +@@ -506,7 +506,14 @@ dtb-$(CONFIG_ARCH_QCOM) += \ But I still get a build error using the patches from patchwork: bash: /data/build/lede/scripts/its-maker.sh: Permission denied Makefile:223: recipe for target '/data/build/lede/build_dir/target-arm_cortex-a15+neon-vfpv4_musl-1.1.15_eabi/linux-ipq806x/tmp/lede-ipq806x-TEW827DRU-squashfs-factory.bin' failed You have a few trailing whitespace errors in your patches. Please use ./scripts/checkpatch.pl on your patches and fix at least the trailing whitespace errors! ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH v2 2/3] ipq806x: Add support for new device: tew827dru
11.09.2016 03:36, J Mo: On 09/10/2016 10:27 AM, Mathias Kresin wrote: 10.09.2016 03:35, J Mo: --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -168,3 +168,19 @@ define Build/sysupgrade-tar --rootfs $(call param_get_default,rootfs,$(1),$(IMAGE_ROOTFS)) \ $@ endef + +define Build/cameo-sig +{ \ +cameo_sig=$(word 1, $(1)) ;\ +align=$(if $(2),$(2),64) ;\ +oldsize=$$(stat -c %s $@) ;\ +sigsize=$$(echo -n $$cameo_sig | wc -c) ;\ +padsize=$$(( ( ( ( $$oldsize + $$sigsize ) / $$align ) + 1 ) - ( ( $$oldsize + $$sigsize ) / $$align ) )) ;\ +newsize=$$(( $$oldsize + $$padsize )) ;\ +echo "Appending Cameo signature: \"$$cameo_sig\", oldsize=$$oldsize align=$$align sigsize=$$sigsize padsize=$$padsize newsize=$$newsize" ;\ +dd if=$@ of=$@.new bs=$$newsize count=1 conv=sync ;\ +echo -n "$$cameo_sig" >> $@.new ; \ +} +@mv $@.new $@ +endef I'm not doing anything obscure here. This should be self-evident. Add a byte-aligned signature. pad-to can't do that. Well if it would be obvious what you are trying to do I wouldn't ask. I still don't get what and to which boundary you are trying to align. After fixing the build errors I do get the following: Appending Cameo signature: "AP148AR9880-RT-150127-00", oldsize=5901955 align=64 sigsize=24 padsize=1 newsize=5901956 PreFooter size: 5901956 PostFooter size: 5901979 Neither the pre footer image nor the post footer image is padded to a multiple of 64 byte. Do you want to add the signature to a 64 byte padded image or should the image + signature padded to a multiple of 64byte? Where does the 64 byte does come from? It doesn't seam to be related to the 128k blocksize of the flash. diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 1ae4352..a3326ab 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -18,6 +18,9 @@ case "$board" in ea8500) echo $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress ;; +tew827dru) +echo $(macaddr_add $(mtd_get_mac_ascii APPSBLENV wan_mac) $(($PHYNBR + 1)) ) > /sys${DEVPATH}/macaddress +;; *) ;; esac This whole file (already before your changes) looks completely wrong to me. Would you please send me a dump of your ART partition! I'll have a look at the checksum. I've a checksum patcher for ath9k in place (https://git.io/vi0eK) which might work for QCA99x0 caldata as well. This way the ath10kcal_patch_mac function in hotplug.d/firmware/11-ath10k-caldata can be used to fix the wifi mac address. I have uploaded a dump of two ART partitions from two different tew827dru here if you or anyone else wants to look at them: http://jmomo.net/files/lede/tew827dru-ARTs/ There is some discussion about this over on the TP-Link Archer C2600 thread. I suggest you go check it out for additional background: https://forum.openwrt.org/viewtopic.php?id=54973&p=13 https://forum.openwrt.org/viewtopic.php?id=54973&p=14 https://forum.openwrt.org/viewtopic.php?pid=317711#p317711 https://github.com/ianchi/openwrt/commit/83084c84414b44801a1ba8f323b363f0bc748e64 This one is quite neat. It allows me to verify my changes. Would you please try the attached patch. Before: $ ./caldata -i './caldata1.bin' -v Size: 12064 MAC: 12:34:56:78:90:12 Checksum: 0xdf10 (OK) Patched: $ ./caldata -v -i ./patched.bin Size: 12064 MAC: aa:bb:cc:dd:ee:ff Checksum: 0x184c (OK) diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index a218183..71fa1e6 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -1,5 +1,25 @@ #!/bin/sh +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/ipq806x.sh +. /lib/functions.sh +. /lib/functions/system.sh + +# xor multiple hex values of the same length +xor() { + local ret="0x$1" + + shift 1 + while [[ "$1" ]]; do + local val="0x$1" + ret=$((${ret:-0} ^ ${val:-0})) + shift 1 + done + + printf "%02x" "$ret" +} + ath10kcal_die() { echo "ath10cal: " "$*" exit 1 @@ -30,39 +50,46 @@ ath10kcal_extract() { ath10kcal_patch_mac() { local mac=$1 + local mac_offset=6 + local chksum_offset=2 + local xor_mac + local xor_fw_mac + local xor_fw_chksum [ -z "$mac" ] && return - macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=6 count=6 -} + xor_mac="${mac:0:2}${mac:3:2} ${mac:6:2}${mac:9:2} ${mac:12:2}${mac:15:2}" + xor_fw_mac=$(hexdump -v -n 6 -s $mac_offset -e '/2 "%04x "' /lib/firmware/$FIRMWARE) -[ -e /lib/firmwar
Re: [LEDE-DEV] [PATCH v2 2/3] ipq806x: Add support for new device: tew827dru
11.09.2016 06:07, J Mo: On 09/10/2016 06:36 PM, J Mo wrote: diff --git a/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac new file mode 100644 index 000..b4ed225 --- /dev/null +++ b/target/linux/ipq806x/base-files/lib/preinit/06_set_iface_mac @@ -0,0 +1,23 @@ +#!/bin/sh +# +# Copyright (c) 2014 The Linux Foundation. All rights reserved. +# + +set_ether_mac() { +. /lib/functions/uci-defaults.sh +. /lib/ipq806x.sh +. /lib/functions/system.sh + +board=$(ipq806x_board_name) + +case "$board" in +tew827dru) +# Set the correct ethernet MAC addresses per OEM intent. +ifconfig eth0 hw ether $(mtd_get_mac_ascii APPSBLENV wan_mac) 2>/dev/null +ifconfig eth1 hw ether $(mtd_get_mac_ascii APPSBLENV lan_mac) 2>/dev/null +;; +esac + +} + +boot_hook_add preinit_main set_ether_mac Okay I guess I see what you are trying to do. But you doing it at the wrong place using the wrong functions. Please have a look at https://git.lede-project.org/?p=source.git;a=blob;f=target/linux/lantiq/base-files/etc/board.d/02_network to see how to set the mac addresses properly. Oh yea, that's much better. Nevermind, your method does not address the problem. This probably has to be done in preinit or at least before any subinterfaces are created. Other devices are already doing this, probably for the same reasons. Which doesn't mean that it's correct what is done with other boards. It's the job of netifd to set mac addresses. Bypassing netifd for the network configuration is a no go for me. Right: root@lede:/# ifconfig -a | egrep -i hwadd br-lanLink encap:Ethernet HWaddr D8:EB:97:30:30:03 eth0 Link encap:Ethernet HWaddr D8:EB:97:30:30:03 eth0.1Link encap:Ethernet HWaddr D8:EB:97:30:30:03 eth1 Link encap:Ethernet HWaddr D8:EB:97:30:30:04 eth1.2Link encap:Ethernet HWaddr D8:EB:97:30:30:04 Wrong: root@lede:/# ifconfig -a | egrep -i hwadd br-lanLink encap:Ethernet HWaddr D8:EB:97:30:30:03 eth0 Link encap:Ethernet HWaddr 00:03:7F:BA:DB:01 eth0.1Link encap:Ethernet HWaddr D8:EB:97:30:30:03 eth1 Link encap:Ethernet HWaddr 00:03:7F:BA:DB:02 eth1.2Link encap:Ethernet HWaddr D8:EB:97:30:30:04 Well, it is perfect fine. Your configured lan (br-lan) and wan (eth1.2) are using the configured mac addresses. The physical interfaces are having a random macs, which is fine since no package is send over these interface. I mean having the correct mac address for the physical interfaces looks nice but isn't really required. Feel free to use tcpdump/wireshark to confirm that outgoing packages have the correct mac address. ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] New Intel / Lantiq DSL (PHY driver + Firmware)
Hi, I have some new Intel DSL PHY drivers and a new DSL Firmware in my staging tree. I am using it for some days now and also did a little testing in the lab. Please test it and report any regression you see with it, if it is working good I will commit it to the main development branch in the next days. The content is in the dsl branch here: https://git.lede-project.org/?p=lede/hauke/staging.git;a=shortlog;h=refs/heads/dsl Hauke ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH] ar71xx: Fix sysupgrade for the Airtight Networks C-55
It appears that (KERNEL_SIZE) was not passing to append-kernel, causing sysupgrade images to brick units due to the invalid rootfs offset. This is fixed by removing the 2 extra $$'s in front of the variables. Additionally, check-size was added to ensure that we don't have a kernel larger than our partition. Before: kernel@0x0,rootfs@0x13EDF8 After: kernel@0x0,rootfs@0x20 Signed-off-by: Chris Blake --- target/linux/ar71xx/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index bd92a84..5144334 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -443,7 +443,7 @@ define Device/c-55 KERNEL_SIZE = 2048k IMAGE_SIZE = 15872k MTDPARTS = spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,2048k(kernel),13824k(rootfs),13824k(opt)ro,2624k(failsafe)ro,64k(art)ro,15872k@0x6(firmware) - IMAGE/sysupgrade.bin = append-kernel (KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$(IMAGE_SIZE) endef TARGET_DEVICES += c-55 -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] ar71xx: Fix sysupgrade for the Airtight Networks C-55
On Sun, Sep 11, 2016 at 10:40 AM, Chris Blake wrote: > It appears that (KERNEL_SIZE) was not passing to append-kernel, > causing sysupgrade images to brick units due to the invalid rootfs > offset. This is fixed by removing the 2 extra $$'s in front of the > variables. Additionally, check-size was added to ensure that we don't > have a kernel larger than our partition. > > Before: kernel@0x0,rootfs@0x13EDF8 > After: kernel@0x0,rootfs@0x20 > > Signed-off-by: Chris Blake > --- > target/linux/ar71xx/image/generic.mk | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/target/linux/ar71xx/image/generic.mk > b/target/linux/ar71xx/image/generic.mk > index bd92a84..5144334 100644 > --- a/target/linux/ar71xx/image/generic.mk > +++ b/target/linux/ar71xx/image/generic.mk > @@ -443,7 +443,7 @@ define Device/c-55 >KERNEL_SIZE = 2048k >IMAGE_SIZE = 15872k >MTDPARTS = > spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,2048k(kernel),13824k(rootfs),13824k(opt)ro,2624k(failsafe)ro,64k(art)ro,15872k@0x6(firmware) > - IMAGE/sysupgrade.bin = append-kernel (KERNEL_SIZE) | append-rootfs | > pad-rootfs | check-size (IMAGE_SIZE) > + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size > $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$(IMAGE_SIZE) > endef > > TARGET_DEVICES += c-55 > -- > 2.7.4 > Additionally, it appears that other devices like the ZyXEL NBG6616 may be affected by this. - Chris Blake ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] ar71xx: Fix sysupgrade for the Airtight Networks C-55
11.09.2016 17:43, Chris Blake: Additionally, it appears that other devices like the ZyXEL NBG6616 may be affected by this. I'm working on the same at the moment. And till now the ZyXEL NBG6616 and the Ubiquiti UAP Pro are affected by the same error as well. I'm compiling a few more targets to check for more affected devices. @nbd I would like to get rid of the optional padding parameter for append-kernel/append-rootfs and force the use of pad-to. It is way more obvious what is done and it throws an error in case the param is missing. At the moment I'm using pad-to to find more of these kind of errors. Any opinion on that? Mathias ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 3/5] mtd: add fixwrgg command
Based on fixseama. Signed-off-by: Stijn Tintel --- package/system/mtd/src/Makefile | 3 +- package/system/mtd/src/mtd.c| 28 +- package/system/mtd/src/mtd.h| 1 + package/system/mtd/src/wrgg.c | 189 package/system/mtd/src/wrgg.h | 20 + 5 files changed, 238 insertions(+), 3 deletions(-) create mode 100644 package/system/mtd/src/wrgg.c create mode 100644 package/system/mtd/src/wrgg.h diff --git a/package/system/mtd/src/Makefile b/package/system/mtd/src/Makefile index 70c61e5..4e39a89 100644 --- a/package/system/mtd/src/Makefile +++ b/package/system/mtd/src/Makefile @@ -4,7 +4,8 @@ LDFLAGS += -lubox obj = mtd.o jffs2.o crc32.o md5.o obj.seama = seama.o md5.o -obj.ar71xx = trx.o $(obj.seama) +obj.wrgg = wrgg.o md5.o +obj.ar71xx = trx.o $(obj.seama) $(obj.wrgg) obj.brcm = trx.o obj.brcm47xx = $(obj.brcm) obj.bcm53xx = $(obj.brcm) $(obj.seama) diff --git a/package/system/mtd/src/mtd.c b/package/system/mtd/src/mtd.c index 8fbddf5..20048b0 100644 --- a/package/system/mtd/src/mtd.c +++ b/package/system/mtd/src/mtd.c @@ -53,6 +53,7 @@ #define TRX_MAGIC 0x48445230 /* "HDR0" */ #define SEAMA_MAGIC0x5ea3a417 +#define WRGG03_MAGIC 0x20080321 #if !defined(__BYTE_ORDER) #error "Unknown byte order" @@ -61,9 +62,11 @@ #if __BYTE_ORDER == __BIG_ENDIAN #define cpu_to_be32(x) (x) #define be32_to_cpu(x) (x) +#define le32_to_cpu(x) bswap_32(x) #elif __BYTE_ORDER == __LITTLE_ENDIAN #define cpu_to_be32(x) bswap_32(x) #define be32_to_cpu(x) bswap_32(x) +#define le32_to_cpu(x) (x) #else #error "Unsupported endianness" #endif @@ -72,6 +75,7 @@ enum mtd_image_format { MTD_IMAGE_FORMAT_UNKNOWN, MTD_IMAGE_FORMAT_TRX, MTD_IMAGE_FORMAT_SEAMA, + MTD_IMAGE_FORMAT_WRGG03, }; static char *buf = NULL; @@ -200,6 +204,8 @@ image_check(int imagefd, const char *mtd) imageformat = MTD_IMAGE_FORMAT_TRX; else if (be32_to_cpu(magic) == SEAMA_MAGIC) imageformat = MTD_IMAGE_FORMAT_SEAMA; + else if (le32_to_cpu(magic) == WRGG03_MAGIC) + imageformat = MTD_IMAGE_FORMAT_WRGG03; switch (imageformat) { case MTD_IMAGE_FORMAT_TRX: @@ -208,6 +214,8 @@ image_check(int imagefd, const char *mtd) break; case MTD_IMAGE_FORMAT_SEAMA: break; + case MTD_IMAGE_FORMAT_WRGG03: + break; default: #ifdef target_brcm if (!strcmp(mtd, "firmware")) @@ -676,6 +684,10 @@ resume: if (mtd_fixseama) mtd_fixseama(mtd, 0, 0); break; + case MTD_IMAGE_FORMAT_WRGG03: + if (mtd_fixwrgg) + mtd_fixwrgg(mtd, 0, 0); + break; default: break; } @@ -721,6 +733,10 @@ static void usage(void) fprintf(stderr, "fixseamafix the checksum in a seama header on first boot\n"); } + if (mtd_fixwrgg) { + fprintf(stderr, + "fixwrgg fix the checksum in a wrgg header on first boot\n"); + } fprintf(stderr, "Following options are available:\n" "-q quiet mode (once: no [w] on writing,\n" @@ -738,9 +754,9 @@ static void usage(void) fprintf(stderr, "-o offset offset of the image header in the partition(for fixtrx)\n"); } - if (mtd_fixtrx || mtd_fixseama) { + if (mtd_fixtrx || mtd_fixseama || mtd_fixwrgg) { fprintf(stderr, - "-c datasize amount of data to be used for checksum calculation (for fixtrx / fixseama)\n"); + "-c datasize amount of data to be used for checksum calculation (for fixtrx / fixseama / fixwrgg)\n"); } fprintf(stderr, #ifdef FIS_SUPPORT @@ -781,6 +797,7 @@ int main (int argc, char **argv) CMD_JFFS2WRITE, CMD_FIXTRX, CMD_FIXSEAMA, + CMD_FIXWRGG, CMD_VERIFY, CMD_DUMP, CMD_RESETBC, @@ -895,6 +912,9 @@ int main (int argc, char **argv) } else if (((strcmp(argv[0], "fixseama") == 0) && (argc == 2)) && mtd_fixseama) { cmd = CMD_FIXSEAMA; device = argv[1]; + } else if (((strcmp(argv[0], "fixwrgg") == 0) && (argc == 2)) && mtd_fixwrgg) { + cmd = CMD_FIXWRGG; + device = argv[1]; } else if ((strcmp(argv[0], "verify") == 0) && (argc == 3)) { cmd = CMD_VERIFY; imagefile = argv[1]; @@ -991,6 +1011,10 @@ int main (int argc, char **argv) if (mtd_fixseama) mtd_fixseama(device, 0, data_s
[LEDE-DEV] [PATCH 4/5] ar71xx/base-files: rename 09_fix-trx-header 09_fix-checksum
Signed-off-by: Stijn Tintel --- .../base-files/etc/uci-defaults/09_fix-checksum | 19 +++ .../base-files/etc/uci-defaults/09_fix-trx-header | 19 --- 2 files changed, 19 insertions(+), 19 deletions(-) create mode 100644 target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum delete mode 100644 target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-trx-header diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum new file mode 100644 index 000..1bfd525 --- /dev/null +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum @@ -0,0 +1,19 @@ +#!/bin/sh +# +# Copyright (C) 2010 OpenWrt.org +# + +. /lib/ar71xx.sh + +board=$(ar71xx_board_name) + +fixtrx() { + mtd -o 32 fixtrx firmware +} + +case "$board" in +mynet-rext |\ +wrt160nl) + fixtrx + ;; +esac diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-trx-header b/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-trx-header deleted file mode 100644 index 1bfd525..000 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-trx-header +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2010 OpenWrt.org -# - -. /lib/ar71xx.sh - -board=$(ar71xx_board_name) - -fixtrx() { - mtd -o 32 fixtrx firmware -} - -case "$board" in -mynet-rext |\ -wrt160nl) - fixtrx - ;; -esac -- 2.7.3 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 2/5] kernel: mtdsplit: add support for WRGG images
Support splitting WRGG images, found in some D-Link devices (e.g. DAP-2695). Signed-off-by: Stijn Tintel --- target/linux/ar71xx/config-4.4 | 1 + target/linux/generic/config-3.18 | 1 + target/linux/generic/config-4.1| 1 + target/linux/generic/config-4.4| 1 + .../generic/files/drivers/mtd/mtdsplit/Kconfig | 5 + .../generic/files/drivers/mtd/mtdsplit/Makefile| 1 + .../files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c | 109 + 7 files changed, 119 insertions(+) create mode 100644 target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c diff --git a/target/linux/ar71xx/config-4.4 b/target/linux/ar71xx/config-4.4 index a984b1e..0b160f3 100644 --- a/target/linux/ar71xx/config-4.4 +++ b/target/linux/ar71xx/config-4.4 @@ -352,6 +352,7 @@ CONFIG_MTD_SPLIT_FIRMWARE=y CONFIG_MTD_SPLIT_LZMA_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y CONFIG_MTD_SPLIT_UIMAGE_FW=y +CONFIG_MTD_SPLIT_WRGG_FW=y CONFIG_MTD_TPLINK_PARTS=y CONFIG_MYLOADER=y CONFIG_NEED_DMA_MAP_STATE=y diff --git a/target/linux/generic/config-3.18 b/target/linux/generic/config-3.18 index ab5e3b6..8613fd6 100644 --- a/target/linux/generic/config-3.18 +++ b/target/linux/generic/config-3.18 @@ -2283,6 +2283,7 @@ CONFIG_MTD_SPLIT_SUPPORT=y # CONFIG_MTD_SPLIT_TRX_FW is not set # CONFIG_MTD_SPLIT_TPLINK_FW is not set # CONFIG_MTD_SPLIT_UIMAGE_FW is not set +# CONFIG_MTD_SPLIT_WRGG_FW is not set # CONFIG_MTD_SST25L is not set # CONFIG_MTD_SWAP is not set # CONFIG_MTD_TESTS is not set diff --git a/target/linux/generic/config-4.1 b/target/linux/generic/config-4.1 index d52c2f3..b6068b8 100644 --- a/target/linux/generic/config-4.1 +++ b/target/linux/generic/config-4.1 @@ -2376,6 +2376,7 @@ CONFIG_MTD_SPLIT_SUPPORT=y # CONFIG_MTD_SPLIT_TRX_FW is not set # CONFIG_MTD_SPLIT_TPLINK_FW is not set # CONFIG_MTD_SPLIT_UIMAGE_FW is not set +# CONFIG_MTD_SPLIT_WRGG_FW is not set # CONFIG_MTD_SST25L is not set # CONFIG_MTD_SWAP is not set # CONFIG_MTD_TESTS is not set diff --git a/target/linux/generic/config-4.4 b/target/linux/generic/config-4.4 index ba4b8c1..ac3eb3e 100644 --- a/target/linux/generic/config-4.4 +++ b/target/linux/generic/config-4.4 @@ -2364,6 +2364,7 @@ CONFIG_MTD_SPLIT_SUPPORT=y # CONFIG_MTD_SPLIT_TPLINK_FW is not set # CONFIG_MTD_SPLIT_TRX_FW is not set # CONFIG_MTD_SPLIT_UIMAGE_FW is not set +# CONFIG_MTD_SPLIT_WRGG_FW is not set # CONFIG_MTD_SST25L is not set # CONFIG_MTD_SWAP is not set # CONFIG_MTD_TESTS is not set diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig b/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig index 131a74f..7e653e7 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/Kconfig @@ -25,6 +25,11 @@ config MTD_SPLIT_SEAMA_FW depends on MTD_SPLIT_SUPPORT select MTD_SPLIT +config MTD_SPLIT_WRGG_FW + bool "WRGG firmware parser" + depends on MTD_SPLIT_SUPPORT + select MTD_SPLIT + config MTD_SPLIT_UIMAGE_FW bool "uImage based firmware partition parser" depends on MTD_SPLIT_SUPPORT diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile b/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile index acf799e..c843025 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_MTD_SPLIT_TPLINK_FW) += mtdsplit_tplink.o obj-$(CONFIG_MTD_SPLIT_TRX_FW) += mtdsplit_trx.o obj-$(CONFIG_MTD_SPLIT_BRNIMAGE_FW) += mtdsplit_brnimage.o obj-$(CONFIG_MTD_SPLIT_EVA_FW) += mtdsplit_eva.o +obj-$(CONFIG_MTD_SPLIT_WRGG_FW) += mtdsplit_wrgg.o diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c new file mode 100644 index 000..c1fbccb --- /dev/null +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2013 Gabor Juhos + * Copyright (C) 2014 Felix Fietkau + * Copyright (C) 2016 Stijn Tintel + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include + +#include "mtdsplit.h" + +#define WRGG_NR_PARTS 2 +#define WRGG_MIN_ROOTFS_OFFS 0x8 /* 512KiB */ +#define WRGG03_MAGIC 0x20080321 + +struct wrgg03_header { + charsignature[32]; + uint32_tmagic1; + uint32_tmagic2; + charversion[16]; + charmodel[16]; + uint32_tflag[2]; + uint32_treserve[2]; + charbuildno[16]; + uint32_tsize; + uint32_toffset; + char
[LEDE-DEV] [PATCH 5/5] ar71xx: add support for D-Link DAP-2695 rev. A1
Signed-off-by: Stijn Tintel --- package/boot/uboot-envtools/files/ar71xx | 1 + target/linux/ar71xx/base-files/etc/board.d/01_leds | 5 + .../linux/ar71xx/base-files/etc/board.d/02_network | 5 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 + .../base-files/etc/uci-defaults/09_fix-checksum| 9 + target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 13 ++ target/linux/ar71xx/config-4.4 | 1 + .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 + target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 + .../files/arch/mips/ath79/mach-dap-2695-a1.c | 191 + .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + target/linux/ar71xx/image/generic.mk | 38 13 files changed, 281 insertions(+) create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-dap-2695-a1.c diff --git a/package/boot/uboot-envtools/files/ar71xx b/package/boot/uboot-envtools/files/ar71xx index a075020..45f1f45 100644 --- a/package/boot/uboot-envtools/files/ar71xx +++ b/package/boot/uboot-envtools/files/ar71xx @@ -54,6 +54,7 @@ om2p-lc) dr531) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x1" ;; +dap-2695-a1 | \ wzr-hp-ag300h) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1" "0x1" ;; diff --git a/target/linux/ar71xx/base-files/etc/board.d/01_leds b/target/linux/ar71xx/base-files/etc/board.d/01_leds index cf05859..96352a2 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/01_leds +++ b/target/linux/ar71xx/base-files/etc/board.d/01_leds @@ -197,6 +197,11 @@ rb-2011uias-2hnd) ucidef_set_led_switch "eth10" "ETH10" "rb:green:eth10" "switch1" "0x02" ;; +dap-2695-a1) + ucidef_set_led_default "power" "POWER" "d-link:green:power" "1" + ucidef_set_led_default "diag" "DIAG" "d-link:red:power" "0" + ucidef_set_led_wlan "wlan2g" "WLAN 2.4 GHz" "d-link:green:wlan2g" "phy1tpt" + ;; dhp-1565-a1) ucidef_set_led_switch "wan" "WAN" "d-link:green:planet" "switch0" "0x20" ;; diff --git a/target/linux/ar71xx/base-files/etc/board.d/02_network b/target/linux/ar71xx/base-files/etc/board.d/02_network index b637113..65292b0 100755 --- a/target/linux/ar71xx/base-files/etc/board.d/02_network +++ b/target/linux/ar71xx/base-files/etc/board.d/02_network @@ -538,6 +538,11 @@ wndr3700) ucidef_add_switch_port_attr "switch0" 5 led 2 ;; +dap-2695-a1) + ucidef_set_interfaces_lan_wan "eth0" "eth1" + ucidef_add_switch "switch0" "0@eth0" "2:lan" "3:wan" "6@eth1" + ;; + *) ucidef_set_interfaces_lan_wan "eth0" "eth1" ;; diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 0e93feb..31f54e3 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -47,6 +47,10 @@ board=$(ar71xx_board_name) case "$FIRMWARE" in "ath10k/cal-pci-:00:00.0.bin") case $board in + dap-2695-a1) + ath10kcal_extract "radiocfg" 20480 2116 + ath10kcal_patch_mac $(mtd_get_mac_ascii bdcfg wlanmac_a) + ;; dlan-pro-1200-ac) ath10kcal_extract "art" 20480 2116 ;; diff --git a/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum index 1bfd525..057afe0 100644 --- a/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum +++ b/target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum @@ -11,9 +11,18 @@ fixtrx() { mtd -o 32 fixtrx firmware } +fixwrgg() { + local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd) + + [ "$kernel_size" ] && mtd -c 0x$kernel_size fixwrgg firmware +} + case "$board" in mynet-rext |\ wrt160nl) fixtrx ;; +dap-2695-a1) + fixwrgg + ;; esac diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh index e57701a..82c1872 100755 --- a/target/linux/ar71xx/base-files/lib/ar71xx.sh +++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh @@ -469,6 +469,9 @@ ar71xx_board_detect() { *CR5000) name="cr5000" ;; + *"DAP-2695 rev. A1") + name="dap-2695-a1" + ;; *"DB120 reference board") name="db120" ;; diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh index 716fa52..e94dd13 100755 --- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh @@ -105,6 +105,10 @@ seama_get_type_magic()
[LEDE-DEV] [PATCH 1/5] firmware-utils: mkwrggimg: new tool for D-Link DAP-2695
Based on mkwrgimg.c. Signed-off-by: Stijn Tintel --- tools/firmware-utils/Makefile| 1 + tools/firmware-utils/src/mkwrggimg.c | 282 +++ 2 files changed, 283 insertions(+) create mode 100644 tools/firmware-utils/src/mkwrggimg.c diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile index f4a5222..9d100e5 100644 --- a/tools/firmware-utils/Makefile +++ b/tools/firmware-utils/Makefile @@ -57,6 +57,7 @@ define Host/Compile $(call cc,buffalo-tag buffalo-lib, -Wall) $(call cc,buffalo-tftp buffalo-lib, -Wall) $(call cc,mkwrgimg md5, -Wall) + $(call cc,mkwrggimg md5, -Wall) $(call cc,mkedimaximg) $(call cc,mkbrncmdline) $(call cc,mkbrnimg) diff --git a/tools/firmware-utils/src/mkwrggimg.c b/tools/firmware-utils/src/mkwrggimg.c new file mode 100644 index 000..a224b25 --- /dev/null +++ b/tools/firmware-utils/src/mkwrggimg.c @@ -0,0 +1,282 @@ +/* + * Copyright (C) 2011 Gabor Juhos + * Copyright (C) 2016 Stijn Tintel + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "md5.h" + +#define ERR(fmt, ...) do { \ + fflush(0); \ + fprintf(stderr, "[%s] *** error: " fmt "\n", \ + progname, ## __VA_ARGS__ ); \ +} while (0) + +#define ERRS(fmt, ...) do { \ + int save = errno; \ + fflush(0); \ + fprintf(stderr, "[%s] *** error: " fmt ", %s\n", \ + progname, ## __VA_ARGS__, strerror(save)); \ +} while (0) + +#define WRGG03_MAGIC 0x20080321 + +struct wrgg03_header { + charsignature[32]; + uint32_tmagic1; + uint32_tmagic2; + charversion[16]; + charmodel[16]; + uint32_tflag[2]; + uint32_treserve[2]; + charbuildno[16]; + uint32_tsize; + uint32_toffset; + chardevname[32]; + chardigest[16]; +} __attribute__ ((packed)); + +static char *progname; +static char *ifname; +static char *ofname; +static char *signature; +static char *version; +static char *model; +static uint32_t flag = 0; +static uint32_t reserve = 0; +static char *buildno; +static uint32_t offset; +static char *devname; +static int big_endian; + +void usage(int status) +{ + FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout; + + fprintf(stream, "Usage: %s [OPTIONS...]\n", progname); + fprintf(stream, +"\n" +"Options:\n" +" -b create image in big endian format\n" +" -B build number\n" +" -iread input from the file \n" +" -dset device name to \n" +" -m model name\n" +" -owrite output to the file \n" +" -O set offset to \n" +" -s set image signature to \n" +" -h show this screen\n" + ); + + exit(status); +} + +static void put_u32(void *data, uint32_t val, int swap) +{ + unsigned char *p = data; + + if (swap) { + p[0] = (val >> 24) & 0xff; + p[1] = (val >> 16) & 0xff; + p[2] = (val >> 8) & 0xff; + p[3] = val & 0xff; + } else { + p[3] = (val >> 24) & 0xff; + p[2] = (val >> 16) & 0xff; + p[1] = (val >> 8) & 0xff; + p[0] = val & 0xff; + } +} + +static void get_digest(struct wrgg03_header *header, char *data, int size) +{ + MD5_CTX ctx; + + MD5_Init(&ctx); + + MD5_Update(&ctx, (char *)&header->offset, sizeof(header->offset)); + MD5_Update(&ctx, (char *)&header->devname, sizeof(header->devname)); + MD5_Update(&ctx, data, size); + + MD5_Final(header->digest, &ctx); +} + +int main(int argc, char *argv[]) +{ + struct wrgg03_header *header; + char *buf; + struct stat st; + int buflen; + int err; + int res = EXIT_FAILURE; + + FILE *outfile, *infile; + + progname = basename(argv[0]); + + while ( 1 ) { + int c; + + c = getopt(argc, argv, "bd:i:m:o:s:v:B:O:h"); + if (c == -1) + break; + + switch (c) { + case 'b': + big_endian = 1; + break; + case 'B': + buildno = optarg; + break; + case 'd': + devname = optarg; + break; + case 'i': + ifname = optarg; + break; + case 'm': + model = optarg; + break; + case 'o': +
[LEDE-DEV] [PATCH 0/5] add support for D-Link DAP-2695 rev. A1
This patch series adds support for D-Link DAP-2695 rev. A1. Both the factory and the sysupgrade can be used to flash the device from the bootloader. When flashing via the web interface of the stock firmware, only the factory image can be used. With the stock firmware, this device is only usable as a dumb AP. With LEDE, it is configured as a router by default. The LAN1(PoE) port is configured as the LAN port, the LAN2 port is configured as the WAN port. The only thing that doesn't work, is the 5GHz LED, as it does not seem to be connected to any of the SoC's GPIOs. The WRGG naming comes from the D-Link GPL code. The mkwrggimg utility also works for the D-Link DAP-2553. For more info, see https://forum.openwrt.org/viewtopic.php?id=52048 Stijn Tintel (5): firmware-utils: mkwrggimg: new tool for D-Link DAP-2695 kernel: mtdsplit: add support for WRGG images mtd: add fixwrgg command ar71xx/base-files: rename 09_fix-trx-header 09_fix-checksum ar71xx: add support for D-Link DAP-2695 rev. A1 package/boot/uboot-envtools/files/ar71xx | 1 + package/system/mtd/src/Makefile| 3 +- package/system/mtd/src/mtd.c | 28 +- package/system/mtd/src/mtd.h | 1 + package/system/mtd/src/wrgg.c | 189 ++ package/system/mtd/src/wrgg.h | 20 ++ target/linux/ar71xx/base-files/etc/board.d/01_leds | 5 + .../linux/ar71xx/base-files/etc/board.d/02_network | 5 + .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 + .../base-files/etc/uci-defaults/09_fix-checksum| 28 ++ .../base-files/etc/uci-defaults/09_fix-trx-header | 19 -- target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + .../ar71xx/base-files/lib/upgrade/platform.sh | 13 + target/linux/ar71xx/config-4.4 | 2 + .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 + target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 + .../files/arch/mips/ath79/mach-dap-2695-a1.c | 191 ++ .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + target/linux/ar71xx/image/generic.mk | 38 +++ target/linux/generic/config-3.18 | 1 + target/linux/generic/config-4.1| 1 + target/linux/generic/config-4.4| 1 + .../generic/files/drivers/mtd/mtdsplit/Kconfig | 5 + .../generic/files/drivers/mtd/mtdsplit/Makefile| 1 + .../files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c | 109 tools/firmware-utils/Makefile | 1 + tools/firmware-utils/src/mkwrggimg.c | 282 + 27 files changed, 940 insertions(+), 22 deletions(-) create mode 100644 package/system/mtd/src/wrgg.c create mode 100644 package/system/mtd/src/wrgg.h create mode 100644 target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-checksum delete mode 100644 target/linux/ar71xx/base-files/etc/uci-defaults/09_fix-trx-header create mode 100644 target/linux/ar71xx/files/arch/mips/ath79/mach-dap-2695-a1.c create mode 100644 target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_wrgg.c create mode 100644 tools/firmware-utils/src/mkwrggimg.c -- 2.7.3 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] ar71xx: Fix sysupgrade for the Airtight Networks C-55
11.09.2016 17:40, Chris Blake: It appears that (KERNEL_SIZE) was not passing to append-kernel, causing sysupgrade images to brick units due to the invalid rootfs offset. This is fixed by removing the 2 extra $$'s in front of the variables. Additionally, check-size was added to ensure that we don't have a kernel larger than our partition. Before: kernel@0x0,rootfs@0x13EDF8 After: kernel@0x0,rootfs@0x20 Signed-off-by: Chris Blake --- target/linux/ar71xx/image/generic.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index bd92a84..5144334 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -443,7 +443,7 @@ define Device/c-55 KERNEL_SIZE = 2048k IMAGE_SIZE = 15872k MTDPARTS = spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,2048k(kernel),13824k(rootfs),13824k(opt)ro,2624k(failsafe)ro,64k(art)ro,15872k@0x6(firmware) - IMAGE/sysupgrade.bin = append-kernel (KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size $$(IMAGE_SIZE) endef TARGET_DEVICES += c-55 Hey Chris, I've pushed my fix. But it doesn't include the kernel size check. Would you please rebase your patch on HEAD and send it again. It would be neat if you add the kernel size check to all build recipes having a kernel size based padding. Mathias ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH] ar71xx: add check-size when append-kernel is used
Per http://lists.infradead.org/pipermail/lede- dev/2016-September/002693.html, this patch adds check-size $$(KERNEL_SIZE) when append-kernel is used to ensure kernels are not over their max KERNEL_SIZE, as this is not checked by append-kernel. Signed-off-by: Chris Blake --- target/linux/ar71xx/image/generic.mk | 4 ++-- target/linux/ar71xx/image/ubnt.mk| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 10717cb..3aeff12 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -410,7 +410,7 @@ define Device/NBG6616 CMDLINE += mem=128M IMAGES := sysupgrade.bin KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage - IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) # We cannot currently build a factory image. It is the sysupgrade image # prefixed with a header (which is actually written into the MTD device). # The header is 2kiB and is filled with 0xff. The format seems to be: @@ -443,7 +443,7 @@ define Device/c-55 KERNEL_SIZE = 2048k IMAGE_SIZE = 15872k MTDPARTS = spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,2048k(kernel),13824k(rootfs),13824k(opt)ro,2624k(failsafe)ro,64k(art)ro,15872k@0x6(firmware) - IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) endef TARGET_DEVICES += c-55 diff --git a/target/linux/ar71xx/image/ubnt.mk b/target/linux/ar71xx/image/ubnt.mk index 99496f7..2d0d464 100644 --- a/target/linux/ar71xx/image/ubnt.mk +++ b/target/linux/ar71xx/image/ubnt.mk @@ -261,7 +261,7 @@ define Device/ubnt-uap-pro DEVICE_PROFILE := UBNT UAPPRO KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0 IMAGES := sysupgrade.bin factory.bin - IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2 endef -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] ar71xx: add check-size when append-kernel is used
@Mathias, Just to make sure, is check-size (IMAGE_SIZE) also affected by this bug as well? If so, let me know and I can rebase this patch again later tonight to fix that as well. - Chris Blake ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH] ar71xx: add check-size when append-kernel is used
11.09.2016 20:24, Chris Blake: @Mathias, Just to make sure, is check-size (IMAGE_SIZE) also affected by this bug as well? If so, let me know and I can rebase this patch again later tonight to fix that as well. - Chris Blake I've tested the build of a few images and (IMAGE_SIZE) seams to be fine. In case nothing is passed to the check-size of a kernel, the kernel is not copied to the place later build steps expect them. Later build steps should fail due to a missing input file in that case. Mathias ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH] linux-firmware: separate packages for Broadcom FullMAC PCIe firmwares
From: Rafał Miłecki Using few packages will allow saving some space by decreasing rootfs size. Dropping 43602a1 firmware saves 316 580 B. Dropping 4366b1 saves 468 188 B. Moreover there are more firmware files that may require packaging and even more to come later (e.g. 4366c0). This can especially useful now, with per device rootfs. Signed-off-by: Rafał Miłecki --- package/firmware/linux-firmware/broadcom.mk | 12 +--- package/kernel/mac80211/Makefile| 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package/firmware/linux-firmware/broadcom.mk b/package/firmware/linux-firmware/broadcom.mk index 659dc82..45d6b33 100644 --- a/package/firmware/linux-firmware/broadcom.mk +++ b/package/firmware/linux-firmware/broadcom.mk @@ -1,14 +1,20 @@ -Package/brcmfmac-firmware-pcie = $(call Package/firmware-default,Broadcom BCM43xx fullmac PCIe firmware) -define Package/brcmfmac-firmware-pcie/install +Package/brcmfmac-firmware-43602a1-pcie = $(call Package/firmware-default,Broadcom 43602a1 FullMAC PCIe firmware) +define Package/brcmfmac-firmware-43602a1-pcie/install $(INSTALL_DIR) $(1)/lib/firmware/brcm $(INSTALL_DATA) \ $(PKG_BUILD_DIR)/brcm/brcmfmac43602-pcie.ap.bin \ $(1)/lib/firmware/brcm/brcmfmac43602-pcie.bin +endef +$(eval $(call BuildPackage,brcmfmac-firmware-43602a1-pcie)) + +Package/brcmfmac-firmware-4366b1-pcie = $(call Package/firmware-default,Broadcom 4366b1 FullMAC PCIe firmware) +define Package/brcmfmac-firmware-4366b1-pcie/install + $(INSTALL_DIR) $(1)/lib/firmware/brcm $(INSTALL_DATA) \ $(PKG_BUILD_DIR)/brcm/brcmfmac4366b-pcie.bin \ $(1)/lib/firmware/brcm/ endef -$(eval $(call BuildPackage,brcmfmac-firmware-pcie)) +$(eval $(call BuildPackage,brcmfmac-firmware-4366b1-pcie)) Package/brcmfmac-firmware-sdio = $(call Package/firmware-default,Broadcom BCM43xx fullmac SDIO firmware) define Package/brcmfmac-firmware-sdio/install diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index 5c0ca3f..44a2b43 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -682,7 +682,7 @@ define KernelPackage/brcmfmac TITLE:=Broadcom IEEE802.11n USB FullMAC WLAN driver URL:=https://wireless.wiki.kernel.org/en/users/drivers/brcm80211 DEPENDS+= @USB_SUPPORT +kmod-cfg80211 +@DRIVER_11N_SUPPORT +kmod-brcmutil \ - +BRCMFMAC_PCIE:brcmfmac-firmware-pcie \ + +BRCMFMAC_PCIE:brcmfmac-firmware-43602a1-pcie +BRCMFMAC_PCIE:brcmfmac-firmware-4366b1-pcie \ +BRCMFMAC_SDIO:kmod-mmc +BRCMFMAC_SDIO:brcmfmac-firmware-sdio \ +BRCMFMAC_USB:kmod-usb-core +BRCMFMAC_USB:brcmfmac-firmware-usb FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko -- 2.9.3 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH 3/5] mtd: add fixwrgg command
On 11 September 2016 at 18:12, Stijn Tintel wrote: > Based on fixseama. And that way you could inherit some issues from seama support. So it's not just your fault that much ;) > @@ -53,6 +53,7 @@ > > #define TRX_MAGIC 0x48445230 /* "HDR0" */ > #define SEAMA_MAGIC0x5ea3a417 > +#define WRGG03_MAGIC 0x20080321 > > #if !defined(__BYTE_ORDER) > #error "Unknown byte order" > @@ -61,9 +62,11 @@ > #if __BYTE_ORDER == __BIG_ENDIAN > #define cpu_to_be32(x) (x) > #define be32_to_cpu(x) (x) > +#define le32_to_cpu(x) bswap_32(x) > #elif __BYTE_ORDER == __LITTLE_ENDIAN > #define cpu_to_be32(x) bswap_32(x) > #define be32_to_cpu(x) bswap_32(x) > +#define le32_to_cpu(x) (x) > #else > #error "Unsupported endianness" > #endif I'm not sure if this works at all with musl and without endian.h. See my question at musl ML: Using __BYTE_ORDER without endian.h http://www.openwall.com/lists/musl/2015/06/22/3 > @@ -0,0 +1,189 @@ > +/* > + * wrgg.c > + * > + * Copyright (C) 2005 Mike Baker > + * Copyright (C) 2008 Felix Fietkau > + * Copyright (C) 2011-2012 Gabor Juhos > + * Copyright (C) 2016 Stijn Tintel > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License > + * as published by the Free Software Foundation; either version 2 > + * of the License, or (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + * > + * You should have received a copy of the GNU General Public License > + * along with this program; if not, write to the Free Software > + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, > USA. > + */ Is this OK to include physical address of the foundation? I think it has already changed once and I *think* it was recommended not to include it. > +#if __BYTE_ORDER == __BIG_ENDIAN > +#define STORE32_LE(X) X) & 0x00FF) << 24) | (((X) & > 0xFF00) << 8) | (((X) & 0x00FF) >> 8) | (((X) & 0xFF00) >> 24)) > +#elif __BYTE_ORDER == __LITTLE_ENDIAN > +#define STORE32_LE(X) (X) > +#else > +#error unknown endianness! > +#endif Same here: does it work? ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
Re: [LEDE-DEV] [PATCH 5/5] ar71xx: add support for D-Link DAP-2695 rev. A1
On 12 September 2016 at 00:12, Stijn Tintel wrote: > Signed-off-by: Stijn Tintel > --- > package/boot/uboot-envtools/files/ar71xx | 1 + > target/linux/ar71xx/base-files/etc/board.d/01_leds | 5 + > .../linux/ar71xx/base-files/etc/board.d/02_network | 5 + > .../etc/hotplug.d/firmware/11-ath10k-caldata | 4 + > .../base-files/etc/uci-defaults/09_fix-checksum| 9 + > target/linux/ar71xx/base-files/lib/ar71xx.sh | 3 + > .../ar71xx/base-files/lib/upgrade/platform.sh | 13 ++ > target/linux/ar71xx/config-4.4 | 1 + > .../ar71xx/files/arch/mips/ath79/Kconfig.openwrt | 9 + > target/linux/ar71xx/files/arch/mips/ath79/Makefile | 1 + > .../files/arch/mips/ath79/mach-dap-2695-a1.c | 191 > + > .../linux/ar71xx/files/arch/mips/ath79/machtypes.h | 1 + > target/linux/ar71xx/image/generic.mk | 38 > 13 files changed, 281 insertions(+) > create mode 100644 > target/linux/ar71xx/files/arch/mips/ath79/mach-dap-2695-a1.c We have just got rid of the 09_fix-seama-header by excluding jffs2 marker from the calculation of checksum. The result image flashes just fine because it looks like the device will flash the whole uploaded file instead of just the size in the image header. If that is also the case with fixwrgg then we can save a few flash block erases. yousong ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 6/6] mvebu: Add check-size when append-kernel is used
When append-kernel is used and a KERNEL_SIZE is defined, we need to make sure that our kernel fits within it's partition size. Signed-off-by: Chris Blake --- target/linux/mvebu/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile index 7900fb9..b251834 100644 --- a/target/linux/mvebu/image/Makefile +++ b/target/linux/mvebu/image/Makefile @@ -72,7 +72,7 @@ endef define Device/UBI-factory $(Device/UBI) IMAGES += factory.img - IMAGE/factory.img := append-kernel (KERNEL_SIZE) | append-ubi | pad-to (PAGESIZE) + IMAGE/factory.img := append-kernel (KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-ubi | pad-to (PAGESIZE) endef define Device/NAND-128K -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 4/6] ipq806x: Add check-size when append-kernel is used
When append-kernel is used and a KERNEL_SIZE is defined, we need to make sure that our kernel fits within it's partition size. Signed-off-by: Chris Blake --- target/linux/ipq806x/image/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/ipq806x/image/Makefile b/target/linux/ipq806x/image/Makefile index daf910e..0fa881f 100644 --- a/target/linux/ipq806x/image/Makefile +++ b/target/linux/ipq806x/image/Makefile @@ -156,7 +156,7 @@ define Device/EA8500 PROFILES += $$(DEVICE_NAME) BOARD_NAME := ea8500 IMAGES := factory.bin sysupgrade.tar - IMAGE/factory.bin := append-kernel | pad-to {KERNEL_SIZE} | append-ubi + IMAGE/factory.bin := append-kernel | check-size $$(KERNEL_SIZE) | pad-to {KERNEL_SIZE} | append-ubi IMAGE/sysupgrade.tar := sysupgrade-tar DEVICE_TITLE := Linksys EA8500 DEVICE_PACKAGES := ath10k-firmware-qca99x0 -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 0/6] Add check-size when append-kernel is used
These patches are the outcome of discussions had at http://lists.infradead.org/pipermail/lede-dev/2016-September/002693.html, where append-kernel was failing to properly offset kernels due to a typo. Out of this, it was also found that kernels are not checked for size, which can cause issues down the line as kernel images get larger over time. The following series of patches ensures that any kernel added by append-kernel is checked to ensure it fits within it's defined size on targets that use this function. Cc: Mathias Kresin Signed-off-by: Chris Blake Chris Blake (6): apm821xx: Add default kernel size apm821xx: Add check-size when append-kernel is used ar71xx: Add check-size when append-kernel is used ipq806x: Add check-size when append-kernel is used kirkwood: Add check-size when append-kernel is used mvebu: Add check-size when append-kernel is used target/linux/apm821xx/image/Makefile | 5 +++-- target/linux/ar71xx/image/generic.mk | 4 ++-- target/linux/ar71xx/image/ubnt.mk| 2 +- target/linux/ipq806x/image/Makefile | 2 +- target/linux/kirkwood/image/Makefile | 4 ++-- target/linux/mvebu/image/Makefile| 2 +- 6 files changed, 10 insertions(+), 9 deletions(-) -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 3/6] ar71xx: Add check-size when append-kernel is used
When append-kernel is used and a KERNEL_SIZE is defined, we need to make sure that our kernel fits within it's partition size. Signed-off-by: Chris Blake --- target/linux/ar71xx/image/generic.mk | 4 ++-- target/linux/ar71xx/image/ubnt.mk| 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk index 10717cb..3aeff12 100644 --- a/target/linux/ar71xx/image/generic.mk +++ b/target/linux/ar71xx/image/generic.mk @@ -410,7 +410,7 @@ define Device/NBG6616 CMDLINE += mem=128M IMAGES := sysupgrade.bin KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 boot/vmlinux.lzma.uImage - IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) # We cannot currently build a factory image. It is the sysupgrade image # prefixed with a header (which is actually written into the MTD device). # The header is 2kiB and is filled with 0xff. The format seems to be: @@ -443,7 +443,7 @@ define Device/c-55 KERNEL_SIZE = 2048k IMAGE_SIZE = 15872k MTDPARTS = spi0.0:256k(u-boot)ro,128k(u-boot-env)ro,2048k(kernel),13824k(rootfs),13824k(opt)ro,2624k(failsafe)ro,64k(art)ro,15872k@0x6(firmware) - IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) endef TARGET_DEVICES += c-55 diff --git a/target/linux/ar71xx/image/ubnt.mk b/target/linux/ar71xx/image/ubnt.mk index 99496f7..2d0d464 100644 --- a/target/linux/ar71xx/image/ubnt.mk +++ b/target/linux/ar71xx/image/ubnt.mk @@ -261,7 +261,7 @@ define Device/ubnt-uap-pro DEVICE_PROFILE := UBNT UAPPRO KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma | jffs2 kernel0 IMAGES := sysupgrade.bin factory.bin - IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) + IMAGE/sysupgrade.bin = append-kernel $$(KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-rootfs | pad-rootfs | check-size (IMAGE_SIZE) IMAGE/factory.bin = $$(IMAGE/sysupgrade.bin) | mkubntimage2 endef -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 5/6] kirkwood: Add check-size when append-kernel is used
When append-kernel is used and a KERNEL_SIZE is defined, we need to make sure that our kernel fits within it's partition size. Signed-off-by: Chris Blake --- target/linux/kirkwood/image/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index 33eaa4f..92d32cb 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -59,7 +59,7 @@ define Device/linksys-audi FILESYSTEMS := squashfs PROFILES := Generic AUDI IMAGES += factory.bin - IMAGE/factory.bin := append-kernel (KERNEL_SIZE) | append-ubi + IMAGE/factory.bin := append-kernel (KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-ubi endef define Device/linksys-viper @@ -68,7 +68,7 @@ define Device/linksys-viper FILESYSTEMS := squashfs PROFILES := Generic VIPER IMAGES += factory.bin - IMAGE/factory.bin := append-kernel (KERNEL_SIZE) | append-ubi + IMAGE/factory.bin := append-kernel (KERNEL_SIZE) | check-size $$(KERNEL_SIZE) | append-ubi endef define Image/BuildKernel/Template -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 1/6] apm821xx: Add default kernel size
Adding a default KERNEL_SIZE will ensure that we have an option for check-size when used on any future targets. Signed-off-by: Chris Blake --- target/linux/apm821xx/image/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 607df06..7ab46f7 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -13,6 +13,7 @@ define Device/Default KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts) DEVICE_PROFILE := DEVICE_DTS := + KERNEL_SIZE := 2048k KERNEL_ENTRY := 0x KERNEL_LOADADDR := 0x DEVICE_DTS_DIR := ../dts -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev
[LEDE-DEV] [PATCH 2/6] apm821xx: Add check-size when append-kernel is used
When append-kernel is used and a KERNEL_SIZE is defined, we need to make sure that our kernel fits within it's partition size. Signed-off-by: Chris Blake --- target/linux/apm821xx/image/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 7ab46f7..cc145e3 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -158,8 +158,8 @@ define Device/WNDR4700 KERNEL_SIZE := 1920k KERNEL := dtb | kernel-bin | lzma | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | append-fakerootfs KERNEL_INITRAMFS := kernel-bin | gzip | dtb | wndr4700-specialImage gzip - IMAGE/factory.img := create-uImage-dtb | append-kernel | pad-to 2M | append-ubi | \ - netgear-dni | check-size (IMAGE_SIZE) + IMAGE/factory.img := create-uImage-dtb | append-kernel | check-size $$(KERNEL_SIZE) | pad-to 2M | \ + append-ubi | netgear-dni | check-size (IMAGE_SIZE) IMAGE/sysupgrade.tar := sysupgrade-tar NETGEAR_BOARD_ID := WNDR4700 NETGEAR_HW_ID := 29763875+128+256 -- 2.7.4 ___ Lede-dev mailing list Lede-dev@lists.infradead.org http://lists.infradead.org/mailman/listinfo/lede-dev