Re: [U-Boot] [PATCH] [ARM] Apollon UBI support v3

2008-11-02 Thread Kyungmin Park
On Mon, Nov 3, 2008 at 6:00 AM, Magnus Lilja <[EMAIL PROTECTED]> wrote:
> Dear Kyungmin Park,
>
> I've now used your patch series to add UBI support to the i.MX31
> Litekit board (in the NAND device present on that board) and have some
> additional comments on the series.
>
> 2008/10/28 Kyungmin Park <[EMAIL PROTECTED]>:
>> Now you can use the UBI at apollon board
>>
>> Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
>> ---
>> diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
>> new file mode 100644
>> index 000..10dd6e7
>> --- /dev/null
>> +++ b/board/apollon/ubi.c
>> @@ -0,0 +1,48 @@
>> +/*
>> + * board/apollon/ubi.c
>> + *
>> + *  Copyright (C) 2008 Samsung Electronics
>> + *  Kyungmin Park <[EMAIL PROTECTED]>
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +#include 
>> +
>> +int ubi_board_scan(void)
>> +{
>> +   struct mtd_device *dev;
>> +   struct part_info *part;
>> +   struct mtd_partition mtd_part;
>> +   char buffer[32];
>> +   u8 pnum;
>> +   int err;
>> +
>> +   if (mtdparts_init() != 0)
>> +   return 1;
>> +
>> +   if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
>> +   return 1;
>> +
>> +   sprintf(buffer, "mtd=%d", pnum);
>> +   mtd_part.name = buffer;
>> +   mtd_part.size = part->size;
>> +   mtd_part.offset = part->offset;
>> +   add_mtd_partitions(&onenand_mtd, &mtd_part, 1);
>
> I had some problems that boiled down to the fact that the unused
> fields of mtd_part caused problems in add_mtd_partitions(). Doing a
> memset(&mtd_part, 0, sizeif (mtd_part)) before the mtd_part.name line
> solved those problems.
>
Umm it's board specific file but it's reasonable to add the mtd_part
initialization.

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [ARM] Apollon UBI support v3

2008-11-02 Thread Magnus Lilja
Dear Kyungmin Park,

I've now used your patch series to add UBI support to the i.MX31
Litekit board (in the NAND device present on that board) and have some
additional comments on the series.

2008/10/28 Kyungmin Park <[EMAIL PROTECTED]>:
> Now you can use the UBI at apollon board
>
> Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
> ---
> diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
> new file mode 100644
> index 000..10dd6e7
> --- /dev/null
> +++ b/board/apollon/ubi.c
> @@ -0,0 +1,48 @@
> +/*
> + * board/apollon/ubi.c
> + *
> + *  Copyright (C) 2008 Samsung Electronics
> + *  Kyungmin Park <[EMAIL PROTECTED]>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +int ubi_board_scan(void)
> +{
> +   struct mtd_device *dev;
> +   struct part_info *part;
> +   struct mtd_partition mtd_part;
> +   char buffer[32];
> +   u8 pnum;
> +   int err;
> +
> +   if (mtdparts_init() != 0)
> +   return 1;
> +
> +   if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
> +   return 1;
> +
> +   sprintf(buffer, "mtd=%d", pnum);
> +   mtd_part.name = buffer;
> +   mtd_part.size = part->size;
> +   mtd_part.offset = part->offset;
> +   add_mtd_partitions(&onenand_mtd, &mtd_part, 1);

I had some problems that boiled down to the fact that the unused
fields of mtd_part caused problems in add_mtd_partitions(). Doing a
memset(&mtd_part, 0, sizeif (mtd_part)) before the mtd_part.name line
solved those problems.

Regards, Magnus
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [ARM] Apollon UBI support v3

2008-10-29 Thread Magnus Lilja
Dear Kyungmin Park,

2008/10/28 Kyungmin Park <[EMAIL PROTECTED]>:
> Now you can use the UBI at apollon board
>
> Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
> ---
> diff --git a/board/apollon/Makefile b/board/apollon/Makefile
> index 9bac9a6..4c3e57f 100644
> --- a/board/apollon/Makefile
> +++ b/board/apollon/Makefile
> @@ -25,9 +25,11 @@ include $(TOPDIR)/config.mk
>
>  LIB= $(obj)lib$(BOARD).a
>
> -COBJS  := apollon.o mem.o sys_info.o
> +COBJS-y:= apollon.o mem.o sys_info.o
> +COBJS-$(CONFIG_CMD_UBI) += ubi.o
>  SOBJS  := lowlevel_init.o
>
> +COBJS  := $(COBJS-y)
>  SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
>  OBJS   := $(addprefix $(obj),$(COBJS))
>  SOBJS  := $(addprefix $(obj),$(SOBJS))
> diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
> new file mode 100644
> index 000..10dd6e7
> --- /dev/null
> +++ b/board/apollon/ubi.c
> @@ -0,0 +1,48 @@
> +/*
> + * board/apollon/ubi.c
> + *
> + *  Copyright (C) 2008 Samsung Electronics
> + *  Kyungmin Park <[EMAIL PROTECTED]>
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +int ubi_board_scan(void)
> +{
> +   struct mtd_device *dev;
> +   struct part_info *part;
> +   struct mtd_partition mtd_part;
> +   char buffer[32];
> +   u8 pnum;
> +   int err;
> +
> +   if (mtdparts_init() != 0)
> +   return 1;
> +
> +   if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
> +   return 1;
> +
> +   sprintf(buffer, "mtd=%d", pnum);
> +   mtd_part.name = buffer;
> +   mtd_part.size = part->size;
> +   mtd_part.offset = part->offset;
> +   add_mtd_partitions(&onenand_mtd, &mtd_part, 1);
> +
> +   err = ubi_mtd_param_parse(buffer, NULL);
> +   if (err)
> +   return err;
> +
> +   err = ubi_init();
> +   if (err)
> +   return err;
> +
> +   return 0;
> +}
> diff --git a/include/configs/apollon.h b/include/configs/apollon.h
> index d71ed44..c694989 100644
> --- a/include/configs/apollon.h
> +++ b/include/configs/apollon.h
> @@ -53,6 +53,9 @@
>  #define CONFIG_SYS_USE_NOR 1
>  #endif
>
> +/* uncommnet if you want to use UBI */
> +#define CONFIG_SYS_USE_UBI

