linux-mips
[Top] [All Lists]

MIPS - passing data to kernel

To: linux-mips@linux-mips.org
Subject: MIPS - passing data to kernel
From: Martin Hinner <martin@hinner.info>
Date: Fri, 27 Sep 2013 12:04:49 +0200
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
Hello,

 I am trying to port Linux to MIPS-based platform with custom
bootloader. I need to pass command line, initrd, and some parameters
such as memory size to kernel (preferably via device tree). The
devicetree is built/modified  in bootloader, so I cannot embed it in
kernel.

Please correct me if I am wrong:

- I think there is no standard for passing data to kernel, just some
firmwares use a0/a1 for argv/argc (in fw_init_cmdline).

- there is no standard for passing device tree on MIPS (does U-Boot
support this on MIPS? How?)

- the only way how to pass address/size of initramfs/initrd is via
commandline parameters (rd_start, rd_size)

What I would like to do is to pass initrd, device tree and commandline
to kernel. For example PowerPC has the following arguments on kernel
start which perfectly matches my needs:

  51 *   r3: ptr to board info data
  52 *   r4: initrd_start or if no initrd then 0
  53 *   r5: initrd_end - unused if r4 is 0
  54 *   r6: Start of command line string
  55 *   r7: End of command line string

Unfortunately MIPS ABI allows only a0..a3 (+stack arguments which is
of no use in this case) so I'll have to use either some sort of memory
structure (such as ATAGs used in ARMLinux/Android) or pass devicetree
address via register or commandline. I would prefer ATAG-like method
as it's much cleaner than other methods.

Any comments on this are welcome. I do not want to re-invent wheel.


Thank you,

Martin

<Prev in Thread] Current Thread [Next in Thread>
  • MIPS - passing data to kernel, Martin Hinner <=