Chadster766 / McDebian

Linksys WRT3200ACM, WRT1900AC, WRT1900ACS, WRT1200AC and WRT32X Router Debian Implementation
99 stars 14 forks source link

Script needed for firmware and module updating #12

Closed Chadster766 closed 8 years ago

Chadster766 commented 8 years ago

We need a script that will use fw_printenv to get the u-boot envars flash_pri_image and flash_alt_image in order to flash a new firmware (McDebian or other) to the WRT1x00AC\S using nandwrite command.

ValCher1961 commented 8 years ago

If the download from of file system, would be useful.

Chadster766 commented 8 years ago

@ValCher1961 I'm not clear on you comment. Do you mean install firmware from file system or download root file system updates?

ValCher1961 commented 8 years ago

Load the kernel from Debian. Something similar to - http://gumstix.org/how-to/70-writing-images-to-flash.html

Chadster766 commented 8 years ago

Great thanks, It might be as simple as flash_erase and nandwrite to the correct MTD image partitions.

ValCher1961 commented 8 years ago

In principle, we do not need a lot, and only checking the correctness of the recording and control of the length of the selected area in the nand. If something goes wrong, then everything can be corrected in the u-boot.

Chadster766 commented 8 years ago

Right I think we have a lot of firmware space in the WRT1900AC V2 but are the MTD partitions the same size in the other WRT1x00AC\S models?

mtd4
Name:                           kernel1
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          320 (41943040 bytes, 40.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       64 bytes
Character device major/minor:   90:8
Bad blocks are allowed:         true
Device is writable:             true

mtd6
Name:                           kernel2
Type:                           nand
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          320 (41943040 bytes, 40.0 MiB)
Minimum input/output unit size: 2048 bytes
Sub-page size:                  2048 bytes
OOB size:                       64 bytes
Character device major/minor:   90:12
Bad blocks are allowed:         true
Device is writable:             true
Chadster766 commented 8 years ago

The script could parse the MTD listing for name of "kernel1" and "kernel2" and then write to those MTD partition without being concerned with size because there is more than enough room in those partitions for McDebian firmware.

ValCher1961 commented 8 years ago

Yes, pre-set variables in u-boot: pri kern_size 0x2800000 alt_kern_size 0x2800000

ValCher1961 commented 8 years ago

The model has a core size difference, but using the new variables we remove these differences.

Chadster766 commented 8 years ago

I think the new WRT1x00AC\S all use the same MTD partitioning since the u-boot kwb recovery file is the same for them.

ValCher1961 commented 8 years ago

That's right, see the wiki - http://wiki.openwrt.org/toh/linksys/wrt1x00ac_series

Chadster766 commented 8 years ago

It turns out only a short McDebian Wiki page is needed instead of a script.

I tested the below process to load McDebian firmware and it's good for WRT1x00AC\S models.

flash_erase /dev/mtd4 0 0
flash_erase /dev/mtd6 0 0
nandwrite -p /dev/mtd4 McDebian-WRT1?00AC-V?-FW_VER1_kernel_4_4_17.img
nandwrite -p /dev/mtd6 McDebian-WRT1?00AC-V?-FW_VER1_kernel_4_4_17.img

Keep in mind that if the McDebian firmware has changed to a new kernel than there would also be a matching McDebian rootfs update (modules update) that would have to be applied before restarting the router.

I haven't tried loading Linksys stock firmware with this process yet.

Chadster766 commented 8 years ago

I've tested loading Linksys stock firmware and it works fine.

ValCher1961 commented 8 years ago

Well, I also checked out yesterday, all is well!