Seems like the #define has been uncommented already.


Also, a doc/README.ubi or something similar would be nice. Something
that contains info on how to enable UBI support for a new board. The
board/apollon/ubi.c could perhaps be used as an example but with more
comments in it.


Regards, Magnus
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] [ARM] Apollon UBI support v3

2008-10-28 Thread Kyungmin Park
Now you can use the UBI at apollon board

Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
---
diff --git a/board/apollon/Makefile b/board/apollon/Makefile
index 9bac9a6..4c3e57f 100644
--- a/board/apollon/Makefile
+++ b/board/apollon/Makefile
@@ -25,9 +25,11 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  := apollon.o mem.o sys_info.o
+COBJS-y:= apollon.o mem.o sys_info.o
+COBJS-$(CONFIG_CMD_UBI) += ubi.o
 SOBJS  := lowlevel_init.o
 
+COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
new file mode 100644
index 000..10dd6e7
--- /dev/null
+++ b/board/apollon/ubi.c
@@ -0,0 +1,48 @@
+/*
+ * board/apollon/ubi.c
+ *
+ *  Copyright (C) 2008 Samsung Electronics
+ *  Kyungmin Park <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int ubi_board_scan(void)
+{
+   struct mtd_device *dev;
+   struct part_info *part;
+   struct mtd_partition mtd_part;
+   char buffer[32];
+   u8 pnum;
+   int err;
+
+   if (mtdparts_init() != 0)
+   return 1;
+
+   if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
+   return 1;
+
+   sprintf(buffer, "mtd=%d", pnum);
+   mtd_part.name = buffer;
+   mtd_part.size = part->size;
+   mtd_part.offset = part->offset;
+   add_mtd_partitions(&onenand_mtd, &mtd_part, 1);
+
+   err = ubi_mtd_param_parse(buffer, NULL);
+   if (err)
+   return err;
+
+   err = ubi_init();
+   if (err)
+   return err;
+
+   return 0;
+}
diff --git a/include/configs/apollon.h b/include/configs/apollon.h
index d71ed44..c694989 100644
--- a/include/configs/apollon.h
+++ b/include/configs/apollon.h
@@ -53,6 +53,9 @@
 #define CONFIG_SYS_USE_NOR 1
 #endif
 
+/* uncommnet if you want to use UBI */
+#define CONFIG_SYS_USE_UBI
+
 #include  /* get chip and board defs */
 
 #defineV_SCLK  1200
