[OpenWrt-Devel] Anyone familiar with RouterBoot? Trying to port board.
David Hutchison
dhutchison at bluemesh.net
Tue Jan 27 12:56:13 EST 2015
I have everything working on the Mikrotik mAP2n within initramfs.
WLAN, LAN, USB, LEDs, and even the flash chip.
The problem is when I write the kernel to flash I cannot for the life
of me get RouterBOOT to recognize the kernel. My partition layout
looks like this:
static struct mtd_partition rbmap_spi_partitions[] = {
{
.name = "kernel",
.offset = 128 * 1024,
.size = 0x600000
},
{
.name = "rootfs",
.offset = 0x620000,
.size = MTDPART_SIZ_FULL
},
{
.name = "firmware",
.offset = 128 * 1024,
.size = MTDPART_SIZ_FULL
},
{
.name = "RouterBoot",
.offset = 0,
.size = 128 * 1024,
.mask_flags = MTD_WRITEABLE,
},
};
[ 3.700000] 0x000000020000-0x000001000000 : "firmware"
[ 3.710000] 0x000000130000-0x000001000000 : "rootfs"
[ 3.710000] mtd: partition "rootfs" set to be root filesystem
[ 3.720000] split_squashfs: no squashfs found in "spi0.0"
[ 3.720000] 0x000000020000-0x000000620000 : "kernel"
[ 3.730000] 0x000000620000-0x000001000000 : "rootfs"
[ 3.740000] 0x000000000000-0x000000020000 : "RouterBoot"
I know for sure that RouterBoot is 0x20000 in size. RouterOS starts at
0x20000 and is the only partition, it's size is MTDPART_SIZ_FULL. (
Without trying to get OpenWRT on )
I tried to define a kernel and rootfs partition, but that didn't seem
to work either.
Every other RouterBOARD I have ported too the kernel partition had to
be in YAFFS. However the mAP2n is a SPI flash. The partitions are not
passed by the bootloader, so they have to be defined somehow.
Is there anyone familiar with routerboot that could help point me in
the right direction? I was trying to mtdwrite vmlinux ( I even tried
dd ) to the kernel partition ( which would put it at 0x20000, where it
*should* be ).
The files I tried to write were:
openwrt-ar71xx-generic-vmlinux.bin
openwrt-ar71xx-generic-vmlinux.elf
no go, routerboot would output:
---
RouterBOOT backup booter 3.17
RouterBOARD mAP 2n
CPU frequency: 400 MHz
Memory size: 64 MiB
Storage size: 16 MiB
Press any key within 2 seconds to enter setup
loading kernel from nand... kernel not found
trying bootp protocol.... OK
---
Previous RouterBOARDS would not support compressed kernels, I tried
them anyway as this SPI flash seems new for Mikrotik... Still a no-go.
Here is the kernel cmdline within initramfs:
Kernel command line: bootimage=1 no-uart no-nand parts=1
boot_part_size=16777216 gpio=822077383 HZ=200000000 mem=64M
kmac=4C:5E:0C:CA:27:0E board=mAP boot=0 mlc=6
I'm not familiar with OpenWRT's image builder, so i'm not sure how I
could create an image for it. I'm not at this point yet, just trying
to get RouterBOOT to execute my kernel.
---
I have UART working but the RX on the board does not seem to see ANY
of my INPUT at the boot-loader level. I can see output, but cannot
provide input... I can't really look at the boot-loader directly :-/
Any ideas?
Here is my mach-rbmap.c thus far:
#include <linux/init.h>
#include <linux/pci.h>
#include <linux/platform_device.h>
#include <linux/ath9k_platform.h>
#include <linux/etherdevice.h>
#include <linux/ar8216_platform.h>
#include <linux/rle.h>
#include <linux/routerboot.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <linux/spi/spi.h>
#include <linux/spi/flash.h>
#include <asm/mach-ath79/irq.h>
#include <asm/mach-ath79/ath79.h>
#include <asm/mach-ath79/ar71xx_regs.h>
#include "common.h"
#include "dev-ap9x-pci.h"
#include "dev-eth.h"
#include "dev-spi.h"
#include "dev-gpio-buttons.h"
#include "dev-leds-gpio.h"
#include "dev-m25p80.h"
#include "dev-usb.h"
#include "dev-wmac.h"
#include "machtypes.h"
#include "routerboot.h"
#define RB_ROUTERBOOT_OFFSET 0x0000
#define RB_ROUTERBOOT_SIZE 0xe000
#define RB_HARD_CFG_OFFSET 0xe000
#define RB_HARD_CFG_SIZE 0x1000
#define RB_ART_SIZE 0x10000
static struct mtd_partition rbmap_spi_partitions[] = {
{
.name = "kernel",
.offset = 128 * 1024,
.size = 0x600000
},
{
.name = "rootfs",
.offset = 0x620000,
.size = MTDPART_SIZ_FULL
},
{
.name = "firmware",
.offset = 128 * 1024,
.size = MTDPART_SIZ_FULL
},
{
.name = "RouterBoot",
.offset = 0,
.size = 128 * 1024,
.mask_flags = MTD_WRITEABLE,
},
};
static struct flash_platform_data rbmap_spi_flash_data = {
.parts = rbmap_spi_partitions,
.nr_parts = ARRAY_SIZE(rbmap_spi_partitions),
};
static void __init rbmap_wlan_init(void)
{
u8 *hard_cfg = (u8 *) KSEG1ADDR(0x1f000000 + RB_HARD_CFG_OFFSET);
u16 tag_len;
u8 *tag;
char *art_buf;
u8 wlan_mac[ETH_ALEN];
int err;
err = routerboot_find_tag(hard_cfg, RB_HARD_CFG_SIZE, RB_ID_WLAN_DATA,
&tag, &tag_len);
if (err) {
pr_err("no calibration data found\n");
return;
}
art_buf = kmalloc(RB_ART_SIZE, GFP_KERNEL);
if (art_buf == NULL) {
pr_err("no memory for calibration data\n");
return;
}
err = rle_decode((char *) tag, tag_len, art_buf, RB_ART_SIZE,
NULL, NULL);
if (err) {
pr_err("unable to decode calibration data\n");
goto free;
}
ath79_init_mac(wlan_mac, ath79_mac_base, 11);
ath79_register_wmac(art_buf + 0x1000, wlan_mac);
free:
kfree(art_buf);
}
static void __init rbmap_setup(void)
{
ath79_register_m25p80(&rbmap_spi_flash_data);
ath79_register_mdio(0, 0x0);
ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
ath79_register_eth(0);
ath79_register_usb();
rbmap_wlan_init();
}
MIPS_MACHINE(ATH79_MACH_RB_MAP, "mAP", "Mikrotik mAP2n",
rbmap_setup);
-- Davey
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list