Synology rt2600ac support thread


#1

Update: Serial access no longer required

Although still only advised for experienced users

Testers / Developers Help Needed

Please let me know if your willing to test some development builds for this device. It will help if you have serial access / experience with development although that is not necessarily required.

GitHub Fork

Github test branch online....... figured rather than slog out a static usb .bin... this would be a better way to progress...

https://github.com/wulfy23/owrt-w23

Precompiled USB image -> For 6941

See github SYNOWRT.readme for instructions

https://drive.google.com/file/d/1oKN8O0weQA7W-HgUZVyKIxoP-ZcNBPCp/view?usp=sharing

Recommend basic command line skills.

Overall Status

-multi-core performance FIX1 10-10-19
-support external mmc reader partialFIX 06-03-19
-gpiochip0 primary leds FIXED 16-02-19

Outstanding Items

-switch and storage leds
-crypto
-multicore scheduler
-uboot rewrite workaround, same as below
-sysupgrade, same as below
-pat factory - most done, pending at least 10 people interested

Caveats:

  • Interrupting boot causes ubootvars to be reset.....
    Try not to ctrl-c / power cycle early in the boot process

Peace!

Setting up your usb / mmc drive

[  part1 ]    ext2    boot
[  part2 ]     n/a     ( create then remove... fat for win? )
[  part3 ]    ext4    rootfs - if chosen
[  part4 ]    swap   optional - could be ext4 backup

labels are optional

#2

Nuts and Bolts of the webflash

Web"flash" is a two stage process. the listing below contains a basic nuts and bolts needed to formulate a flashable "image".

Basic tar file at the end of the day, which delivers two shell scripts.... the second "updater2" is where the magic happens.

These functions i'll be be building into the rootfs......... for now.... to aide in post install boot switching....

#!/bin/bash
#6941
brdir="/xsrc/wrt/_x-ipq/ipq23-18.06.2/v2.3.1"
wrt_bindir="bin/targets/ipq806x/generic"
wrt_patfilename="SRM_RT2600ac_7756.pat"
wrt_patdirname="synoPAT"
wrt_patdir="${brdir}/$wrt_bindir}/${wrt_patdirname}"
wrt_outdir="${brdir}/${wrt_bindir}"
wrt_insttype="uboot"
#synology #####################################################################
#wrt_kernel="${brdir}/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/synology_rt2600ac-uImage"
#wrt_ramfs="${brdir}/bin/targets/ipq806x/generic/openwrt-ipq806x-synology_rt2600ac-initramfs-uImage"
#wrt_rootfstgz="${brdir}/bin/targets/ipq806x/generic/openwrt-ipq806x-device-synology-rt2600ac-rootfs.tar.gz"
#wrt_dtb="${brdir}/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/image-qcom-ipq8065-rt2600ac.dtb"
###############################################################################



#nbg ###############################################################################
wrt_kernel="${brdir}/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/zyxel_nbg6817-uImage"
wrt_ramfs="${brdir}/bin/targets/ipq806x/generic/openwrt-ipq806x-zyxel_nbg6817-initramfs-uImage"
wrt_rootfstgz="${brdir}/bin/targets/ipq806x/generic/openwrt-ipq806x-rootfs.tar.gz"
wrt_dtb="${brdir}/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/image-qcom-ipq8065-nbg6817.dtb"
###################################################################################



rm -rf $wrt_patdir
mkdir -p $wrt_patdir




echo "##########################################################"
echo "##########################################################"
echo "##########################################################"
echo "Copying WRT images: ${wrt_bindir}/${wrt_patdirname}"
sleep 1
cp -a ${wrt_kernel} ${wrt_patdir}/kernel
cp -a ${wrt_ramfs} ${wrt_patdir}/ramfs
cp -a ${wrt_rootfstgz} ${wrt_patdir}/rootfs.tar.gz
cp -a ${wrt_dtb} ${wrt_patdir}/wrt.dtb
ls -lah $wrt_patdir
echo "##########################################################"
echo "##########################################################"
sleep 2