@@ -73,8 +76,9 @@
  * Size of malloc() pool
  */
 #defineCONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */
-#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_128K)
-#defineCONFIG_SYS_GBL_DATA_SIZE128 /* bytes reserved for 
initial data */
+#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
+/* bytes reserved for initial data */
+#defineCONFIG_SYS_GBL_DATA_SIZE128
 
 /*
  * Hardware drivers
@@ -116,6 +120,12 @@
 #defineCONFIG_CMD_DIAG
 #defineCONFIG_CMD_ONENAND
 
+#ifdef CONFIG_SYS_USE_UBI
+#defineCONFIG_CMD_JFFS2
+#defineCONFIG_CMD_UBI
+#defineCONFIG_RBTREE
+#endif
+
 #undef CONFIG_CMD_AUTOSCRIPT
 
 #ifndefCONFIG_SYS_USE_NOR
@@ -133,24 +143,39 @@
 #defineCONFIG_BOOTFILE "uImage"
 #defineCONFIG_ETHADDR  00:0E:99:00:24:20
 
-#ifdef CONFIG_APOLLON_PLUS
-# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2"
+#ifdef CONFIG_APOLLON_PLUS
+#define CONFIG_SYS_MEM "mem=64M"
+#else
+#define CONFIG_SYS_MEM "mem=128"
+#endif
+
+#ifdef CONFIG_SYS_USE_UBI
+#define CONFIG_SYS_UBI "ubi.mtd=4"
 #else
-# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2"
+#define CONFIG_SYS_UBI ""
 #endif
 
+#define CONFIG_BOOTARGS "root=/dev/nfs rw " CONFIG_SYS_MEM \
+   " console=ttyS0,115200n8" \
+   " ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:" \
+   "apollon:eth0:off nfsroot=/tftpboot/nfsroot profile=2 " \
+   CONFIG_SYS_UBI
+
 #defineCONFIG_EXTRA_ENV_SETTINGS   
\
"Image=tftp 0x80008000 Image; go 0x80008000\0"  \
"zImage=tftp 0x8018 zImage; go 0x8018\0"\
"uImage=tftp 0x8018 uImage; bootm 0x8018\0" \
"uboot=tftp 0x80008000 u-boot.bin; go 0x80008000\0" \
-   "xloader=tftp 0x8018 x-load.bin; cp.w 0x8018 0x0400 0x1000; 
go 0x0400\0"\
+   "xloader=tftp 0x8018 x-load.bin; "  \
+   " cp.w 0x8018 0x0400 0x1000; go 0x0400\0"   \
"syncmode50=mw.w 0x1e442 0xc0c4; mw 0x6800a060 0xe30d1201\0"\
"syncmode=mw.w 0x1e442 0xe0f4; mw 0x6800a060 0xe30d1201\0"  \
"norboot=cp32 0x1804 0x80008000 0x20; go 0x80008000\0"  \
-   "oneboot=onenand read 0x80008000 0x4 0x20; go 0x80008000\0"\
+   "

[U-Boot] [PATCH] [ARM] Apollon UBI support (take #2)

2008-10-22 Thread Kyungmin Park
Now you can use the UBI at apollon board

Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
---
diff --git a/board/apollon/Makefile b/board/apollon/Makefile
index 9bac9a6..4c3e57f 100644
--- a/board/apollon/Makefile
+++ b/board/apollon/Makefile
@@ -25,9 +25,11 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  := apollon.o mem.o sys_info.o
+COBJS-y:= apollon.o mem.o sys_info.o
+COBJS-$(CONFIG_CMD_UBI) += ubi.o
 SOBJS  := lowlevel_init.o
 
+COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
new file mode 100644
index 000..10dd6e7
--- /dev/null
+++ b/board/apollon/ubi.c
@@ -0,0 +1,48 @@
+/*
+ * board/apollon/ubi.c
+ *
+ *  Copyright (C) 2008 Samsung Electronics
+ *  Kyungmin Park <[EMAIL PROTECTED]>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+int ubi_board_scan(void)
+{
+   struct mtd_device *dev;
+   struct part_info *part;
+   struct mtd_partition mtd_part;
+   char buffer[32];
+   u8 pnum;
+   int err;
+
+   if (mtdparts_init() != 0)
+   return 1;
+
+   if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
+   return 1;
+
+   sprintf(buffer, "mtd=%d", pnum);
+   mtd_part.name = buffer;
+   mtd_part.size = part->size;
+   mtd_part.offset = part->offset;
+   add_mtd_partitions(&onenand_mtd, &mtd_part, 1);
+
+   err = ubi_mtd_param_parse(buffer, NULL);
+   if (err)
+   return err;
+
+   err = ubi_init();
+   if (err)
+   return err;
+
+   return 0;
+}
diff --git a/include/configs/apollon.h b/include/configs/apollon.h
index d71ed44..dff47fc 100644
--- a/include/configs/apollon.h
+++ b/include/configs/apollon.h
@@ -53,6 +53,9 @@
 #define CONFIG_SYS_USE_NOR 1
 #endif
 
+/* uncommnet if you want to use UBI */
+#define CONFIG_SYS_USE_UBI
+
 #include  /* get chip and board defs */
 
 #defineV_SCLK  1200
