Discussion:
[uClinux-dev] finding the root device
Richard Cochran
2012-09-20 10:38:09 UTC
Permalink
I am running mainline Linux on the Freescale/Axiom M5234BCC with uboot
2011.09-01111-g0562219 and have been carrying along a patch from the
uClinux-dist, like shown below for v3.2.9.

I create a image by concatenating the kernel with a romfs, and I boot
it by loading over tftp and jumping to the image with the uboot 'go'
command.

My question: Is there a way to pass the kernel command line from uboot
to specify the root device, instead of using this patch?

Thanks,
Richard


diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 6793074..9cf7df5 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -15,6 +15,7 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/major.h>
+#include <linux/root_dev.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
@@ -89,6 +90,7 @@ static int __init uclinux_mtd_init(void)
mtd->priv = mapp;

uclinux_ram_mtdinfo = mtd;
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0);
mtd_device_register(mtd, uclinux_romfs, NUM_PARTITIONS);

return(0);
Erwin Authried
2012-09-20 10:46:53 UTC
Permalink
Hi,

you can use something like "root=31:00" in the kernel cmdline.

Regards,
Erwin
Post by Richard Cochran
I am running mainline Linux on the Freescale/Axiom M5234BCC with uboot
2011.09-01111-g0562219 and have been carrying along a patch from the
uClinux-dist, like shown below for v3.2.9.
I create a image by concatenating the kernel with a romfs, and I boot
it by loading over tftp and jumping to the image with the uboot 'go'
command.
My question: Is there a way to pass the kernel command line from uboot
to specify the root device, instead of using this patch?
Thanks,
Richard
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 6793074..9cf7df5 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -15,6 +15,7 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/major.h>
+#include <linux/root_dev.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
@@ -89,6 +90,7 @@ static int __init uclinux_mtd_init(void)
mtd->priv = mapp;
uclinux_ram_mtdinfo = mtd;
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0);
mtd_device_register(mtd, uclinux_romfs, NUM_PARTITIONS);
return(0);
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
--
Dipl.-Ing. Erwin Authried
Softwareentwicklung und Systemdesign
Greg Ungerer
2012-09-21 06:18:02 UTC
Permalink
Hi Richard,
Post by Richard Cochran
I am running mainline Linux on the Freescale/Axiom M5234BCC with uboot
2011.09-01111-g0562219 and have been carrying along a patch from the
uClinux-dist, like shown below for v3.2.9.
I create a image by concatenating the kernel with a romfs, and I boot
it by loading over tftp and jumping to the image with the uboot 'go'
command.
My question: Is there a way to pass the kernel command line from uboot
to specify the root device, instead of using this patch?
I haven't used uboot on ColdFire, so I am not sure if there is a
standard way to pass kernel parameters.

But you can always build command line options into your kernel config.
Look in the "Kernel Hacking" -> "Compiled-in Kernel Boot Parameter".
I always do this with stock kernels, setting the command line to
"root=/dev/mtdblock0" in the config.

Regards
Greg
Post by Richard Cochran
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 6793074..9cf7df5 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -15,6 +15,7 @@
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/major.h>
+#include <linux/root_dev.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
@@ -89,6 +90,7 @@ static int __init uclinux_mtd_init(void)
mtd->priv = mapp;
uclinux_ram_mtdinfo = mtd;
+ ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, 0);
mtd_device_register(mtd, uclinux_romfs, NUM_PARTITIONS);
return(0);
_______________________________________________
uClinux-dev mailing list
uClinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by uclinux-dev at uclinux.org
http://mailman.uclinux.org/mailman/options/uclinux-dev
--
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg at snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close FAX: +61 7 3217 5323
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
Lennart Sorensen
2012-09-21 14:33:04 UTC
Permalink
Post by Greg Ungerer
I haven't used uboot on ColdFire, so I am not sure if there is a
standard way to pass kernel parameters.
We added it and use it. I believe all needed patches went upstream.
If something is missing we will resend them.
Post by Greg Ungerer
But you can always build command line options into your kernel config.
Look in the "Kernel Hacking" -> "Compiled-in Kernel Boot Parameter".
I always do this with stock kernels, setting the command line to
"root=/dev/mtdblock0" in the config.
This commit should have taken care of the kernel side:

commit 588baeac38829304390b690142376d2c71ac5c9f
Author: Lennart Sorensen <lsorense at csclub.uwaterloo.ca>
Date: Fri Sep 18 13:49:36 2009 -0400

m68knommu: add uboot commandline argument passing support

This patch adds m68knommu support for getting the kernel command line
arguments from uboot, including the passing of an initrd image from uboot.

We use this on a 5270/5271 based board, and have used it on the 5271evb
development board. It is based on a patch found in the linux-2.6-denx
git tree, although that tree seems to have had lots of other changes
since which are not in the main Linus kernel. I believe this will work
on all coldfires, although other m68knommu might be missing the _init_sp
stuff in head.S as far as I can tell. I only have the coldfire to
test on.

Signed-off-by: Lennart Sorensen <lsorense at csclub.uwaterloo.ca>
Signed-off-by: Greg Ungerer <gerg at uclinux.org>

I hope the u-boot side got sent upstream. I should ask the guy that
works on that. It looks to me as if the u-boot git tree has support
for m68k kernel arguments. So as long as you use something not too old
it should work.
--
Len Sorensen
Richard Cochran
2012-09-22 04:55:28 UTC
Permalink
Post by Lennart Sorensen
Post by Greg Ungerer
I haven't used uboot on ColdFire, so I am not sure if there is a
standard way to pass kernel parameters.
We added it and use it. I believe all needed patches went upstream.
If something is missing we will resend them.
Thanks for the info. I did see that both uboot and linux appear to
have support for this, but I couldn't get it working with the minimal
effort that I put into it.

If I get the time one day, then I will revisit this. For now, the
compiled in command line is the easy fix.

Thanks,
Richard

Richard Cochran
2012-09-22 04:52:18 UTC
Permalink
Post by Greg Ungerer
But you can always build command line options into your kernel config.
Look in the "Kernel Hacking" -> "Compiled-in Kernel Boot Parameter".
I always do this with stock kernels, setting the command line to
"root=/dev/mtdblock0" in the config.
Thanks, this is just what I was looking for. BTW, arch arm has the
same idea, CONFIG_CMDLINE, but in a different place.

Prompt: Default kernel command string
Defined at arch/arm/Kconfig:2025
Location:
-> Boot options

Thanks,
Richard
Continue reading on narkive:
Loading...