Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

good way to identify board type on Marvell SoC NAS boxes?


I'm using kiyohara-san's orion_nas patch with Buffalo LinkStation Mini.

GPIO configuration is different from another NAS boxes. for now, I need
to make new kernel config and hard-code board specific configuration.

I want to add board identify code and share kernel between NAS boxes.

LS Mini has no serial console output (without jumper on board), so 
basically I can't access u-boot prompt.

for Linux kernel, u-boot passes machine-type via r1. but for NetBSD
kernel, no useful info is passed. u-boot calls entry point like as a

> loader = (void (*)(bd_t *, image_header_t *, char *, char *))images->ep;
> (*loader) (gd->bd, os_hdr, consdev, cmdline);


if I can access u-boot prompt, I can add board identify string to
cmdline or u-boot env. but I can't do it for LS Mini.

on LS Mini, ramdisk image is loaded at 0x00800000 (8MB) and preserved
at entry point of NetBSD. I embed magic number into last byte of image
header of ramdisk image, and I can retrieve it in NetBSD kernel.

        /* find ramdisk image header and save last byte as board_type */
        mov     r0, #8388608
        ldr     r1, [r0, #0]
        ldr     r2, Lmagic
        cmp     r1, r2
        ldreqb  r1, [r0, #63]
        adreq   r2, board_type
        streq   r1, [r2, #0]

(ramdisk load address should be extracted from cmdline)

image header is 64 bytes and last member of image header is 32 bytes for
NUL terminated string. magic number is embeded after NUL character.

in this way, shared kernel image can be used with board dependant
ramdisk image.

I think this is dirty hack, but I can't find another solution. please
give me a comment.



Attachment: marvell_start.S
Description: Binary data

Home | Main Index | Thread Index | Old Index