@@ -73,8 +76,9 @@
  * Size of malloc() pool
  */
 #defineCONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */
-#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_128K)
-#defineCONFIG_SYS_GBL_DATA_SIZE128 /* bytes reserved for 
initial data */
+#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
+/* bytes reserved for initial data */
+#defineCONFIG_SYS_GBL_DATA_SIZE128
 
 /*
  * Hardware drivers
@@ -116,6 +120,13 @@
 #defineCONFIG_CMD_DIAG
 #defineCONFIG_CMD_ONENAND
 
+#ifdef CONFIG_SYS_USE_UBI
+#defineCONFIG_CMD_JFFS2
+#defineCONFIG_CMD_UBI
+#defineCONFIG_RBTREE
+#define CONFIG_MTD_PARTITIONS
+#endif
+
 #undef CONFIG_CMD_AUTOSCRIPT
 
 #ifndefCONFIG_SYS_USE_NOR
@@ -133,24 +144,39 @@
 #defineCONFIG_BOOTFILE "uImage"
 #defineCONFIG_ETHADDR  00:0E:99:00:24:20
 
-#ifdef CONFIG_APOLLON_PLUS
-# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2"
+#ifdef CONFIG_APOLLON_PLUS
+#define CONFIG_SYS_MEM "mem=64M"
+#else
+#define CONFIG_SYS_MEM "mem=128"
+#endif
+
+#ifdef CONFIG_SYS_USE_UBI
+#define CONFIG_SYS_UBI "ubi.mtd=4"
 #else
-# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2"
+#define CONFIG_SYS_UBI ""
 #endif
 
+#define CONFIG_BOOTARGS "root=/dev/nfs rw " CONFIG_SYS_MEM \
+   " console=ttyS0,115200n8" \
+   " ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:" \
+   "apollon:eth0:off nfsroot=/tftpboot/nfsroot profile=2 " \
+   CONFIG_SYS_UBI
+
 #defineCONFIG_EXTRA_ENV_SETTINGS   
\
"Image=tftp 0x80008000 Image; go 0x80008000\0"  \
"zImage=tftp 0x8018 zImage; go 0x8018\0"\
"uImage=tftp 0x8018 uImage; bootm 0x8018\0" \
"uboot=tftp 0x80008000 u-boot.bin; go 0x80008000\0" \
-   "xloader=tftp 0x8018 x-load.bin; cp.w 0x8018 0x0400 0x1000; 
go 0x0400\0"\
+   "xloader=tftp 0x8018 x-load.bin; "  \
+   " cp.w 0x8018 0x0400 0x1000; go 0x0400\0"   \
"syncmode50=mw.w 0x1e442 0xc0c4; mw 0x6800a060 0xe30d1201\0"\
"syncmode=mw.w 0x1e442 0xe0f4; mw 0x6800a060 0xe30d1201\0"  \
"norboot=cp32 0x1804 0x80008000 0x20; go 0x80008000\0"  \
-   "oneboot=onenand read 0x80008000 0x4 0x2000

Re: [U-Boot] [PATCH] [ARM] Apollon UBI support

2008-10-21 Thread Ben Warren
Hi Kyungmin,

Kyungmin Park wrote:
> Dear Wolfgang,
>
>   
>>> -# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
>>> console=ttyS0,115200n8 
>>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off
>>>  nfsroot=/tftpboot/nfsroot profile=2"
>>> +# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
>>> console=ttyS0,115200n8 
>>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off
>>>  nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"
>>>  #else
>>> -# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
>>> console=ttyS0,115200n8 
>>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off
>>>  nfsroot=/tftpboot/nfsroot profile=2"
>>> +# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
>>> console=ttyS0,115200n8 
>>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off
>>>  nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"
>>>   
>> Maximum line length exceeded.
>>
>> 
>
> Fixed all commented except one.
> I run the checkpatch.pl and passed.
>
>   
>> And please do not hard-code network parameters into U-Boot.
>>
>> 
>
> Then how to define the network IP at bootargs? please give some example?
>   
You set environment variables (ie. setenv bootcmd ...)

regards,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [ARM] Apollon UBI support

2008-10-21 Thread Kyungmin Park
Dear Wolfgang,

>> -# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
>> console=ttyS0,115200n8 
>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
>> nfsroot=/tftpboot/nfsroot profile=2"
>> +# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
>> console=ttyS0,115200n8 
>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
>> nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"
>>  #else
>> -# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
>> console=ttyS0,115200n8 
>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
>> nfsroot=/tftpboot/nfsroot profile=2"
>> +# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
>> console=ttyS0,115200n8 
>> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
>> nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"
>
> Maximum line length exceeded.
>

Fixed all commented except one.
I run the checkpatch.pl and passed.

> And please do not hard-code network parameters into U-Boot.
>

Then how to define the network IP at bootargs? please give some example?

Thank you,
Kyungmin Park
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [ARM] Apollon UBI support

2008-10-21 Thread Wolfgang Denk
Dear Kyungmin Park,

In message <[EMAIL PROTECTED]> you wrote:
> If you want to UBI on Apollon, uncomment the CONFIG_SYS_USE_UBI macro
> 
> Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
> ---
>  board/apollon/Makefile|4 ++-
>  board/apollon/ubi.c   |   55 
> +
>  include/configs/apollon.h |   27 +++--
>  3 files changed, 82 insertions(+), 4 deletions(-)
>  create mode 100644 board/apollon/ubi.c
...
> diff --git a/include/configs/apollon.h b/include/configs/apollon.h
> index d71ed44..3377f60 100644
> --- a/include/configs/apollon.h
> +++ b/include/configs/apollon.h
> @@ -53,6 +53,9 @@
>  #define CONFIG_SYS_USE_NOR   1
>  #endif
>  
> +/* uncommnet if you want to use UBI */
> +#define CONFIG_SYS_USE_UBI
> +
>  #include/* get chip and board defs */
>  
>  #define  V_SCLK  1200
> @@ -73,7 +76,7 @@
>   * Size of malloc() pool
>   */
>  #define  CONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */
> -#define  CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_128K)
> +#define  CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
>  #define  CONFIG_SYS_GBL_DATA_SIZE128 /* bytes reserved for 
> initial data */