echo "Writing updater"
sleep 1
#################################################################
cat <<'EOF' > ${wrt_patdir}/updater
#!/bin/sh

logfile=
[ -d /volume1/public ] && \
    logfile=/volume1/public/install-log-`date +%Y%m%d_%H%M`.txt

[ ! -z "$logfile" ] && exec 1>$logfile
exec 2>&1

# trap all errors in terminate()
set -e
trap terminate 0

terminate()
{
    if [ $# -ne 2 ]; then
	ret=99
	msg="An error has occured. Check the logfile which has been saved on the public share (if it exists)."
    else
	case "$1" in
	    ok|OK)
		ret=42
		msg="$2"
		;;
	    fail*|FAIL*)
		ret=99
		msg="$2"
		;;
	    *)
		ret=99
		msg="$2"
		;;
	esac
    fi

    # save error message
    echo "extramsg=\"$msg\"" > /tmp/update.message
    echo "P:-$ret:" > /tmp/update.progress
    # remove trap
    trap 0
    sleep 5
    exit $ret
}


#locationwherethe.pat got extracted to
cd "${0%/*}"

arch=`uname -m`
eval `grep ^unique /etc/synoinfo.conf`
model="$unique"
unique=

# progress a bit..
echo "A:1:" > /tmp/update.progress
sleep 5
[ -f updater2 ] && . ./updater2
terminate
# eof
EOF
chmod 755 ${wrt_patdir}/updater
#################################################################




echo "Writing updater2"
sleep 1
#################################################################
cat <<'EoK' > ${wrt_patdir}/updater2
wrtinstall="/mnt/wrtinstall"
wrtlog="/mnt/wrtinstall/install.log"
mkdir -p /mnt/wrtinstall
mount -t ext4 /dev/mmcblk0p7 $wrtinstall

echo "Commancing install" >> $wrtlog
df -h >> $wrtlog

####################################### COPY EXTRACTED PATFILES
cp -a "*" $wrtinstall
tar -xzf $wrtinstall/rootfs.tar.gz -C $wrtinstall
sync
cd $wrtinstall;
cp ./sbin/bahbah* /sbin/
bahbah.sh
sleep 5

#exit 0
# terminate FAIL "An error has occured.."
#terminate OK "Everything is fine."
# eof
EoK
chmod 755 ${wrt_patdir}/updater2
#################################################################





echo "Creating checksum.syno"
sleep 1
#################################################################
rm -f "${wrt_patdir}/checksum.syno"
cat <<'EuF' > ${wrt_patdir}/checksum.syno
3881674181 1277 updater 2036 103
#Synocksum 1277 2036 103
EuF
chmod 755 "${wrt_patdir}/checksum.syno"
#################################################################
echo "##########################################################"
#ls -lah ${wrt_patdir} 
sleep 2





echo "Packing patfile ${wrt_patfilename}"
sleep 1
#################################################################
cd "${wrt_patdir}"
tar -cpf "../${wrt_patfilename}" *
du -chs ../${wrt_patfilename}

cp "../${wrt_patfilename}" ~/Desktop/
cd $brdir


#################################################################
echo "Finished, upload via synology web UI"
sleep 2

#3

Initial patchset.....

Well it seems that there ain't too much demand for this device.....

I have most of the backend here.... and then some.....

I'm new to all this patch, push, clone razzamatazz.... so I've whacked up an initial patchset....... to keep the ball rolling with core hardware and as an FYI to owners / developers on the architecture....

It is based on 18.06.2 ( edit: now rebased to master ) which as I understand... is technically incorrect and should be based off of master..... but hey...... as it's just an initial RFC et. al.... I think it might be more help than hindrance.......

