RB450G compiling the kernel

Luiz Otavio O Souza lists.br at gmail.com
Thu Jan 23 13:25:21 UTC 2014


On 5 January 2014 23:41, Adrian Chadd <adrian at freebsd.org> wrote:
> On 5 January 2014 02:17, Anton <felix_mail at mail.ru> wrote:
>> Hi Adrian,
>>
>> I can post my kernel configs after a week. If it's needed.


Sorry for jump in so late. I've a working kernel and hints for RB450G.
Please try the attached files (and apply the two patches).

Let me know if it works for you.

RB450G dmesg: http://pastebin.ca/2577635

Luiz
-------------- next part --------------
Index: sys/mips/atheros/if_arge.c
===================================================================
--- sys/mips/atheros/if_arge.c	(revision 254976)
+++ sys/mips/atheros/if_arge.c	(working copy)
@@ -372,6 +372,7 @@
 	long			eeprom_mac_addr = 0;
 	int			miicfg = 0;
 	int			readascii = 0;
+	int			invertunits;
 
 	sc = device_get_softc(dev);
 	sc->arge_dev = dev;
@@ -546,8 +547,11 @@
 		sc->arge_eaddr[4] = (rnd >> 16) & 0xff;
 		sc->arge_eaddr[5] = (rnd >> 8) & 0xff;
 	}
-	if (sc->arge_mac_unit != 0)
-		sc->arge_eaddr[5] +=  sc->arge_mac_unit;
+	if (resource_int_value(device_get_name(dev), 0, "invertunits",
+	    &invertunits) == 0)
+		sc->arge_eaddr[5] += !sc->arge_mac_unit;
+	else
+		sc->arge_eaddr[5] += sc->arge_mac_unit;
 
 	if (arge_dma_alloc(sc) != 0) {
 		error = ENXIO;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RB450G
Type: application/octet-stream
Size: 990 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-mips/attachments/20140123/53fa2b5a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RB450G.hints
Type: application/octet-stream
Size: 1789 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-mips/attachments/20140123/53fa2b5a/attachment-0001.obj>
-------------- next part --------------
Index: sys/conf/options.mips
===================================================================
--- sys/conf/options.mips	(revision 254976)
+++ sys/conf/options.mips	(working copy)
@@ -92,6 +92,7 @@
 AR71XX_REALMEM			opt_ar71xx.h
 AR71XX_ENV_UBOOT		opt_ar71xx.h
 AR71XX_ENV_REDBOOT		opt_ar71xx.h
+AR71XX_ENV_ROUTERBOOT		opt_ar71xx.h
 AR71XX_ATH_EEPROM		opt_ar71xx.h
 
 #
Index: sys/mips/atheros/ar71xx_machdep.c
===================================================================
--- sys/mips/atheros/ar71xx_machdep.c	(revision 254976)
+++ sys/mips/atheros/ar71xx_machdep.c	(working copy)
@@ -140,6 +140,32 @@
 	}
 }
 
+#ifdef	AR71XX_ENV_ROUTERBOOT
+/*
+ * RouterBoot gives us a command line argument with the available memory.
+ */
+static int
+ar71xx_routerboot_get_mem(int argc, char **argv)
+{
+	int i, board_mem;
+
+	/*
+	 * Protect ourselves from garbage in registers.
+	 */
+	if (!MIPS_IS_VALID_PTR(argv))
+		return (0);
+
+	for (i = 0; i < argc; i++) {
+		if (strncmp(argv[i], "mem=", 4) == 0) {
+			if (sscanf(argv[i] + 4, "%dM", &board_mem) == 1)
+				return (btoc(board_mem * 1024 * 1024));
+		}
+	}
+
+	return (0);
+}
+#endif
+
 void
 platform_start(__register_t a0 __unused, __register_t a1 __unused, 
     __register_t a2 __unused, __register_t a3 __unused)
@@ -183,7 +209,15 @@
 		}
 	}
 
+#ifdef	AR71XX_ENV_ROUTERBOOT
 	/*
+	 * RouterBoot informs the board memory as a command line argument.
+	 */
+	if (realmem == 0)
+		realmem = ar71xx_routerboot_get_mem(argc, argv);
+#endif
+
+	/*
 	 * Just wild guess. RedBoot let us down and didn't reported 
 	 * memory size
 	 */


More information about the freebsd-mips mailing list