Maximum line length exceeded.

>  /*
> @@ -116,6 +119,12 @@
>  #define  CONFIG_CMD_DIAG
>  #define  CONFIG_CMD_ONENAND
>  
> +#ifdef CONFIG_SYS_USE_UBI
> +#define  CONFIG_CMD_JFFS2
> +#define  CONFIG_CMD_UBI
> +#define  CONFIG_RBTREE
> +#endif
> +
>  #undef   CONFIG_CMD_AUTOSCRIPT
>  
>  #ifndef  CONFIG_SYS_USE_NOR
> @@ -134,9 +143,9 @@
>  #define  CONFIG_ETHADDR  00:0E:99:00:24:20
>  
>  #ifdef   CONFIG_APOLLON_PLUS
> -# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
> console=ttyS0,115200n8 
> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
> nfsroot=/tftpboot/nfsroot profile=2"
> +# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
> console=ttyS0,115200n8 
> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
> nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"
>  #else
> -# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
> console=ttyS0,115200n8 
> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
> nfsroot=/tftpboot/nfsroot profile=2"
> +# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
> console=ttyS0,115200n8 
> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
> nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"

Maximum line length exceeded.

And please do not hard-code network parameters into U-Boot.

>  #endif
>  
>  #define  CONFIG_EXTRA_ENV_SETTINGS   
> \
> @@ -151,6 +160,7 @@
>   "oneboot=onenand read 0x80008000 0x4 0x20; go 0x80008000\0"\
>   "onesyncboot=run syncmode oneboot\0"\
>   "updateb=tftp 0x8018 u-boot-onenand.bin; onenand erase 0x0 0x2; 
> onenand write 0x8018 0x0 0x2\0" \
> + "ubi=setenv bootargs ${bootargs} ubi.mtd=4 ${mtdparts}; run uImage\0" \

Please also fix too long line above.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
"One day," said a dull voice from down below, "I'm going to  be  back
in  form again and you're going to be very sorry you said that. For a
very long time. I might even go so far as to make even more Time just
for you to be sorry in."  - Terry Pratchett, _Small Gods_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] [ARM] Apollon UBI support

2008-10-21 Thread Jean-Christophe PLAGNIOL-VILLARD
On 18:19 Tue 21 Oct , Kyungmin Park wrote:
> If you want to UBI on Apollon, uncomment the CONFIG_SYS_USE_UBI macro
> 
> Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
> ---
>  board/apollon/Makefile|4 ++-
>  board/apollon/ubi.c   |   55 
> +
>  include/configs/apollon.h |   27 +++--
>  3 files changed, 82 insertions(+), 4 deletions(-)
>  create mode 100644 board/apollon/ubi.c
> 
> diff --git a/board/apollon/Makefile b/board/apollon/Makefile
> index 9bac9a6..4c3e57f 100644
> --- a/board/apollon/Makefile
> +++ b/board/apollon/Makefile
> @@ -25,9 +25,11 @@ include $(TOPDIR)/config.mk
>  
>  LIB  = $(obj)lib$(BOARD).a
>  
> -COBJS:= apollon.o mem.o sys_info.o
> +COBJS-y  := apollon.o mem.o sys_info.o
> +COBJS-$(CONFIG_CMD_UBI) += ubi.o
>  SOBJS:= lowlevel_init.o
>  
> +COBJS:= $(COBJS-y)
>  SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c)
>  OBJS := $(addprefix $(obj),$(COBJS))
>  SOBJS:= $(addprefix $(obj),$(SOBJS))
> diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
> new file mode 100644
> index 000..342569d
> --- /dev/null
> +++ b/board/apollon/ubi.c
> @@ -0,0 +1,55 @@
> +/*
> + * board/apollon/ubi.c
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +/* common/cmd_jffs2.c */
> +extern int mtdparts_init(void);
> +extern int find_dev_and_part(const char *id, struct mtd_device **dev,
> +u8 *part_num, struct part_info **part);
   
   whitespace please fix
