[Letux-kernel] jz4730 Ethernet - works now (unreliable and with some deficiencies)
H. Nikolaus Schaller
hns at goldelico.com
Sat Mar 13 13:30:24 CET 2021
> Am 12.03.2021 um 20:12 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
>
>> Am 12.03.2021 um 14:58 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>>
>> * where do we get the MAC address from?
>> - is there some EEPROM or NVRAM encoding the MAC address?
>> - the devices have a sticker with an individual MAC address printed on it - but that may just be the WiFI MAC
>> - in our good old l400-2.6 kernel there was a hack to call get_ethernet_addr() - have to research what it was doing
>
> Have looked into the old tree. It comes from U-Boot.
> But that code makes no sense to be ported.
>
> Better is this:
>
> U-Boot has an ethaddr environment variable which seems to be initialized
> by U-Boot to the MAC address printed on the sticker. Likely it is stored
> somewhere in a NAND partition which U-Boot knows how to read.
>
> Now the next question is if this is (was) only in the vendor-U-Boot or
> also in the new second phase U-Boot by Lubomir.
>
> Yes, it is available there as well.
>
> So all we have to do is to modify the bootargs to include ethaddr=${ethaddr}
> and pass it to the kernel.
>
> The driver already recognizes the ethaddr kernel module parameter, so
> everything should be fine.
>
> I have tried to modify our Letux boot.scr and the bootargs.scr and
> the kernel config to use the u-boot provided CMDLINE with ethaddr=${ethaddr}
> but that makes the kernel get stuck. Maybe some mistake in CONFIG...
Well, it looks as if passing the cmdline from the bootargs to the kernel
is broken.
I can take the identical cmdline (and do an echo in boot.scr just before running the bootm command)
and unless I specify CONFIG_CMDLINE_BOOL=y and the sa,e CONFIG_CMDLINE the kernel does not start.
I have also not seen that CONFIG_CMDLINE_OVERRIDE has any effect:
bootargs: mem=128M earlycon=jz4740_uart,mmio32,0x10030000,115200n8 console=tty0 ignore_loglevel console=ttyS0,115200n8 ethaddr=00:21:4D:01:00:EF root=/dev/mmcblk0p2 rw rootfstype=ext4,ext3 rootwait
## Booting kernel from Legacy Image at 84000000 ...
Image Name: Linux-5.12.0-rc2-letux-l400+
Image Type: MIPS Linux Kernel Image (gzip compressed)
Data Size: 5232756 Bytes = 5 MiB
Load Address: 80100000
Entry Point: 808d07dc
Verifying Checksum ... OK
## Flattened Device Tree blob at 81100000
Booting using the fdt blob at 0x81100000
Uncompressing Kernel Image
resp.
bootargs: mem=128M earlycon=jz4740_uart,mmio32,0x10030000,115200n8 console=tty0 ignore_loglevel console=ttyS0,115200n8 ethaddr=00:21:4D:01:00:EF root=/dev/mmcblk0p2 rw rootfstype=ext4,ext3 rootwait
## Booting kernel from Legacy Image at 84000000 ...
Image Name: Linux-5.12.0-rc2-letux-l400+
Image Type: MIPS Linux Kernel Image (gzip compressed)
Data Size: 5233749 Bytes = 5 MiB
Load Address: 80100000
Entry Point: 808d07dc
Verifying Checksum ... OK
## Flattened Device Tree blob at 81100000
Booting using the fdt blob at 0x81100000
Uncompressing Kernel Image
[ 0.000000] Linux version 5.12.0-rc2-letux-l400+ (hns at iMac.fritz.box) (mipsel-linux-gnu-gcc (GCC) 4.9.2, GNU ld (GNU Binutils) 2.25) #5298 PREEMPT Sat Mar 13 12:33:10 CET 2021
[ 0.000000] CPU0 revision is: 02d0024f (Ingenic XBurst)
[ 0.000000] MIPS: machine is Skytone Alpha 400
[ 0.000000] earlycon: jz4740_uart0 at MMIO32 0x10030000 (options '115200n8')
[ 0.000000] printk: bootconsole [jz4740_uart0] enabled
[ 0.000000] printk: debug: ignoring loglevel setting.
[ 0.000000] User-defined physical RAM map overwrite
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] cma: Reserved 32 MiB at 0x01800000
[ 0.000000] Primary instruction cache 16kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 16kB, 4-way, VIPT, no aliases, linesize 32 bytes
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000007ffffff]
[ 0.000000] On node 0 totalpages: 32768
[ 0.000000] Normal zone: 288 pages used for memmap
[ 0.000000] Normal zone: 0 pages reserved
[ 0.000000] Normal zone: 32768 pages, LIFO batch:7
[ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[ 0.000000] pcpu-alloc: [0] 0
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 32480
[ 0.000000] Kernel command line: mem=128M earlycon=jz4740_uart,mmio32,0x10030000,115200n8 console=tty0 ignore_loglevel console=ttyS0,115200n8 ethaddr=00:21:4D:01:00:EF root=/dev/mmcblk0p2 rw rootfstype=ext4,ext3 rootwait full_config
...
login:
But AFAIR there is currently discussion on LKML about a proposal to harmonize
the CMDLINE handling over all architectures. This may also fix such bugs...
Unless they are in U-Boot.
>
> Anyways, the idea is clear and just needs debugging to give the Alpha400
> units individual MAC addresses.
For the moment this has no high priority - I can live with some random MAC
on my LAN...
BR,
Nikolaus
More information about the Letux-kernel
mailing list