New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ramips: add missing information to dlink headers #4096
Conversation
@bmork FYI |
I experience the same issues and can confirm these changes resolve the flashing problems. |
Sorry about that. Should have fixed it uo while messing with the partition splitter. But I wonder: Did the behaviour change with my mtdsplit changes? I believe it should not. Anyway, we can't currently have two partitions with automatic rootfs splitting AFAIK. To make that work, the splitter would have to be aware of which firmware partition the kernel was loaded from. One final, and somewhat unrelated, note: I believe the "read-only" property on secondary firmware partitions, or other non-critical partitions, does more harm than good. It's not like we do arbitrary writes to the partition if it is writable. And worst case if we do is still a bootable system, since OpenWrt boots from the primary partition anyway. The problem with having read-only is that it makes it really hard to fix anything if the bootloader decides to boot the "wrong" partition for some reason. We have plenty of experience with this from the Unifi AP AC series. In theory, you can just install the kmod-mtd-rw package to override the read-only, But if the problem is a kernel vs rootfs mismatch, which often will be the issue, then that isn't straight forward. So IMHO, read-only should be reserved for those few partitions we never want to modify and which are critical for the system, like the bootloader, device specific factory configuration, and calibration data. |
I didn't notice any change with mtdsplit this unit only boot's from firmware but the boot loader uses firmware2 as a backup about read only due to the DTSI covering a few models it's had to know which are used on witch models I did try to setup concat partitioning but failed to get it to work but these 2 partition@2980000 & partition@7780000 could also be used for other things |
That sounds familiar. I am currently trying to add support for the ZyXEL NR7101, which also is based on MT7621. It has exactly the same behaviour. I believe it comes from the chipset SDK and therefore is a cross-vendor thing. I tried to describe my observations of the scheme in the draft commit message. Scroll down to the section titled "Notes on the OEM/bootloader dual partition scheme" on The short version is that it's hard to make any good use of this scheme in OpenWrt. The best I've come up with is installing a working initramfs in the second partition. That will at least work as an emergency recovery installation. We could reserve only a smaller part of the secondary partition for that recovery initramfs, with a fixed split, and use the rest for an additional UBI. But I'm not sure the additional complexity is worth it. And we'd have to make sure the reserved part is large enough to hold any kernel image we install in the primary partition, in case the bootloader decides to copy it to the secondary. |
yes was thinking of fixing the kernel size so if it got bigger someone would have to change it manually |
I confirm this works for my device as well (DIR-853-A3) which is not part of openwrt yet. Since the device does not have a way to boot into the emergency mode with the reset button (or any other button I tried except through console). I just have to compile openwrt with the patch included - encrypt the image with imgcrypt (a 32 bit binary found in the dlink gpl source code) and just flash it directly from the stock Dlink web interface. |
target/linux/ramips/image/mt7621.mk
Outdated
check-size | ||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs |\ | ||
append-metadata | check-size | ||
IMAGE/factory.bin := append-kernel | append-rootfs | check-size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whitespace issue here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fixed
target/linux/ramips/image/mt7621.mk
Outdated
IMAGE/factory.bin := append-kernel | append-rootfs | uimage-padhdr 96 |\ | ||
check-size | ||
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs |\ | ||
append-metadata | check-size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hanging indent should be one tab only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure may have fixed it
* 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use SPDX license identifier instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried to change it hope it's right
target/linux/ramips/image/mt7621.mk
Outdated
IMAGES += factory.bin | ||
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata | ||
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \ | ||
IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi |\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change seems unneeded and unrelated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was the only "Whitespace" thing i could find
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Lucky1openwrt So this needs to become IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So with a space between |
and \
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, since this would mean it's not changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added space
Any update on this? The device is actually really powerful and I would really like to start using it. But it would be great to have proper official images for it. |
I think it's just going to sit here |
here is an rc2 with the header manually changed |
Thanks @Lucky1openwrt! @adschm What is needed to get this moving again? |
Well, first the remaining comment needs to be addressed. Apart from that, people that review the proposed change. |
@s-2 Can you please have a look? |
saw this one already (see my thumbs up in first post), can't say much about the uimage header though (this is not directly related to factory image encryption, but the payload itself), but I'm happy to see someone take care of these devices =) |
So if the whitespace issue is fixed, this could go in? |
Anyone willing to look into this and approve? @Lucky1openwrt fixed the whitespace issue. |
target/linux/ramips/image/Makefile
Outdated
@@ -144,6 +144,11 @@ define Build/uimage-padhdr | |||
mv $@.new $@ | |||
endef | |||
|
|||
define Build/uimage-sgehdr | |||
uimage_sgehdr -i $@ -o $@.new -m $(DEVICE_MODEL) -h $(DEVICE_VARIANT) -s V1.00000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: two spaces after $@.new ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably introduced when removing the line wrap that should be here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed space & added line wrap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adschm I guess the whitespace/line wrap issue is fixed now?
Is this mergeable now? I really would like to have sysupgrades for this nice dual cpu router? |
I have done all I can |
@adschm Is there any way we can get this merged? @Lucky1openwrt made the changes with the whitespaces? |
Can you please add the DIR-853-A3 in the code? |
thanks @blocktrron |
Merged commit is: |
Nice. So we can now flash the development builds? And use sysupgrades? |
just in the master branch tho |
Super. So will it appear as D-Link DIR-2660 A1 or D-Link DIR-2660 A2. |
I think they where all tagged with A1 |
Does this work with the original A1 hardware as well? |
if your uboot needs it then yes |
Meaning it is not backward compatible with early A1 hardware? |
meaning it's was not needed on the earlier boot loaders |
Hi, I spent 20 hours trying to find more information on how to make a D-link DIR 853 A2 device work with OpenWRT and I still couldn't, sorry if I apologize if I'm not searching right, but can you help me find it, I need make this equipment urgently. Thanks in advance for all your help. |
you need to capture the boot log from the serial console can't even find inf on the A2 and they differ in different parts of the world |
@Lucky1openwrt I just tried the latest 21.02.2 build and notice that the new headers for the A2 or not in the The weird thing is that the snapshot versions do contain the headers in |
the fix is only in the master branch |
you are welcome to make a pull request to v21 but I imaging v22 well be out before it's even looked at |
What is the risk if I try and the headers do not match? |
if it's not checked on boot then sydupgrade image will just work |
I think I tested it way back and it will go to recovery. So I should wait for 22 or use a snapshot (which gave me issues with EDIT: I see that also the factory images don't have the headers. I must have mixed up the files. |
i just tested the current master to test the new switch driver |
The master = snapshot right? So I should really stick to 21.02.2 then? |
in this case the master only has snapshots |
I'll manually fix the header in V2102.2 when i get a chance |
I really wish they would back port it to 21.02.x |
So the WIFI driver sucks in the 22.x.x snapshots. |
|
This my device: I accessed the router via Wireless (http://192.168.0.1) and managed to get this log below... Does it help to understand how I should proceed to make Open WRT work on this model of equipment? Sorry, I don't quite understand yet. 2020-07-14 12:55:40 [SYSLOG]: start BusyBox v1.12.1 br1 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BE br2 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BF br3 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:C0 eth2 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BA eth2.1 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BA eth2.2 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BA eth2.3 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BA eth2.4 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BA eth3 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BD lo Link encap:Local Loopback ra0 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BC rax0 Link encap:Ethernet HWaddr C4:E9:0A:4C:EE:BB |
the wifi driver in the Master snapshot didn't work 2 day's ago for me well stuck at 20Mhz only they have not branched v22 yet but i think it's soon just to clarify a Snapshot is a compilation of the current state of each branch here is the 21.02.2 factory with the header modification |
Thanks! Is it possible to also create a sysupgrade image? |
i can edit the header in the image but don't know the checksum stuff to do it manually |
This add header information needed so some of
the newer bootloader found in DIR-2660-A1 & A2
and a step closer to a web flash image
also fix a mislabelled flash partition type
by removing 2nd kernel & UBI partition
Signed-off-by: Alan Luck luckyhome2008@gmail.com