It will be better to have it in a header?
> +
> +/* drivers/mtd/ubi/build.c */
> +extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
> +extern int ubi_init(void);
It will be better to have it in a header?
> +
> +#ifdef CONFIG_CMD_UBI
please move this to the Makefile
> +
> +int ubi_board_scan(void)
> +{
> +struct mtd_device *dev;
   
   whitespace please fix
> +struct part_info *part;
   
   whitespace please fix
> +struct mtd_partition mtd_part;
   whitespace please fix
   
> +char buffer[32];
   
   whitespace please fix
> +u8 pnum;
   
   whitespace please fix
> +int err;
   
   whitespace please fix
> +
> +if (mtdparts_init() !=0)
   
   whitespace please fix
> +return 1;
   
   whitespace please fix
> +
> +if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
   
   whitespace please fix
> +return 1;
   
   whitespace please fix
> +
> +printf("%s[%d] pnum %d\n", __func__, __LINE__, pnum);
   
   whitespace please fix
> +sprintf(buffer, "mtd=%d", pnum);
   
   whitespace please fix
> +mtd_part.name = buffer;
   
   whitespace please fix
> +mtd_part.size = part->size;
   
   whitespace please fix
> +mtd_part.offset = part->offset;
   
   whitespace please fix
> +add_mtd_partitions(&onenand_mtd, &mtd_part, 1);
   
   whitespace please fix
> +
> +err = ubi_mtd_param_parse(buffer, NULL);
   
   whitespace please fix
> +if (err)
   
   whitespace please fix
> +return err;
   whitespace please fix
> +
> +err = ubi_init();
   
   whitespace please fix
> +if (err)
   
   whitespace please fix
> +return err;
   
   whitespace please fix
> +
> +return 0;
   
   whitespace please fix
> +}
> +
> +#endif
> diff --git a/include/configs/apollon.h b/include/configs/apollon.h
> index d71ed44..3377f60 100644
> --- a/include/configs/apollon.h
> +++ b/include/configs/apollon.h
> @@ -53,6 +53,9 @@
>  #define CONFIG_SYS_USE_NOR   1
>  #endif
>  
> +/* uncommnet if you want to use UBI */

