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 0000000..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 <common.h>
> +#include <linux/mtd/mtd.h>
> +#include <linux/mtd/partitions.h>
> +#include <jffs2/load_kernel.h>
> +#include <ubi_uboot.h>
> +
> +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

Reply via email to