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

Magnus Lilja lilja.magnus at gmail.com
Sun Nov 2 22:00:41 CET 2008


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 <kmpark at infradead.org>:
> Now you can use the UBI at apollon board
>
> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
> ---
> 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 <kyungmin.park at samsung.com>
> + *
> + * 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);

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


More information about the U-Boot mailing list