> +#define CONFIG_SYS_USE_UBI
> +
>  #include/* get chip and board defs */
>  
>  #define  V_SCLK  1200
> @@ -73,7 +76,7 @@
>   * Size of malloc() pool
>   */
>  #define  CONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */
> -#define  CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_128K)
> +#define  CONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
>  #define  CONFIG_SYS_GBL_DATA_SIZE128 /* bytes reserved for 
> initial data */
>  
>  /*
> @@ -116,6 +119,12 @@
>  #define  CONFIG_CMD_DIAG
>  #define  CONFIG_CMD_ONENAND
>  
> +#ifdef CONFIG_SYS_USE_UBI
> +#define  CONFIG_CMD_JFFS2
> +#define  CONFIG_CMD_UBI
> +#define  CONFIG_RBTREE
> +#endif
> +
>  #undef   CONFIG_CMD_AUTOSCRIPT
>  
>  #ifndef  CONFIG_SYS_USE_NOR
> @@ -134,9 +143,9 @@
>  #define  CONFIG_ETHADDR  00:0E:99:00:24:20
>  
>  #ifdef   CONFIG_APOLLON_PLUS
> -# define CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
> console=ttyS0,115200n8 
> ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
> nfsroo

[U-Boot] [PATCH] [ARM] Apollon UBI support

2008-10-21 Thread Kyungmin Park
If you want to UBI on Apollon, uncomment the CONFIG_SYS_USE_UBI macro

Signed-off-by: Kyungmin Park <[EMAIL PROTECTED]>
---
 board/apollon/Makefile|4 ++-
 board/apollon/ubi.c   |   55 +
 include/configs/apollon.h |   27 +++--
 3 files changed, 82 insertions(+), 4 deletions(-)
 create mode 100644 board/apollon/ubi.c

diff --git a/board/apollon/Makefile b/board/apollon/Makefile
index 9bac9a6..4c3e57f 100644
--- a/board/apollon/Makefile
+++ b/board/apollon/Makefile
@@ -25,9 +25,11 @@ include $(TOPDIR)/config.mk
 
 LIB= $(obj)lib$(BOARD).a
 
-COBJS  := apollon.o mem.o sys_info.o
+COBJS-y:= apollon.o mem.o sys_info.o
+COBJS-$(CONFIG_CMD_UBI) += ubi.o
 SOBJS  := lowlevel_init.o
 
+COBJS  := $(COBJS-y)
 SRCS   := $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS   := $(addprefix $(obj),$(COBJS))
 SOBJS  := $(addprefix $(obj),$(SOBJS))
diff --git a/board/apollon/ubi.c b/board/apollon/ubi.c
new file mode 100644
index 000..342569d
--- /dev/null
+++ b/board/apollon/ubi.c
@@ -0,0 +1,55 @@
+/*
+ * board/apollon/ubi.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* common/cmd_jffs2.c */
+extern int mtdparts_init(void);
+extern int find_dev_and_part(const char *id, struct mtd_device **dev,
+u8 *part_num, struct part_info **part);
+
+/* drivers/mtd/ubi/build.c */
+extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
+extern int ubi_init(void);
+
+#ifdef CONFIG_CMD_UBI
+
+int ubi_board_scan(void)
+{
+struct mtd_device *dev;
+struct part_info *part;
+struct mtd_partition mtd_part;
+char buffer[32];
+u8 pnum;
+int err;
+
+if (mtdparts_init() !=0)
+return 1;
+
+if (find_dev_and_part("onenand0,4", &dev, &pnum, &part) != 0)
+return 1;
+
+printf("%s[%d] pnum %d\n", __func__, __LINE__, pnum);
+sprintf(buffer, "mtd=%d", pnum);
+mtd_part.name = buffer;
+mtd_part.size = part->size;
+mtd_part.offset = part->offset;
+add_mtd_partitions(&onenand_mtd, &mtd_part, 1);
+
+err = ubi_mtd_param_parse(buffer, NULL);
+if (err)
+return err;
+
+err = ubi_init();
+if (err)
+return err;
+
+return 0;
+}
+
+#endif
diff --git a/include/configs/apollon.h b/include/configs/apollon.h
index d71ed44..3377f60 100644
--- a/include/configs/apollon.h
+++ b/include/configs/apollon.h
@@ -53,6 +53,9 @@
 #define CONFIG_SYS_USE_NOR 1
 #endif
 
