#18356: Netgear WG302v1 doesn't boot with BB/trunk images
---------------------------------+-----------------------------------
Reporter: barbaracus@… | Owner: developers
Type: defect | Status: new
Priority: high | Milestone: Barrier Breaker 14.07
Component: kernel | Version: Barrier Breaker 14.07
Keywords: wg302 wag302 kernel |
---------------------------------+-----------------------------------
The kernel stops right after:
'''
Uncompressing image ... booting the kernel.
'''
The image from Attitude boots.
I enabled the early_printk and got this further message:
{{{
Uncompressing Linux... done, booting the kernel.
Warning: Neither atags nor dtb found
}}}
and then, again, I got the hang.
Leveraging the early_print() I tried to pinpoint where exactly the code
hanged the access point.
I filled the code path with prints() and I found that the hang occurred in
the function dma_contiguous_remap() in arch/arm/mm/dma_mapping.c
I tried to print the values inside that function and they were basically
rubbish.
But the static variable dma_mmu_remap_num was set to 1835363645, hex
6D656D3D... they seemed like ASCII values and they *WERE*!
{{{mem=}}}
This investigation took me the whole afternoon, however I don't mind since
it's been pouring outside.
That strong hint led me soon to the culprit: it's the wg302v1_fixup()
that's overwriting memory with, no wonder, the "mem=32M" fixup...
wg302v1_fixup() in wg302v1-setup.c looks so wrong: it doesn't actually
check if it found the atag (and there is no ATAG_CMDLINE in the atag
list), yet it overwrites its contents with a big string.
I've come up with the following code, tested and working:
{{{
static char wg302v1_mem_fixup[] __initdata = " mem=32M";
static void __init wg302v1_fixup(struct tag *tags, char **cmdline,
struct meminfo *mi)
{
struct tag *t = tags;
char *p = *cmdline;
size_t fixlen, cmdlen;
/* Find the end of the tags table, taking note of any cmdline tag.
*/
for (; t->hdr.size; t = tag_next(t)) {
if (t->hdr.tag == ATAG_CMDLINE) {
p = t->u.cmdline.cmdline;
}
}
fixlen = strlen(wg302v1_mem_fixup);
cmdlen = strlen(p);
if (fixlen + cmdlen >= COMMAND_LINE_SIZE)
return;
/* append the fixup to the cmdline */
memmove(p + cmdlen, wg302v1_mem_fixup, fixlen + 1);
/* Overwrite the end of the table with a new cmdline tag. */
if (t->hdr.size) {
t->hdr.tag = ATAG_CMDLINE;
t->hdr.size = (sizeof (struct tag_header) + fixlen +
cmdlen + 1 + 4);
t = tag_next(t);
t->hdr.tag = ATAG_NONE;
t->hdr.size = 0;
}
}
}}}
I didn't actually check if the same issue was there also for other
machine_types.
Could any dev fix the outlined problem? Would you like a proper patch
against the pach in trunk?
--
Ticket URL: <https://dev.openwrt.org/ticket/18356>
OpenWrt <http://openwrt.org>
Opensource Wireless Router Technology
_______________________________________________
openwrt-tickets mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-tickets