( note: I think some crap crept in after a few builds.... anyone has any tips on avoiding that i'm all ears! )

Thanks to everyone who helped....... shoutout to Jow, slh, dlakelan, lleachii, Jeff, vgaetera and everyone else i've forgotten, common ends and uncommon means.

Peace.

EDIT: revised because i am learning quilt etc. etc. ( thanks slh )
https://github.com/wulfy23/c-no-syno/blob/master/92332-synology-rt2600-support-v1.2

DTS
-Leds need fine tuning
-External mmc slot needs definition
-Minuses? ( I'm sure there is a bit but at runtime cannot really tell )

SYSUPGRADE
-Mostly done ( offline ), not in patch - well what is in there is kinda ad-hoc and def not applyable, debugging as we speak

Advanced Reboot
-On the cards.... digesting options at the moment

If anyone uses this.... the factory is not usable..... use rootfs.tar.gz and / or tar -xf sysupgrade / initramfs.


#4

Just a very superficial review (and yes, for it to be useful, you need to rebase it against master and submit it formally):

  • build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/linux-ipq806x/linux-4.14.95/arch/arm/boot/dts/Makefile
    this mustn't be in the patch, it's generated at build time
  • package/boot/uboot-envtools/files/ipq806x
    don't remove support for other devices (netgear,r7800)
  • target/linux/ipq806x/Makefile
    • you remove "ramdisk" from the FEATURES definition, even if you need the additional "usb" featureset (and this shouldn't be needed for a native install on its internal eMMC. making it an optional feature --> DEVICE_PACKAGES) is better/ necessary, there shouldn't be any reason to remove "ramdisk"
    • DEFAULT_PACKAGES: this affects the package set for all ipq806x devices, while none of the other devices need these - if the rt2600 does indeed 'needs' them (at least lua, ubus and ncurses definately don't belong there), they need to go into DEVICE_PACKAGES for your device (alone).
  • target/linux/ipq806x/base-files/etc/board.d/01_leds
    • don't remove or change settings for other devices (buffalo,wxr-2533dhp, zyxel,nbg6817)
    • is ${boardname}:amber:wifi2g really necessary? 18.06.x and up should cover this by default (by implicit ath10k triggers), you configure what's enabled by default
  • target/linux/ipq806x/base-files/etc/board.d/02_network
    • don't remove support for other devices (buffalo,wxr-2533dhp, qcom,ipq8064-ap161)
    • review if the MAC address assignment is really correct, relative to the OEM firmware - it's possible, but not very likely that both ZyXEL and Synology really use the same strategy here
  • target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
    you are reverting this file to an older version, you really need to work against current (master) code here and only do changes for your device (this change actively breaks WLAN support for all ipq806x/ ath10k devices, as they won't be assigned a correct MAC address anymore).
    your only hunk here should be for the synology,rt2600ac (and you need to update it according to the changes done for the other devices)
  • target/linux/ipq806x/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
    dito
  • target/linux/ipq806x/base-files/lib/upgrade/platform.sh
    • don't remove support for other devices (buffalo,wxr-2533dhp, qcom,ipq8064-ap161)
    • your device specific upgrade invocation looks a bit complicated (should this go into the called script instead?), but I don't know your hardware well enough to comment further
    • blink_led(), is this really necessary or just left over from an old file you used as example?
  • target/linux/ipq806x/base-files/lib/upgrade/synology.sh
    remove lines left over from the nbg6817 file you took as example, this will make your script much easier to read - and it will kill probably 50% of its total size.
  • target/linux/ipq806x/files-4.14/arch/arm/boot/dts/qcom-ipq8065-rt2600ac.dts
    I don't know enough about the rt2600 to comment here
  • target/linux/ipq806x/image/Makefile
    don't do changes unrelated to your rt2600 here, the only change should be the hunks around define Device/SynologyImage and define Device/synology_rt2600ac, you should default to the -ct variant of the ath10k kernel modules and firmware for consistency reasons. your additional "DEVICE_PACKAGES" go here (use sparingly, only for hard requirements)
  • target/linux/ipq806x/profiles/00-default.mk
    this file shouldn't be changed in your patch

After these changes your patch set will become a lot smaller and easier to review (and it's really essential to work against current master, there have been significant changes recently/ post 18.06).