+/* uncommnet if you want to use UBI */
+#define CONFIG_SYS_USE_UBI
+
 #include  /* get chip and board defs */
 
 #defineV_SCLK  1200
@@ -73,7 +76,7 @@
  * Size of malloc() pool
  */
 #defineCONFIG_ENV_SIZE SZ_128K /* Total Size of Environment Sector */
-#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_128K)
+#defineCONFIG_SYS_MALLOC_LEN   (CONFIG_ENV_SIZE + SZ_1M)
 #defineCONFIG_SYS_GBL_DATA_SIZE128 /* bytes reserved for 
initial data */
 
 /*
@@ -116,6 +119,12 @@
 #defineCONFIG_CMD_DIAG
 #defineCONFIG_CMD_ONENAND
 
+#ifdef CONFIG_SYS_USE_UBI
+#defineCONFIG_CMD_JFFS2
+#defineCONFIG_CMD_UBI
+#defineCONFIG_RBTREE
+#endif
+
 #undef CONFIG_CMD_AUTOSCRIPT
 
 #ifndefCONFIG_SYS_USE_NOR
@@ -134,9 +143,9 @@
 #defineCONFIG_ETHADDR  00:0E:99:00:24:20
 
 #ifdef CONFIG_APOLLON_PLUS
-# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2"
+# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=64M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"
 #else
-# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2"
+# define   CONFIG_BOOTARGS "root=/dev/nfs rw mem=128M 
console=ttyS0,115200n8 
ip=192.168.116.25:192.168.116.1:192.168.116.1:255.255.255.0:apollon:eth0:off 
nfsroot=/tftpboot/nfsroot profile=2 lpj=1646592 ubi.mtd=4"
 #endif
 
 #defineCONFIG_EXTRA_ENV_SETTINGS   
\
@@ -151,6 +160,7 @@
"oneboot=onenand read 0x80008000 0x4 0x20; go 0x80008000\0"\
"onesyncboot=run syncmode oneboot\0"\
"updateb=tftp 0x8018 u-boot-onenand.bin; onenand erase 0x0 0x2; 
onenand write 0x8018 0x0 0x2\0" \
+   "ubi=setenv bootargs ${bootargs} ubi.mtd=4 ${mtdparts}; run uImage\0" \
"bootcmd=run uboot\0"
 
 /*
@@ -228,4 +238,15 @@
 #defineCONFIG_ENV_IS_IN_ONENAND1
 #define CONFIG_ENV_ADDR0x0002
 
+#ifdef CONFIG_