OpenWrt Forum Archive

Topic: HLK-RM04 8MB Flash

The content of this topic has been archived on 11 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi-Link has started offering an 8MB flash, 32MB RAM module (I'm not sure if its widely available yet, and there doesn't appear to be any easily identifiable physical differences - labeling and whatnot).

I had no problem identifying the 32MB of ram, but I am having difficulties making use of the additional flash space. I'm compiling from the latest trunk.

If I add enough packages to the build, the sysupgrade file does not get built (it silently fails with "too big" error), so I'm fairly certain this is a simple build/compile configuration issue, and probably also a definition issue somewhere in the source.


I found this thread that seems to be of the same nature, but specific to another device:
https://forum.openwrt.org/viewtopic.php?id=32512

and this one, again, specific to another piece of hardware, although fairly similar:
http://8devices.com/community/viewtopic … &t=386


It looks like I need to modify the flash_layout layouts struct, but I dont know where to do this. "target/linux/ramips/dts/HLKRM04.dts" looks like a good place, but it does not specifically call out the rootfs or rootfd_data partitions, so I would imagine those are defined elsewhere, and not detected at runtime.

I also checked the kernel commandline and no mtdparts are defined there.



Here is the kernel log section where it identifies the 8MB flash, but does not extend rootfd_data to fill it:
It looks to be identifying the 8MB chip based on the boot log:
[    0.470000] m25p80 spi32766.0: found mx25l6405d, expected gd25q64
[    0.490000] m25p80 spi32766.0: mx25l6405d (8192 Kbytes)
[    0.500000] 4 ofpart partitions found on MTD device spi32766.0
[    0.510000] Creating 4 MTD partitions on "spi32766.0":
[    0.520000] 0x000000000000-0x000000030000 : "u-boot"
[    0.540000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.540000] 0x000000040000-0x000000050000 : "factory"
[    0.570000] 0x000000050000-0x000000400000 : "firmware"
[    0.570000] 0x000000152014-0x000000400000 : "rootfs"
[    0.590000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.620000] mtd: device 4 (rootfs) set to be root filesystem
[    0.630000] mtd: partition "rootfs_data" created automatically, ofs=0x370000, len=0x90000
[    0.650000] 0x000000370000-0x000000400000 : "rootfs_data"




Thoughts are greatly appreciated. Thanks!

Hi spanky,

Now that you mention it, I remember that I had to edit the target/linux/ramips/image/Makefile:
line 430 should be
BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default8M/squashfs,$(1),$(2),$(3),$(4))
instead of:
BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default4M/squashfs,$(1),$(2),$(3),$(4))

Also, edit the target/linux/ramips/dts/HLKRM04.dts file:
for the firmware partition, edit the "reg =" line to show the following:
reg = <0x50000 0x7b0000>;

