mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-11 07:24:46 +00:00

UBI block is an virtual device, that runs on top of the MTD layer. The blocks are UBI volumes. Intended to be used in combination with other MTD drivers. Despite the fact that it, like mtdblock abstraction, it used with UCLASS_MTD, they can be used together on the system without conflicting. For example, using bcb command: # Trying to load bcb via mtdblock: $ bcb load mtd 0 mtd_partition_name # Trying to load bcb via UBI block: $ bcb load ubi 1 ubi_volume_name User always must attach UBI layer (for example, using ubi_part()) before using UBI block device. Signed-off-by: Alexey Romanov <avromanov@salutedevices.com> Reviewed-by: Heiko Schocher <hs@denx.de> Acked-by: Heiko Schocher <hs@denx.de> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
67 lines
1.6 KiB
C
67 lines
1.6 KiB
C
/*
|
|
* Header file for UBI support for U-Boot
|
|
*
|
|
* Adaptation from kernel to U-Boot
|
|
*
|
|
* Copyright (C) 2005-2007 Samsung Electronics
|
|
* Kyungmin Park <kyungmin.park@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.
|
|
*/
|
|
|
|
#ifndef __UBOOT_UBI_H
|
|
#define __UBOOT_UBI_H
|
|
|
|
#include <compiler.h>
|
|
#include <linux/compat.h>
|
|
#include <malloc.h>
|
|
#include <div64.h>
|
|
#include <linux/math64.h>
|
|
#include <linux/crc32.h>
|
|
#include <linux/types.h>
|
|
#include <linux/list.h>
|
|
#include <linux/rbtree.h>
|
|
#include <linux/string.h>
|
|
#include <linux/mtd/mtd.h>
|
|
#include <linux/mtd/ubi.h>
|
|
|
|
#ifdef CONFIG_CMD_ONENAND
|
|
#include <onenand_uboot.h>
|
|
#endif
|
|
|
|
#include <linux/errno.h>
|
|
|
|
/* build.c */
|
|
#define get_device(...)
|
|
#define put_device(...)
|
|
#define ubi_sysfs_init(...) 0
|
|
#define ubi_sysfs_close(...) do { } while (0)
|
|
|
|
#ifndef __UBIFS_H__
|
|
#include "../drivers/mtd/ubi/ubi.h"
|
|
#endif
|
|
|
|
/* functions */
|
|
extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
|
|
extern int ubi_init(void);
|
|
extern void ubi_exit(void);
|
|
extern int ubi_part(char *part_name, const char *vid_header_offset);
|
|
extern int ubi_volume_write(char *volume, void *buf, loff_t offset, size_t size);
|
|
extern int ubi_volume_read(char *volume, char *buf, loff_t offset, size_t size);
|
|
|
|
extern struct ubi_device *ubi_devices[];
|
|
int cmd_ubifs_mount(char *vol_name);
|
|
int cmd_ubifs_umount(void);
|
|
|
|
#if IS_ENABLED(CONFIG_UBI_BLOCK)
|
|
int ubi_bind(struct udevice *dev);
|
|
#else
|
|
static inline int ubi_bind(struct udevice *dev)
|
|
{
|
|
return -EOPNOTSUPP;
|
|
}
|
|
#endif
|
|
|
|
#endif
|