That should do the trick. (I'm writing this based on my memories. If it still doesn't solve it for you, I'll boot my build VM, and take a closer look for you.)

I'm recompiling with those changes. I previously tried editing the Default8M (without changing the firmware reg line) and had all kinds of boot errors. I think the reg line should do the trick. I'll let you know what happens.

Looks like those 2 changes did the trick. Thanks!

# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    6.4M     32.0K      6.4M   0% /
/dev/root                 2.0M      2.0M         0 100% /rom
tmpfs                     6.4M     48.0K      6.4M   1% /tmp
tmpfs                     6.4M     32.0K      6.4M   0% /tmp/root
overlayfs:/tmp/root       6.4M     32.0K      6.4M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev


Now I just need to figure out how to compile uboot to turn off the serial port...

I'm glad, that it worked for you.
Can't help you with u-boot compilation though.

> Hi-Link has started offering an 8MB flash, 32MB RAM module
> (I'm not sure if its widely available yet,

Could you give us a link or some other information where you found this new 8MB/32MB module ?

Aliexpress. I emailed the seller (hlktech) and asked for the larger chip.

I guess I spoke too soon.... I recompiled a couple of times (I forgot to add mem=32M on the kernel commandline, but thats a separate issue). I added enough packages to bust through the 4M firmware image size, and heres what I have now:

# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                   14.3M     44.0K     14.3M   0% /
/dev/root                 4.0M      4.0M         0 100% /rom <<<<<<<<<<<<<<<<<
tmpfs                    14.3M     52.0K     14.3M   0% /tmp
tmpfs                    14.3M     44.0K     14.3M   0% /tmp/root
overlayfs:/tmp/root      14.3M     44.0K     14.3M   0% / <<<<<<<<<<<<<<
tmpfs                   512.0K         0    512.0K   0% /dev

My sysupgrade image is ~5MB, but it seems that /dev/root is limited to 4MB.

The overlay is coming from tmpfs (i.e. not the remaining part of the flash). overlay should be less than 4MB.

(Note: it worked fine with mem=32, but the image size <4MB)



I dont know where the boundary between rootfs and rootfs_data on the MTD is defined, but that seems like the issue.



heres the kernel log:
[    0.470000] m25p80 spi32766.0: found mx25l6405d, expected gd25q64
[    0.490000] m25p80 spi32766.0: mx25l6405d (8192 Kbytes)
[    0.490000] 4 ofpart partitions found on MTD device spi32766.0
[    0.510000] Creating 4 MTD partitions on "spi32766.0":
[    0.520000] 0x000000000000-0x000000030000 : "u-boot"
[    0.530000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.550000] 0x000000040000-0x000000050000 : "factory"
[    0.560000] 0x000000050000-0x000000800000 : "firmware"
[    0.580000] 0x0000001504f1-0x000000800000 : "rootfs"
[    0.580000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.620000] mtd: device 4 (rootfs) set to be root filesystem
[    0.620000] mtd: partition "rootfs_data" created automatically, ofs=0x520000, len=0x2e0000
[    0.650000] 0x000000520000-0x000000800000 : "rootfs_data"


I'm no expert, but it looks to me like the kernel is detecting the boundry, but further down the line when mounting, something goes amiss. I could be completely off on that.



Heres the /proc/mtd, if that offers any clues:

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00030000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"
mtd3: 007b0000 00010000 "firmware"
mtd4: 006afb0f 00010000 "rootfs"
mtd5: 002e0000 00010000 "rootfs_data"

spanky wrote:

Oh, it looks like they posted it as the HLK-RM04-E
....

I sent a mail to HlkTech and asked where to get it.
It's now available in the HLK Webshop as well.

Just a thought, and I'm definitely no expert, but have you tried using one of the other RT5350 images, from a system which already has 32M and 8M? I upgraded the ram to 32M on the HLK-RM04 modules I have, and to save having to recompile the kernel I use the MPRA2 images, which work perfectly.

I guess, I need some help.
I got the module today.

I Changed
-  firmware partition to reg = <0x50000 0x7b0000>;   in the DTS file
-  BuildFirmware/HLKRM04/squashfs=$(call BuildFirmware/Default8M/squashfs,$(1),$(2),$(3),$(4))   int the Makefile.
and recompiled it.
Installed the uboot256 and uploaded the openwrt-ramips-rt305x-hlk-rm04-initramfs-uImage.bin   
     ( 2: Load system code then write to Flash via TFTP. )

It boots - and everything looks fine - at first.
But when I reboot the HLK, is just says :

## Booting image at bc050000 ...
raspi_read: from:50000 len:40
.   Image Name:   HLK-RM02
   Created:      2014-10-10  17:45:46 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    994304 Bytes = 971 kB
   Load Address: 80000000
   Entry Point:  80000000
raspi_read: from:50040 len:f2c00
................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 32

Starting kernel ...


and that's it. Systems apparently stops.



Directly after uploading it with TFTP - when it's working - it says

 
## Booting image at bc050000 ...
raspi_read: from:50000 len:40
.   Image Name:   HLK-RM02
   Created:      2014-10-10  17:45:46 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    994304 Bytes = 971 kB
   Load Address: 80000000
   Entry Point:  80000000
raspi_read: from:50040 len:f2c00
................   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 32

Starting kernel ...

[    0.000000] Linux version 3.10.49 (root@walle1.tklinux.de) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r42162) ) #33 Fri Oct 10 19:44:50 CEST 2014
[    0.000000] SoC Type: Ralink RT5350 id:1 rev:3
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 0001964c (MIPS 24KEc) 
[    0.000000] MIPS: machine is HILINK HLK-RM04        
[    0.000000] Determined physical RAM map:               
[    0.000000]  memory: 02000000 @ 00000000 (usable)                                                                
[    0.000000] User-defined physical RAM map:       
[    0.000000]  memory: 02000000 @ 00000000 (usable)                                                                                                              
[    0.000000] Initrd not found or empty - disabling initrd 
[    0.000000] Zone ranges:                                            
[    0.000000]   Normal   [mem 0x00000000-0x01ffffff]  
[    0.000000] Movable zone start for each node               
[    0.000000] Early memory node ranges                        
[    0.000000]   node   0: [mem 0x00000000-0x01ffffff] 
[    0.000000] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes. 
[    0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 8128
[    0.000000] Kernel command line: rootfstype=squashfs,jffs2 mem=32M console=ttyS1,57600
[    0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[    0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Writing ErrCtl register=00004447
[    0.000000] Readback ErrCtl register=00004447
[    0.000000] Memory: 29352k/32768k available (2133k kernel code, 3416k reserved, 543k data, 200k init, 0k highmem)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    0.000000] CPU Clock: 360MHz
[    0.000000] Calibrating delay loop... 239.61 BogoMIPS (lpj=1198080)
[    0.070000] pid_max: default: 32768 minimum: 301
[    0.070000] Mount-cache hash table entries: 512
[    0.080000] pinctrl core: initialized pinctrl subsystem 
[    0.090000] NET: Registered protocol family 16   
[    0.110000] rt2880-pinmux pinctrl.1: invalid group "JTAG" for function "gpio"
[    0.140000] bio: create slab <bio-0> at 0
[    0.150000] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.160000] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.170000] rt2880_gpio 10000660.gpio: registering 6 gpios
[    0.180000] rt2880_gpio 10000660.gpio: registering 6 irq handlers
[    0.190000] Switching to clocksource MIPS        
[    0.200000] NET: Registered protocol family 2    
[    0.210000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[    0.230000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[    0.240000] TCP: Hash tables configured (established 512 bind 512)
[    0.250000] TCP: reno registered
[    0.260000] UDP hash table entries: 256 (order: 0, 4096 bytes) 
[    0.270000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.280000] NET: Registered protocol family 1
[    0.290000] rt-timer 10000100.timer: maximum frequncy is 7324Hz 
[    0.350000] squashfs: version 4.0 (2009/01/31) Phillip Lougher        
[    0.360000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.380000] msgmni has been set to 57
[    0.390000] io scheduler noop registered
[    0.400000] io scheduler deadline registered (default)
[    0.410000] Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled 
[    0.430000] 10000500.uart: ttyS0 at MMIO 0x10000500 (irq = 13) is a 16550A
[    0.440000] 10000c00.uartlite: ttyS1 at MMIO 0x10000c00 (irq = 20) is a 16550A
[    0.460000] console [ttyS1] enabled, bootconsole disabled
[    0.460000] console [ttyS1] enabled, bootconsole disabled
[    0.490000] m25p80 spi32766.0: found mx25l6405d, expected gd25q64
[    0.500000] m25p80 spi32766.0: mx25l6405d (8192 Kbytes)
[    0.510000] 4 ofpart partitions found on MTD device spi32766.0
[    0.520000] Creating 4 MTD partitions on "spi32766.0": 
[    0.530000] 0x000000000000-0x000000030000 : "u-boot"
[    0.550000] 0x000000030000-0x000000040000 : "u-boot-env"
[    0.560000] 0x000000040000-0x000000050000 : "factory"
[    0.580000] 0x000000050000-0x000000800000 : "firmware"
[    0.590000] 0x000000142c40-0x000000800000 : "rootfs"
[    0.600000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[    0.630000] mtd: device 4 (rootfs) set to be root filesystem
[    0.640000] mtd: partition "rootfs_data" created automatically, ofs=0x380000, len=0x480000 
[    0.660000] 0x000000380000-0x000000800000 : "rootfs_data"
[    0.680000] eth0: done loading                                
[    0.690000] rt2880_wdt 10000120.watchdog: Initialized
[    0.700000] TCP: cubic registered                                  
......
[   15.020000] rt305x-esw 10110000.esw: link changed 0x00
[   16.750000] rt305x-esw 10110000.esw: link changed 0x08
[   17.510000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0
[   17.550000] jffs2_build_filesystem(): unlocking the mtd device... done.
[   17.560000] jffs2_build_filesystem(): erasing all blocks after the end marker... [   20.440000] device eth0.1 entered promiscuous mode 
[   20.450000] device eth0 entered promiscuous mode 
[   20.480000] br-lan: port 1(eth0.1) entered forwarding state
[   20.490000] br-lan: port 1(eth0.1) entered forwarding state
[   22.490000] br-lan: port 1(eth0.1) entered forwarding state
done.
[   63.800000] jffs2: notice: (602) jffs2_build_xattr_subsystem: complete building xattr subsystem, 0 of xdatum (0 unchecked, 0 orphan) and 0 of xref (0 dead, 0 .
procd:  - init complete - 

/proc/mtd says :

 
dev:    size   erasesize  name                    
mtd0: 00030000 00010000 "u-boot"      
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00010000 00010000 "factory"      
mtd3: 007b0000 00010000 "firmware"   
mtd4: 006bd3c0 00010000 "rootfs"        
mtd5: 00480000 00010000 "rootfs_data"


df -h says

 
Filesystem                Size      Used Available Use% Mounted on
rootfs                    4.5M    268.0K      4.2M   6% /                  
/dev/root                 2.3M      2.3M         0 100% /rom            
tmpfs                    14.4M     48.0K     14.4M   0% /tmp          
tmpfs                    14.4M     20.0K     14.4M   0% /tmp/root   
tmpfs                   512.0K         0    512.0K   0% /dev             
/dev/mtdblock5            4.5M    268.0K      4.2M   6% /overlay 
overlayfs:/overlay        4.5M    268.0K      4.2M   6% /       

Interesting is maybe :
[    0.490000] m25p80 spi32766.0: found mx25l6405d, expected gd25q64
[    0.500000] m25p80 spi32766.0: mx25l6405d (8192 Kbytes)

Any ideas what could be wrong here, and why it won't boot ?


Thanks
FrankW

(Last edited by FrankW on 10 Oct 2014, 20:02)

Hi,

Did you edit the kernel command line?
What does it say in the .dts file? Did you happen to edit the kernel commandline in "make kernel_menuconfig"?

It seems suspicious to me, that there is no output. If the commandline doesn't tell the kernel where to print the boot messages, they won't show up on the serial console.
Btw, does it work after a "cold" reboot, or does it fail in that case as well? Alas, does it only boot once, after it has been written to flash?

Hi,

thank you for your reply.

I don't really know what the problem was, but I have a working system now.
I simply downloaded a new TRUNK, made the necessary changes for 8MB Flash and 32MB Ram,
and it is working !! Perfect.
I don't know what went wrong with the old version I used - but anyway. I have a working
system.

The discussion might have continued from here.