public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] getting ubifs to run
@ 2016-08-11  9:56 Marco
  2016-08-12  5:05 ` Heiko Schocher
  0 siblings, 1 reply; 11+ messages in thread
From: Marco @ 2016-08-11  9:56 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Marco <marco.hoefle@nanotronic.ch>
---
 arch/microblaze/include/asm/atomic.h | 114 +++++++++++++++++++++++++++++++++++
 arch/microblaze/include/asm/bitops.h |   8 +--
 fs/ubifs/io.c                        |   2 +-
 fs/ubifs/log.c                       |  99 ++++++++++++++++++++++++++++++
 fs/ubifs/lpt_commit.c                |  21 +++++++
 5 files changed, 239 insertions(+), 5 deletions(-)
 create mode 100644 arch/microblaze/include/asm/atomic.h

diff --git a/arch/microblaze/include/asm/atomic.h b/arch/microblaze/include/asm/atomic.h
new file mode 100644
index 0000000..2872149
--- /dev/null
+++ b/arch/microblaze/include/asm/atomic.h
@@ -0,0 +1,114 @@
+/*
+ *  linux/include/asm-arm/atomic.h
+ *
+ *  Copyright (c) 1996 Russell King.
+ *
+ * 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.
+ *
+ *  Changelog:
+ *   27-06-1996	RMK	Created
+ *   13-04-1997	RMK	Made functions atomic!
+ *   07-12-1997	RMK	Upgraded for v2.1.
+ *   26-08-1998	PJB	Added #ifdef __KERNEL__
+ */
+#ifndef __ASM_ARM_ATOMIC_H
+#define __ASM_ARM_ATOMIC_H
+
+#ifdef CONFIG_SMP
+#error SMP not supported
+#endif
+
+typedef struct { volatile int counter; } atomic_t;
+
+#define ATOMIC_INIT(i)	{ (i) }
+
+#ifdef __KERNEL__
+#include <asm/system.h>
+
+#define atomic_read(v)	((v)->counter)
+#define atomic_set(v,i)	(((v)->counter) = (i))
+
+
+
+
+static inline void atomic_add(int i, volatile atomic_t *v)
+{
+	unsigned long flags = 0;
+
+	local_irq_save(flags);
+	v->counter += i;
+	local_irq_restore(flags);
+}
+
+static inline void atomic_sub(int i, volatile atomic_t *v)
+{
+	unsigned long flags = 0;
+
+	local_irq_save(flags);
+	v->counter -= i;
+	local_irq_restore(flags);
+}
+
+static inline void atomic_inc(volatile atomic_t *v)
+{
+	unsigned long flags = 0;
+
+	local_irq_save(flags);
+	v->counter += 1;
+	local_irq_restore(flags);
+}
+
+static inline void atomic_dec(volatile atomic_t *v)
+{
+	unsigned long flags = 0;
+
+	local_irq_save(flags);
+	v->counter -= 1;
+	local_irq_restore(flags);
+}
+
+static inline int atomic_dec_and_test(volatile atomic_t *v)
+{
+	unsigned long flags = 0;
+	int val;
+
+	local_irq_save(flags);
+	val = v->counter;
+	v->counter = val -= 1;
+	local_irq_restore(flags);
+
+	return val == 0;
+}
+
+static inline int atomic_add_negative(int i, volatile atomic_t *v)
+{
+	unsigned long flags = 0;
+	int val;
+
+	local_irq_save(flags);
+	val = v->counter;
+	v->counter = val += i;
+	local_irq_restore(flags);
+
+	return val < 0;
+}
+
+static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
+{
+	unsigned long flags = 0;
+
+	local_irq_save(flags);
+	*addr &= ~mask;
+	local_irq_restore(flags);
+}
+
+/* Atomic operations are already serializing on ARM */
+#define smp_mb__before_atomic_dec()	barrier()
+#define smp_mb__after_atomic_dec()	barrier()
+#define smp_mb__before_atomic_inc()	barrier()
+#define smp_mb__after_atomic_inc()	barrier()
+
+#endif
+#endif
diff --git a/arch/microblaze/include/asm/bitops.h b/arch/microblaze/include/asm/bitops.h
index 2cab2ac..b3b17b9 100644
--- a/arch/microblaze/include/asm/bitops.h
+++ b/arch/microblaze/include/asm/bitops.h
@@ -204,10 +204,10 @@ static inline int __test_bit(int nr, volatile void *addr)
 	return ((mask & *a) != 0);
 }
 
-#define test_bit(nr,addr) \
-(__builtin_constant_p(nr) ? \
- __constant_test_bit((nr),(addr)) : \
- __test_bit((nr),(addr)))
+static inline int test_bit(int nr, const void * addr)
+{
+	return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7));
+}
 
 #define find_first_zero_bit(addr, size) \
 	find_next_zero_bit((addr), (size), 0)
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 51a95bb..685713e 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -847,6 +847,7 @@ out:
 	ubifs_dump_leb(c, wbuf->lnum);
 	return err;
 }
+#endif
 
 /**
  * ubifs_write_node - write node to the media.
@@ -885,7 +886,6 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum,
 
 	return err;
 }
-#endif
 
 /**
  * ubifs_read_node_wbuf - read node from the media or write-buffer.
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c
index a07fdef..10302b9 100644
--- a/fs/ubifs/log.c
+++ b/fs/ubifs/log.c
@@ -743,3 +743,102 @@ static int dbg_check_bud_bytes(struct ubifs_info *c)
 
 	return err;
 }
+
+
+/**
+ * ubifs_commit_required - set commit state to "required".
+ * @c: UBIFS file-system description object
+ *
+ * This function is called if a commit is required but cannot be done from the
+ * calling function, so it is just flagged instead.
+ */
+void ubifs_commit_required(struct ubifs_info *c)
+{
+	spin_lock(&c->cs_lock);
+	switch (c->cmt_state) {
+	case COMMIT_RESTING:
+	case COMMIT_BACKGROUND:
+		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
+			dbg_cstate(COMMIT_REQUIRED));
+		c->cmt_state = COMMIT_REQUIRED;
+		break;
+	case COMMIT_RUNNING_BACKGROUND:
+		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
+			dbg_cstate(COMMIT_RUNNING_REQUIRED));
+		c->cmt_state = COMMIT_RUNNING_REQUIRED;
+		break;
+	case COMMIT_REQUIRED:
+	case COMMIT_RUNNING_REQUIRED:
+	case COMMIT_BROKEN:
+		break;
+	}
+	spin_unlock(&c->cs_lock);
+}
+
+/**
+ * ubifs_write_master - write master node.
+ * @c: UBIFS file-system description object
+ *
+ * This function writes the master node. Returns zero in case of success and a
+ * negative error code in case of failure. The master node is written twice to
+ * enable recovery.
+ */
+int ubifs_write_master(struct ubifs_info *c)
+{
+	int err, lnum, offs, len;
+
+	ubifs_assert(!c->ro_media && !c->ro_mount);
+	if (c->ro_error)
+		return -EROFS;
+
+	lnum = UBIFS_MST_LNUM;
+	offs = c->mst_offs + c->mst_node_alsz;
+	len = UBIFS_MST_NODE_SZ;
+
+	if (offs + UBIFS_MST_NODE_SZ > c->leb_size) {
+		err = ubifs_leb_unmap(c, lnum);
+		if (err)
+			return err;
+		offs = 0;
+	}
+
+	c->mst_offs = offs;
+	c->mst_node->highest_inum = cpu_to_le64(c->highest_inum);
+
+	err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
+	if (err)
+		return err;
+
+	lnum += 1;
+
+	if (offs == 0) {
+		err = ubifs_leb_unmap(c, lnum);
+		if (err)
+			return err;
+	}
+	err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
+
+	return err;
+}
+
+/**
+ * ubifs_request_bg_commit - notify the background thread to do a commit.
+ * @c: UBIFS file-system description object
+ *
+ * This function is called if the journal is full enough to make a commit
+ * worthwhile, so background thread is kicked to start it.
+ */
+void ubifs_request_bg_commit(struct ubifs_info *c)
+{
+	spin_lock(&c->cs_lock);
+	if (c->cmt_state == COMMIT_RESTING) {
+		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
+			dbg_cstate(COMMIT_BACKGROUND));
+		c->cmt_state = COMMIT_BACKGROUND;
+		spin_unlock(&c->cs_lock);
+		ubifs_wake_up_bgt(c);
+	} else
+		spin_unlock(&c->cs_lock);
+}
+
+
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index 2df9130..61b2cc8 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -2039,4 +2039,25 @@ static int dbg_populate_lsave(struct ubifs_info *c)
 
 	return 1;
 }
+#else
+
+int dbg_chk_lpt_free_spc(struct ubifs_info *c)
+{
+	return 0;
+}
+
+int dbg_check_ltab(struct ubifs_info *c)
+{
+	return 0;
+}
+
+int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
+{
+	return 0;
+}
+
+void ubifs_dump_lpt_lebs(const struct ubifs_info *c)
+{
+}
+
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-08-11  9:56 [U-Boot] [PATCH] getting ubifs to run Marco
@ 2016-08-12  5:05 ` Heiko Schocher
  2016-08-12  7:24   ` Hoefle Marco
  0 siblings, 1 reply; 11+ messages in thread
From: Heiko Schocher @ 2016-08-12  5:05 UTC (permalink / raw)
  To: u-boot

Hello Marco,

Am 11.08.2016 um 11:56 schrieb Marco:
> Signed-off-by: Marco <marco.hoefle@nanotronic.ch>
> ---
>   arch/microblaze/include/asm/atomic.h | 114 +++++++++++++++++++++++++++++++++++
>   arch/microblaze/include/asm/bitops.h |   8 +--
>   fs/ubifs/io.c                        |   2 +-
>   fs/ubifs/log.c                       |  99 ++++++++++++++++++++++++++++++
>   fs/ubifs/lpt_commit.c                |  21 +++++++
>   5 files changed, 239 insertions(+), 5 deletions(-)
>   create mode 100644 arch/microblaze/include/asm/atomic.h

Hmm... what exactly do you fix? Can you add a commit message please?

It seems to me, you get ubifs working on microblaze arch?

And may you can split this patch into at least two pieces, one for the
arch fixes, and one for the ubifs fixes?

ubifs read support works for me on some arm based plattforms ...
what exactly do you fix with your fs/ubifs/* changes?

Thanks!

bye,
Heiko
> diff --git a/arch/microblaze/include/asm/atomic.h b/arch/microblaze/include/asm/atomic.h
> new file mode 100644
> index 0000000..2872149
> --- /dev/null
> +++ b/arch/microblaze/include/asm/atomic.h
> @@ -0,0 +1,114 @@
> +/*
> + *  linux/include/asm-arm/atomic.h
> + *
> + *  Copyright (c) 1996 Russell King.
> + *
> + * 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.
> + *
> + *  Changelog:
> + *   27-06-1996	RMK	Created
> + *   13-04-1997	RMK	Made functions atomic!
> + *   07-12-1997	RMK	Upgraded for v2.1.
> + *   26-08-1998	PJB	Added #ifdef __KERNEL__
> + */
> +#ifndef __ASM_ARM_ATOMIC_H
> +#define __ASM_ARM_ATOMIC_H
> +
> +#ifdef CONFIG_SMP
> +#error SMP not supported
> +#endif
> +
> +typedef struct { volatile int counter; } atomic_t;
> +
> +#define ATOMIC_INIT(i)	{ (i) }
> +
> +#ifdef __KERNEL__
> +#include <asm/system.h>
> +
> +#define atomic_read(v)	((v)->counter)
> +#define atomic_set(v,i)	(((v)->counter) = (i))
> +
> +
> +
> +
> +static inline void atomic_add(int i, volatile atomic_t *v)
> +{
> +	unsigned long flags = 0;
> +
> +	local_irq_save(flags);
> +	v->counter += i;
> +	local_irq_restore(flags);
> +}
> +
> +static inline void atomic_sub(int i, volatile atomic_t *v)
> +{
> +	unsigned long flags = 0;
> +
> +	local_irq_save(flags);
> +	v->counter -= i;
> +	local_irq_restore(flags);
> +}
> +
> +static inline void atomic_inc(volatile atomic_t *v)
> +{
> +	unsigned long flags = 0;
> +
> +	local_irq_save(flags);
> +	v->counter += 1;
> +	local_irq_restore(flags);
> +}
> +
> +static inline void atomic_dec(volatile atomic_t *v)
> +{
> +	unsigned long flags = 0;
> +
> +	local_irq_save(flags);
> +	v->counter -= 1;
> +	local_irq_restore(flags);
> +}
> +
> +static inline int atomic_dec_and_test(volatile atomic_t *v)
> +{
> +	unsigned long flags = 0;
> +	int val;
> +
> +	local_irq_save(flags);
> +	val = v->counter;
> +	v->counter = val -= 1;
> +	local_irq_restore(flags);
> +
> +	return val == 0;
> +}
> +
> +static inline int atomic_add_negative(int i, volatile atomic_t *v)
> +{
> +	unsigned long flags = 0;
> +	int val;
> +
> +	local_irq_save(flags);
> +	val = v->counter;
> +	v->counter = val += i;
> +	local_irq_restore(flags);
> +
> +	return val < 0;
> +}
> +
> +static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
> +{
> +	unsigned long flags = 0;
> +
> +	local_irq_save(flags);
> +	*addr &= ~mask;
> +	local_irq_restore(flags);
> +}
> +
> +/* Atomic operations are already serializing on ARM */
> +#define smp_mb__before_atomic_dec()	barrier()
> +#define smp_mb__after_atomic_dec()	barrier()
> +#define smp_mb__before_atomic_inc()	barrier()
> +#define smp_mb__after_atomic_inc()	barrier()
> +
> +#endif
> +#endif
> diff --git a/arch/microblaze/include/asm/bitops.h b/arch/microblaze/include/asm/bitops.h
> index 2cab2ac..b3b17b9 100644
> --- a/arch/microblaze/include/asm/bitops.h
> +++ b/arch/microblaze/include/asm/bitops.h
> @@ -204,10 +204,10 @@ static inline int __test_bit(int nr, volatile void *addr)
>   	return ((mask & *a) != 0);
>   }
>
> -#define test_bit(nr,addr) \
> -(__builtin_constant_p(nr) ? \
> - __constant_test_bit((nr),(addr)) : \
> - __test_bit((nr),(addr)))
> +static inline int test_bit(int nr, const void * addr)
> +{
> +	return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7));
> +}
>
>   #define find_first_zero_bit(addr, size) \
>   	find_next_zero_bit((addr), (size), 0)
> diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
> index 51a95bb..685713e 100644
> --- a/fs/ubifs/io.c
> +++ b/fs/ubifs/io.c
> @@ -847,6 +847,7 @@ out:
>   	ubifs_dump_leb(c, wbuf->lnum);
>   	return err;
>   }
> +#endif
>
>   /**
>    * ubifs_write_node - write node to the media.
> @@ -885,7 +886,6 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum,
>
>   	return err;
>   }
> -#endif
>
>   /**
>    * ubifs_read_node_wbuf - read node from the media or write-buffer.
> diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c
> index a07fdef..10302b9 100644
> --- a/fs/ubifs/log.c
> +++ b/fs/ubifs/log.c
> @@ -743,3 +743,102 @@ static int dbg_check_bud_bytes(struct ubifs_info *c)
>
>   	return err;
>   }
> +
> +
> +/**
> + * ubifs_commit_required - set commit state to "required".
> + * @c: UBIFS file-system description object
> + *
> + * This function is called if a commit is required but cannot be done from the
> + * calling function, so it is just flagged instead.
> + */
> +void ubifs_commit_required(struct ubifs_info *c)
> +{
> +	spin_lock(&c->cs_lock);
> +	switch (c->cmt_state) {
> +	case COMMIT_RESTING:
> +	case COMMIT_BACKGROUND:
> +		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> +			dbg_cstate(COMMIT_REQUIRED));
> +		c->cmt_state = COMMIT_REQUIRED;
> +		break;
> +	case COMMIT_RUNNING_BACKGROUND:
> +		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> +			dbg_cstate(COMMIT_RUNNING_REQUIRED));
> +		c->cmt_state = COMMIT_RUNNING_REQUIRED;
> +		break;
> +	case COMMIT_REQUIRED:
> +	case COMMIT_RUNNING_REQUIRED:
> +	case COMMIT_BROKEN:
> +		break;
> +	}
> +	spin_unlock(&c->cs_lock);
> +}
> +
> +/**
> + * ubifs_write_master - write master node.
> + * @c: UBIFS file-system description object
> + *
> + * This function writes the master node. Returns zero in case of success and a
> + * negative error code in case of failure. The master node is written twice to
> + * enable recovery.
> + */
> +int ubifs_write_master(struct ubifs_info *c)
> +{
> +	int err, lnum, offs, len;
> +
> +	ubifs_assert(!c->ro_media && !c->ro_mount);
> +	if (c->ro_error)
> +		return -EROFS;
> +
> +	lnum = UBIFS_MST_LNUM;
> +	offs = c->mst_offs + c->mst_node_alsz;
> +	len = UBIFS_MST_NODE_SZ;
> +
> +	if (offs + UBIFS_MST_NODE_SZ > c->leb_size) {
> +		err = ubifs_leb_unmap(c, lnum);
> +		if (err)
> +			return err;
> +		offs = 0;
> +	}
> +
> +	c->mst_offs = offs;
> +	c->mst_node->highest_inum = cpu_to_le64(c->highest_inum);
> +
> +	err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> +	if (err)
> +		return err;
> +
> +	lnum += 1;
> +
> +	if (offs == 0) {
> +		err = ubifs_leb_unmap(c, lnum);
> +		if (err)
> +			return err;
> +	}
> +	err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> +
> +	return err;
> +}
> +
> +/**
> + * ubifs_request_bg_commit - notify the background thread to do a commit.
> + * @c: UBIFS file-system description object
> + *
> + * This function is called if the journal is full enough to make a commit
> + * worthwhile, so background thread is kicked to start it.
> + */
> +void ubifs_request_bg_commit(struct ubifs_info *c)
> +{
> +	spin_lock(&c->cs_lock);
> +	if (c->cmt_state == COMMIT_RESTING) {
> +		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> +			dbg_cstate(COMMIT_BACKGROUND));
> +		c->cmt_state = COMMIT_BACKGROUND;
> +		spin_unlock(&c->cs_lock);
> +		ubifs_wake_up_bgt(c);
> +	} else
> +		spin_unlock(&c->cs_lock);
> +}
> +
> +
> diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
> index 2df9130..61b2cc8 100644
> --- a/fs/ubifs/lpt_commit.c
> +++ b/fs/ubifs/lpt_commit.c
> @@ -2039,4 +2039,25 @@ static int dbg_populate_lsave(struct ubifs_info *c)
>
>   	return 1;
>   }
> +#else
> +
> +int dbg_chk_lpt_free_spc(struct ubifs_info *c)
> +{
> +	return 0;
> +}
> +
> +int dbg_check_ltab(struct ubifs_info *c)
> +{
> +	return 0;
> +}
> +
> +int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len)
> +{
> +	return 0;
> +}
> +
> +void ubifs_dump_lpt_lebs(const struct ubifs_info *c)
> +{
> +}
> +
>   #endif
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-08-12  5:05 ` Heiko Schocher
@ 2016-08-12  7:24   ` Hoefle Marco
  2016-08-15 11:55     ` [U-Boot] WG: " Hoefle Marco
  0 siblings, 1 reply; 11+ messages in thread
From: Hoefle Marco @ 2016-08-12  7:24 UTC (permalink / raw)
  To: u-boot

Hello Heiko,
You are right, there are two parts: the Microblaze part and the ubifs stuff.
To get u-boot compiled I added the following to the Microblaze architecture:
atomic.h based on the ARM architecture, was missing before.
Modified bitops.h to get rid of compiler warnings
The three ubifs files had #defines which didn't work for me.
With the changes of the patch I sent I can successfully load the Kernel from a ubifs partition on a Microblaze.


That were the problems:

CC      fs/ubifs/ubifs.o
In file included from /home/hoefle/projects/u-boot_patch/fs/ubifs/ubifs.c:17:0:
/home/hoefle/projects/u-boot_patch/fs/ubifs/ubifs.h:35:24: fatal error: asm/atomic.h: No such file or directory
 #include <asm/atomic.h>
                        ^
compilation terminated.


/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected 'volatile void *' but argument is of type 'const long unsigned int *'
 static inline int __test_bit(int nr, volatile void *addr)
                   ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function 'ubifs_zn_obsolete':
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
  __test_bit((nr),(addr)))
                  ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:38:11: note: in expansion of macro 'test_bit'
  return !!test_bit(OBSOLETE_ZNODE, &znode->flags);
           ^
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected 'volatile void *' but argument is of type 'const long unsigned int *'
 static inline int __test_bit(int nr, volatile void *addr)
                   ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function 'ubifs_zn_cow':
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
  __test_bit((nr),(addr)))
                  ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:50:11: note: in expansion of macro 'test_bit'
  return !!test_bit(COW_ZNODE, &znode->flags);
           ^
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected 'volatile void *' but argument is of type 'const long unsigned int *'
 static inline int __test_bit(int nr, volatile void *addr)
                   ^



fs/built-in.o: In function `ubifs_lpt_start_commit':
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1232: undefined reference to `dbg_chk_lpt_free_spc'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1235: undefined reference to `dbg_check_ltab'
fs/built-in.o: In function `layout_cnodes':
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:195: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:211: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:219: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:233: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:246: undefined reference to `dbg_chk_lpt_sz'
fs/built-in.o:/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:254: more undefined references to `dbg_chk_lpt_sz' follow
fs/built-in.o: In function `layout_cnodes':
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:322: undefined reference to `ubifs_dump_lpt_lebs'
fs/built-in.o: In function `ubifs_add_bud_to_log':
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:194: undefined reference to `ubifs_commit_required'
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:225: undefined reference to `ubifs_request_bg_commit'
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:265: undefined reference to `ubifs_write_node'
fs/built-in.o: In function `ubifs_log_end_commit':
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:479: undefined reference to `ubifs_write_master'
fs/built-in.o: In function `write_orph_node':
/home/hoefle/projects/u-boot_patch/fs/ubifs/orphan.c:248: undefined reference to `ubifs_write_node'


Regards,
Marco



> -----Original Message-----
> From: Heiko Schocher [mailto:hs at denx.de]
> Sent: Freitag, 12. August 2016 07:05
> To: Hoefle Marco <Marco.Hoefle@nanotronic.ch>
> Cc: monstr at monstr.eu; u-boot at lists.denx.de
> Subject: Re: [U-Boot] [PATCH] getting ubifs to run
> 
> Hello Marco,
> 
> Am 11.08.2016 um 11:56 schrieb Marco:
> > Signed-off-by: Marco <marco.hoefle@nanotronic.ch>
> > ---
> >   arch/microblaze/include/asm/atomic.h | 114
> +++++++++++++++++++++++++++++++++++
> >   arch/microblaze/include/asm/bitops.h |   8 +--
> >   fs/ubifs/io.c                        |   2 +-
> >   fs/ubifs/log.c                       |  99 ++++++++++++++++++++++++++++++
> >   fs/ubifs/lpt_commit.c                |  21 +++++++
> >   5 files changed, 239 insertions(+), 5 deletions(-)
> >   create mode 100644 arch/microblaze/include/asm/atomic.h
> 
> Hmm... what exactly do you fix? Can you add a commit message please?
> 
> It seems to me, you get ubifs working on microblaze arch?
> 
> And may you can split this patch into at least two pieces, one for the arch
> fixes, and one for the ubifs fixes?
> 
> ubifs read support works for me on some arm based plattforms ...
> what exactly do you fix with your fs/ubifs/* changes?
> 
> Thanks!
> 
> bye,
> Heiko
> > diff --git a/arch/microblaze/include/asm/atomic.h
> > b/arch/microblaze/include/asm/atomic.h
> > new file mode 100644
> > index 0000000..2872149
> > --- /dev/null
> > +++ b/arch/microblaze/include/asm/atomic.h
> > @@ -0,0 +1,114 @@
> > +/*
> > + *  linux/include/asm-arm/atomic.h
> > + *
> > + *  Copyright (c) 1996 Russell King.
> > + *
> > + * 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.
> > + *
> > + *  Changelog:
> > + *   27-06-1996	RMK	Created
> > + *   13-04-1997	RMK	Made functions atomic!
> > + *   07-12-1997	RMK	Upgraded for v2.1.
> > + *   26-08-1998	PJB	Added #ifdef __KERNEL__
> > + */
> > +#ifndef __ASM_ARM_ATOMIC_H
> > +#define __ASM_ARM_ATOMIC_H
> > +
> > +#ifdef CONFIG_SMP
> > +#error SMP not supported
> > +#endif
> > +
> > +typedef struct { volatile int counter; } atomic_t;
> > +
> > +#define ATOMIC_INIT(i)	{ (i) }
> > +
> > +#ifdef __KERNEL__
> > +#include <asm/system.h>
> > +
> > +#define atomic_read(v)	((v)->counter)
> > +#define atomic_set(v,i)	(((v)->counter) = (i))
> > +
> > +
> > +
> > +
> > +static inline void atomic_add(int i, volatile atomic_t *v) {
> > +	unsigned long flags = 0;
> > +
> > +	local_irq_save(flags);
> > +	v->counter += i;
> > +	local_irq_restore(flags);
> > +}
> > +
> > +static inline void atomic_sub(int i, volatile atomic_t *v) {
> > +	unsigned long flags = 0;
> > +
> > +	local_irq_save(flags);
> > +	v->counter -= i;
> > +	local_irq_restore(flags);
> > +}
> > +
> > +static inline void atomic_inc(volatile atomic_t *v) {
> > +	unsigned long flags = 0;
> > +
> > +	local_irq_save(flags);
> > +	v->counter += 1;
> > +	local_irq_restore(flags);
> > +}
> > +
> > +static inline void atomic_dec(volatile atomic_t *v) {
> > +	unsigned long flags = 0;
> > +
> > +	local_irq_save(flags);
> > +	v->counter -= 1;
> > +	local_irq_restore(flags);
> > +}
> > +
> > +static inline int atomic_dec_and_test(volatile atomic_t *v) {
> > +	unsigned long flags = 0;
> > +	int val;
> > +
> > +	local_irq_save(flags);
> > +	val = v->counter;
> > +	v->counter = val -= 1;
> > +	local_irq_restore(flags);
> > +
> > +	return val == 0;
> > +}
> > +
> > +static inline int atomic_add_negative(int i, volatile atomic_t *v) {
> > +	unsigned long flags = 0;
> > +	int val;
> > +
> > +	local_irq_save(flags);
> > +	val = v->counter;
> > +	v->counter = val += i;
> > +	local_irq_restore(flags);
> > +
> > +	return val < 0;
> > +}
> > +
> > +static inline void atomic_clear_mask(unsigned long mask, unsigned
> > +long *addr) {
> > +	unsigned long flags = 0;
> > +
> > +	local_irq_save(flags);
> > +	*addr &= ~mask;
> > +	local_irq_restore(flags);
> > +}
> > +
> > +/* Atomic operations are already serializing on ARM */
> > +#define smp_mb__before_atomic_dec()	barrier()
> > +#define smp_mb__after_atomic_dec()	barrier()
> > +#define smp_mb__before_atomic_inc()	barrier()
> > +#define smp_mb__after_atomic_inc()	barrier()
> > +
> > +#endif
> > +#endif
> > diff --git a/arch/microblaze/include/asm/bitops.h
> > b/arch/microblaze/include/asm/bitops.h
> > index 2cab2ac..b3b17b9 100644
> > --- a/arch/microblaze/include/asm/bitops.h
> > +++ b/arch/microblaze/include/asm/bitops.h
> > @@ -204,10 +204,10 @@ static inline int __test_bit(int nr, volatile void
> *addr)
> >   	return ((mask & *a) != 0);
> >   }
> >
> > -#define test_bit(nr,addr) \
> > -(__builtin_constant_p(nr) ? \
> > - __constant_test_bit((nr),(addr)) : \
> > - __test_bit((nr),(addr)))
> > +static inline int test_bit(int nr, const void * addr) {
> > +	return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
> >
> >   #define find_first_zero_bit(addr, size) \
> >   	find_next_zero_bit((addr), (size), 0) diff --git a/fs/ubifs/io.c
> > b/fs/ubifs/io.c index 51a95bb..685713e 100644
> > --- a/fs/ubifs/io.c
> > +++ b/fs/ubifs/io.c
> > @@ -847,6 +847,7 @@ out:
> >   	ubifs_dump_leb(c, wbuf->lnum);
> >   	return err;
> >   }
> > +#endif
> >
> >   /**
> >    * ubifs_write_node - write node to the media.
> > @@ -885,7 +886,6 @@ int ubifs_write_node(struct ubifs_info *c, void
> > *buf, int len, int lnum,
> >
> >   	return err;
> >   }
> > -#endif
> >
> >   /**
> >    * ubifs_read_node_wbuf - read node from the media or write-buffer.
> > diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index a07fdef..10302b9
> > 100644
> > --- a/fs/ubifs/log.c
> > +++ b/fs/ubifs/log.c
> > @@ -743,3 +743,102 @@ static int dbg_check_bud_bytes(struct ubifs_info
> > *c)
> >
> >   	return err;
> >   }
> > +
> > +
> > +/**
> > + * ubifs_commit_required - set commit state to "required".
> > + * @c: UBIFS file-system description object
> > + *
> > + * This function is called if a commit is required but cannot be done
> > +from the
> > + * calling function, so it is just flagged instead.
> > + */
> > +void ubifs_commit_required(struct ubifs_info *c) {
> > +	spin_lock(&c->cs_lock);
> > +	switch (c->cmt_state) {
> > +	case COMMIT_RESTING:
> > +	case COMMIT_BACKGROUND:
> > +		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > +			dbg_cstate(COMMIT_REQUIRED));
> > +		c->cmt_state = COMMIT_REQUIRED;
> > +		break;
> > +	case COMMIT_RUNNING_BACKGROUND:
> > +		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > +			dbg_cstate(COMMIT_RUNNING_REQUIRED));
> > +		c->cmt_state = COMMIT_RUNNING_REQUIRED;
> > +		break;
> > +	case COMMIT_REQUIRED:
> > +	case COMMIT_RUNNING_REQUIRED:
> > +	case COMMIT_BROKEN:
> > +		break;
> > +	}
> > +	spin_unlock(&c->cs_lock);
> > +}
> > +
> > +/**
> > + * ubifs_write_master - write master node.
> > + * @c: UBIFS file-system description object
> > + *
> > + * This function writes the master node. Returns zero in case of
> > +success and a
> > + * negative error code in case of failure. The master node is written
> > +twice to
> > + * enable recovery.
> > + */
> > +int ubifs_write_master(struct ubifs_info *c) {
> > +	int err, lnum, offs, len;
> > +
> > +	ubifs_assert(!c->ro_media && !c->ro_mount);
> > +	if (c->ro_error)
> > +		return -EROFS;
> > +
> > +	lnum = UBIFS_MST_LNUM;
> > +	offs = c->mst_offs + c->mst_node_alsz;
> > +	len = UBIFS_MST_NODE_SZ;
> > +
> > +	if (offs + UBIFS_MST_NODE_SZ > c->leb_size) {
> > +		err = ubifs_leb_unmap(c, lnum);
> > +		if (err)
> > +			return err;
> > +		offs = 0;
> > +	}
> > +
> > +	c->mst_offs = offs;
> > +	c->mst_node->highest_inum = cpu_to_le64(c->highest_inum);
> > +
> > +	err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> > +	if (err)
> > +		return err;
> > +
> > +	lnum += 1;
> > +
> > +	if (offs == 0) {
> > +		err = ubifs_leb_unmap(c, lnum);
> > +		if (err)
> > +			return err;
> > +	}
> > +	err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> > +
> > +	return err;
> > +}
> > +
> > +/**
> > + * ubifs_request_bg_commit - notify the background thread to do a
> commit.
> > + * @c: UBIFS file-system description object
> > + *
> > + * This function is called if the journal is full enough to make a
> > +commit
> > + * worthwhile, so background thread is kicked to start it.
> > + */
> > +void ubifs_request_bg_commit(struct ubifs_info *c) {
> > +	spin_lock(&c->cs_lock);
> > +	if (c->cmt_state == COMMIT_RESTING) {
> > +		dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > +			dbg_cstate(COMMIT_BACKGROUND));
> > +		c->cmt_state = COMMIT_BACKGROUND;
> > +		spin_unlock(&c->cs_lock);
> > +		ubifs_wake_up_bgt(c);
> > +	} else
> > +		spin_unlock(&c->cs_lock);
> > +}
> > +
> > +
> > diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index
> > 2df9130..61b2cc8 100644
> > --- a/fs/ubifs/lpt_commit.c
> > +++ b/fs/ubifs/lpt_commit.c
> > @@ -2039,4 +2039,25 @@ static int dbg_populate_lsave(struct ubifs_info
> > *c)
> >
> >   	return 1;
> >   }
> > +#else
> > +
> > +int dbg_chk_lpt_free_spc(struct ubifs_info *c) {
> > +	return 0;
> > +}
> > +
> > +int dbg_check_ltab(struct ubifs_info *c) {
> > +	return 0;
> > +}
> > +
> > +int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) {
> > +	return 0;
> > +}
> > +
> > +void ubifs_dump_lpt_lebs(const struct ubifs_info *c) { }
> > +
> >   #endif
> >
> 
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] WG:  [PATCH] getting ubifs to run
  2016-08-12  7:24   ` Hoefle Marco
@ 2016-08-15 11:55     ` Hoefle Marco
  2016-09-01 12:45       ` [U-Boot] " Hoefle Marco
  0 siblings, 1 reply; 11+ messages in thread
From: Hoefle Marco @ 2016-08-15 11:55 UTC (permalink / raw)
  To: u-boot

Hello Heiko,
You are right, there are two parts: the Microblaze part and the ubifs stuff.
To get u-boot compiled I added the following to the Microblaze architecture:
atomic.h based on the ARM architecture, was missing before.
Modified bitops.h to get rid of compiler warnings
The three ubifs files had #defines which didn?t work for me.
With the changes of the patch I sent I can successfully load the Kernel from a ubifs partition on a Microblaze.


That were the problems:

CC      fs/ubifs/ubifs.o
In file included from /home/hoefle/projects/u-boot_patch/fs/ubifs/ubifs.c:17:0:
/home/hoefle/projects/u-boot_patch/fs/ubifs/ubifs.h:35:24: fatal error: asm/atomic.h: No such file or directory
 #include <asm/atomic.h>
                        ^
compilation terminated.


/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected 'volatile void *' but argument is of type 'const long unsigned int *'
 static inline int __test_bit(int nr, volatile void *addr)
                   ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function 'ubifs_zn_obsolete':
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
  __test_bit((nr),(addr)))
                  ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:38:11: note: in expansion of macro 'test_bit'
  return !!test_bit(OBSOLETE_ZNODE, &znode->flags);
           ^
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected 'volatile void *' but argument is of type 'const long unsigned int *'
 static inline int __test_bit(int nr, volatile void *addr)
                   ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function 'ubifs_zn_cow':
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
  __test_bit((nr),(addr)))
                  ^
/home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:50:11: note: in expansion of macro 'test_bit'
  return !!test_bit(COW_ZNODE, &znode->flags);
           ^
/home/hoefle/projects/u-boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected 'volatile void *' but argument is of type 'const long unsigned int *'
 static inline int __test_bit(int nr, volatile void *addr)
                   ^



fs/built-in.o: In function `ubifs_lpt_start_commit':
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1232: undefined reference to `dbg_chk_lpt_free_spc'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1235: undefined reference to `dbg_check_ltab'
fs/built-in.o: In function `layout_cnodes':
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:195: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:211: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:219: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:233: undefined reference to `dbg_chk_lpt_sz'
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:246: undefined reference to `dbg_chk_lpt_sz'
fs/built-in.o:/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:254: more undefined references to `dbg_chk_lpt_sz' follow
fs/built-in.o: In function `layout_cnodes':
/home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:322: undefined reference to `ubifs_dump_lpt_lebs'
fs/built-in.o: In function `ubifs_add_bud_to_log':
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:194: undefined reference to `ubifs_commit_required'
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:225: undefined reference to `ubifs_request_bg_commit'
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:265: undefined reference to `ubifs_write_node'
fs/built-in.o: In function `ubifs_log_end_commit':
/home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:479: undefined reference to `ubifs_write_master'
fs/built-in.o: In function `write_orph_node':
/home/hoefle/projects/u-boot_patch/fs/ubifs/orphan.c:248: undefined reference to `ubifs_write_node'


Regards,
Marco



> -----Original Message-----
> From: Heiko Schocher [mailto:hs at denx.de]
> Sent: Freitag, 12. August 2016 07:05
> To: Hoefle Marco <Marco.Hoefle@nanotronic.ch>
> Cc: monstr at monstr.eu; u-boot at lists.denx.de
> Subject: Re: [U-Boot] [PATCH] getting ubifs to run
>
> Hello Marco,
>
> Am 11.08.2016 um 11:56 schrieb Marco:
> > Signed-off-by: Marco <marco.hoefle@nanotronic.ch>
> > ---
> >   arch/microblaze/include/asm/atomic.h | 114
> +++++++++++++++++++++++++++++++++++
> >   arch/microblaze/include/asm/bitops.h |   8 +--
> >   fs/ubifs/io.c                        |   2 +-
> >   fs/ubifs/log.c                       |  99 ++++++++++++++++++++++++++++++
> >   fs/ubifs/lpt_commit.c                |  21 +++++++
> >   5 files changed, 239 insertions(+), 5 deletions(-)
> >   create mode 100644 arch/microblaze/include/asm/atomic.h
>
> Hmm... what exactly do you fix? Can you add a commit message please?
>
> It seems to me, you get ubifs working on microblaze arch?
>
> And may you can split this patch into at least two pieces, one for the arch
> fixes, and one for the ubifs fixes?
>
> ubifs read support works for me on some arm based plattforms ...
> what exactly do you fix with your fs/ubifs/* changes?
>
> Thanks!
>
> bye,
> Heiko
> > diff --git a/arch/microblaze/include/asm/atomic.h
> > b/arch/microblaze/include/asm/atomic.h
> > new file mode 100644
> > index 0000000..2872149
> > --- /dev/null
> > +++ b/arch/microblaze/include/asm/atomic.h
> > @@ -0,0 +1,114 @@
> > +/*
> > + *  linux/include/asm-arm/atomic.h
> > + *
> > + *  Copyright (c) 1996 Russell King.
> > + *
> > + * 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.
> > + *
> > + *  Changelog:
> > + *   27-06-1996    RMK     Created
> > + *   13-04-1997    RMK     Made functions atomic!
> > + *   07-12-1997    RMK     Upgraded for v2.1.
> > + *   26-08-1998    PJB     Added #ifdef __KERNEL__
> > + */
> > +#ifndef __ASM_ARM_ATOMIC_H
> > +#define __ASM_ARM_ATOMIC_H
> > +
> > +#ifdef CONFIG_SMP
> > +#error SMP not supported
> > +#endif
> > +
> > +typedef struct { volatile int counter; } atomic_t;
> > +
> > +#define ATOMIC_INIT(i)     { (i) }
> > +
> > +#ifdef __KERNEL__
> > +#include <asm/system.h>
> > +
> > +#define atomic_read(v)     ((v)->counter)
> > +#define atomic_set(v,i)    (((v)->counter) = (i))
> > +
> > +
> > +
> > +
> > +static inline void atomic_add(int i, volatile atomic_t *v) {
> > +   unsigned long flags = 0;
> > +
> > +   local_irq_save(flags);
> > +   v->counter += i;
> > +   local_irq_restore(flags);
> > +}
> > +
> > +static inline void atomic_sub(int i, volatile atomic_t *v) {
> > +   unsigned long flags = 0;
> > +
> > +   local_irq_save(flags);
> > +   v->counter -= i;
> > +   local_irq_restore(flags);
> > +}
> > +
> > +static inline void atomic_inc(volatile atomic_t *v) {
> > +   unsigned long flags = 0;
> > +
> > +   local_irq_save(flags);
> > +   v->counter += 1;
> > +   local_irq_restore(flags);
> > +}
> > +
> > +static inline void atomic_dec(volatile atomic_t *v) {
> > +   unsigned long flags = 0;
> > +
> > +   local_irq_save(flags);
> > +   v->counter -= 1;
> > +   local_irq_restore(flags);
> > +}
> > +
> > +static inline int atomic_dec_and_test(volatile atomic_t *v) {
> > +   unsigned long flags = 0;
> > +   int val;
> > +
> > +   local_irq_save(flags);
> > +   val = v->counter;
> > +   v->counter = val -= 1;
> > +   local_irq_restore(flags);
> > +
> > +   return val == 0;
> > +}
> > +
> > +static inline int atomic_add_negative(int i, volatile atomic_t *v) {
> > +   unsigned long flags = 0;
> > +   int val;
> > +
> > +   local_irq_save(flags);
> > +   val = v->counter;
> > +   v->counter = val += i;
> > +   local_irq_restore(flags);
> > +
> > +   return val < 0;
> > +}
> > +
> > +static inline void atomic_clear_mask(unsigned long mask, unsigned
> > +long *addr) {
> > +   unsigned long flags = 0;
> > +
> > +   local_irq_save(flags);
> > +   *addr &= ~mask;
> > +   local_irq_restore(flags);
> > +}
> > +
> > +/* Atomic operations are already serializing on ARM */
> > +#define smp_mb__before_atomic_dec()        barrier()
> > +#define smp_mb__after_atomic_dec() barrier()
> > +#define smp_mb__before_atomic_inc()        barrier()
> > +#define smp_mb__after_atomic_inc() barrier()
> > +
> > +#endif
> > +#endif
> > diff --git a/arch/microblaze/include/asm/bitops.h
> > b/arch/microblaze/include/asm/bitops.h
> > index 2cab2ac..b3b17b9 100644
> > --- a/arch/microblaze/include/asm/bitops.h
> > +++ b/arch/microblaze/include/asm/bitops.h
> > @@ -204,10 +204,10 @@ static inline int __test_bit(int nr, volatile void
> *addr)
> >     return ((mask & *a) != 0);
> >   }
> >
> > -#define test_bit(nr,addr) \
> > -(__builtin_constant_p(nr) ? \
> > - __constant_test_bit((nr),(addr)) : \
> > - __test_bit((nr),(addr)))
> > +static inline int test_bit(int nr, const void * addr) {
> > +   return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
> >
> >   #define find_first_zero_bit(addr, size) \
> >     find_next_zero_bit((addr), (size), 0) diff --git a/fs/ubifs/io.c
> > b/fs/ubifs/io.c index 51a95bb..685713e 100644
> > --- a/fs/ubifs/io.c
> > +++ b/fs/ubifs/io.c
> > @@ -847,6 +847,7 @@ out:
> >     ubifs_dump_leb(c, wbuf->lnum);
> >     return err;
> >   }
> > +#endif
> >
> >   /**
> >    * ubifs_write_node - write node to the media.
> > @@ -885,7 +886,6 @@ int ubifs_write_node(struct ubifs_info *c, void
> > *buf, int len, int lnum,
> >
> >     return err;
> >   }
> > -#endif
> >
> >   /**
> >    * ubifs_read_node_wbuf - read node from the media or write-buffer.
> > diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index a07fdef..10302b9
> > 100644
> > --- a/fs/ubifs/log.c
> > +++ b/fs/ubifs/log.c
> > @@ -743,3 +743,102 @@ static int dbg_check_bud_bytes(struct ubifs_info
> > *c)
> >
> >     return err;
> >   }
> > +
> > +
> > +/**
> > + * ubifs_commit_required - set commit state to "required".
> > + * @c: UBIFS file-system description object
> > + *
> > + * This function is called if a commit is required but cannot be done
> > +from the
> > + * calling function, so it is just flagged instead.
> > + */
> > +void ubifs_commit_required(struct ubifs_info *c) {
> > +   spin_lock(&c->cs_lock);
> > +   switch (c->cmt_state) {
> > +   case COMMIT_RESTING:
> > +   case COMMIT_BACKGROUND:
> > +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > +                   dbg_cstate(COMMIT_REQUIRED));
> > +           c->cmt_state = COMMIT_REQUIRED;
> > +           break;
> > +   case COMMIT_RUNNING_BACKGROUND:
> > +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > +                   dbg_cstate(COMMIT_RUNNING_REQUIRED));
> > +           c->cmt_state = COMMIT_RUNNING_REQUIRED;
> > +           break;
> > +   case COMMIT_REQUIRED:
> > +   case COMMIT_RUNNING_REQUIRED:
> > +   case COMMIT_BROKEN:
> > +           break;
> > +   }
> > +   spin_unlock(&c->cs_lock);
> > +}
> > +
> > +/**
> > + * ubifs_write_master - write master node.
> > + * @c: UBIFS file-system description object
> > + *
> > + * This function writes the master node. Returns zero in case of
> > +success and a
> > + * negative error code in case of failure. The master node is written
> > +twice to
> > + * enable recovery.
> > + */
> > +int ubifs_write_master(struct ubifs_info *c) {
> > +   int err, lnum, offs, len;
> > +
> > +   ubifs_assert(!c->ro_media && !c->ro_mount);
> > +   if (c->ro_error)
> > +           return -EROFS;
> > +
> > +   lnum = UBIFS_MST_LNUM;
> > +   offs = c->mst_offs + c->mst_node_alsz;
> > +   len = UBIFS_MST_NODE_SZ;
> > +
> > +   if (offs + UBIFS_MST_NODE_SZ > c->leb_size) {
> > +           err = ubifs_leb_unmap(c, lnum);
> > +           if (err)
> > +                   return err;
> > +           offs = 0;
> > +   }
> > +
> > +   c->mst_offs = offs;
> > +   c->mst_node->highest_inum = cpu_to_le64(c->highest_inum);
> > +
> > +   err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> > +   if (err)
> > +           return err;
> > +
> > +   lnum += 1;
> > +
> > +   if (offs == 0) {
> > +           err = ubifs_leb_unmap(c, lnum);
> > +           if (err)
> > +                   return err;
> > +   }
> > +   err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> > +
> > +   return err;
> > +}
> > +
> > +/**
> > + * ubifs_request_bg_commit - notify the background thread to do a
> commit.
> > + * @c: UBIFS file-system description object
> > + *
> > + * This function is called if the journal is full enough to make a
> > +commit
> > + * worthwhile, so background thread is kicked to start it.
> > + */
> > +void ubifs_request_bg_commit(struct ubifs_info *c) {
> > +   spin_lock(&c->cs_lock);
> > +   if (c->cmt_state == COMMIT_RESTING) {
> > +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > +                   dbg_cstate(COMMIT_BACKGROUND));
> > +           c->cmt_state = COMMIT_BACKGROUND;
> > +           spin_unlock(&c->cs_lock);
> > +           ubifs_wake_up_bgt(c);
> > +   } else
> > +           spin_unlock(&c->cs_lock);
> > +}
> > +
> > +
> > diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index
> > 2df9130..61b2cc8 100644
> > --- a/fs/ubifs/lpt_commit.c
> > +++ b/fs/ubifs/lpt_commit.c
> > @@ -2039,4 +2039,25 @@ static int dbg_populate_lsave(struct ubifs_info
> > *c)
> >
> >     return 1;
> >   }
> > +#else
> > +
> > +int dbg_chk_lpt_free_spc(struct ubifs_info *c) {
> > +   return 0;
> > +}
> > +
> > +int dbg_check_ltab(struct ubifs_info *c) {
> > +   return 0;
> > +}
> > +
> > +int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) {
> > +   return 0;
> > +}
> > +
> > +void ubifs_dump_lpt_lebs(const struct ubifs_info *c) { }
> > +
> >   #endif
> >
>
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-08-15 11:55     ` [U-Boot] WG: " Hoefle Marco
@ 2016-09-01 12:45       ` Hoefle Marco
  2016-09-02  7:57         ` Heiko Schocher
  0 siblings, 1 reply; 11+ messages in thread
From: Hoefle Marco @ 2016-09-01 12:45 UTC (permalink / raw)
  To: u-boot

Hello Heiko and Michal,
Do you agree that the u-boot sources need to be adapted in order to have ubifs on the Microblaze?
It would be good if the changes are somehow in the mainline.
BR
Marco


> -----Original Message-----
> From: Hoefle Marco
> Sent: Montag, 15. August 2016 13:55
> To: u-boot at lists.denx.de; hs at denx.de
> Cc: monstr at monstr.eu
> Subject: WG: [U-Boot] [PATCH] getting ubifs to run
> 
> Hello Heiko,
> You are right, there are two parts: the Microblaze part and the ubifs stuff.
> To get u-boot compiled I added the following to the Microblaze architecture:
> atomic.h based on the ARM architecture, was missing before.
> Modified bitops.h to get rid of compiler warnings The three ubifs files had
> #defines which didn't work for me.
> With the changes of the patch I sent I can successfully load the Kernel from a
> ubifs partition on a Microblaze.
> 
> 
> That were the problems:
> 
> CC      fs/ubifs/ubifs.o
> In file included from /home/hoefle/projects/u-
> boot_patch/fs/ubifs/ubifs.c:17:0:
> /home/hoefle/projects/u-boot_patch/fs/ubifs/ubifs.h:35:24: fatal error:
> asm/atomic.h: No such file or directory  #include <asm/atomic.h>
>                         ^
> compilation terminated.
> 
> 
> /home/hoefle/projects/u-
> boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected
> 'volatile void *' but argument is of type 'const long unsigned int *'
>  static inline int __test_bit(int nr, volatile void *addr)
>                    ^
> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function
> 'ubifs_zn_obsolete':
> /home/hoefle/projects/u-
> boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing
> argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
>   __test_bit((nr),(addr)))
>                   ^
> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:38:11: note: in
> expansion of macro 'test_bit'
>   return !!test_bit(OBSOLETE_ZNODE, &znode->flags);
>            ^
> /home/hoefle/projects/u-
> boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected
> 'volatile void *' but argument is of type 'const long unsigned int *'
>  static inline int __test_bit(int nr, volatile void *addr)
>                    ^
> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function
> 'ubifs_zn_cow':
> /home/hoefle/projects/u-
> boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing
> argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
>   __test_bit((nr),(addr)))
>                   ^
> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:50:11: note: in
> expansion of macro 'test_bit'
>   return !!test_bit(COW_ZNODE, &znode->flags);
>            ^
> /home/hoefle/projects/u-
> boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected
> 'volatile void *' but argument is of type 'const long unsigned int *'
>  static inline int __test_bit(int nr, volatile void *addr)
>                    ^
> 
> 
> 
> fs/built-in.o: In function `ubifs_lpt_start_commit':
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1232:
> undefined reference to `dbg_chk_lpt_free_spc'
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1235:
> undefined reference to `dbg_check_ltab'
> fs/built-in.o: In function `layout_cnodes':
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:195: undefined
> reference to `dbg_chk_lpt_sz'
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:211: undefined
> reference to `dbg_chk_lpt_sz'
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:219: undefined
> reference to `dbg_chk_lpt_sz'
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:233: undefined
> reference to `dbg_chk_lpt_sz'
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:246: undefined
> reference to `dbg_chk_lpt_sz'
> fs/built-in.o:/home/hoefle/projects/u-
> boot_patch/fs/ubifs/lpt_commit.c:254: more undefined references to
> `dbg_chk_lpt_sz' follow
> fs/built-in.o: In function `layout_cnodes':
> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:322: undefined
> reference to `ubifs_dump_lpt_lebs'
> fs/built-in.o: In function `ubifs_add_bud_to_log':
> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:194: undefined
> reference to `ubifs_commit_required'
> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:225: undefined
> reference to `ubifs_request_bg_commit'
> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:265: undefined
> reference to `ubifs_write_node'
> fs/built-in.o: In function `ubifs_log_end_commit':
> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:479: undefined
> reference to `ubifs_write_master'
> fs/built-in.o: In function `write_orph_node':
> /home/hoefle/projects/u-boot_patch/fs/ubifs/orphan.c:248: undefined
> reference to `ubifs_write_node'
> 
> 
> Regards,
> Marco
> 
> 
> 
> > -----Original Message-----
> > From: Heiko Schocher [mailto:hs at denx.de]
> > Sent: Freitag, 12. August 2016 07:05
> > To: Hoefle Marco <Marco.Hoefle@nanotronic.ch>
> > Cc: monstr at monstr.eu; u-boot at lists.denx.de
> > Subject: Re: [U-Boot] [PATCH] getting ubifs to run
> >
> > Hello Marco,
> >
> > Am 11.08.2016 um 11:56 schrieb Marco:
> > > Signed-off-by: Marco <marco.hoefle@nanotronic.ch>
> > > ---
> > >   arch/microblaze/include/asm/atomic.h | 114
> > +++++++++++++++++++++++++++++++++++
> > >   arch/microblaze/include/asm/bitops.h |   8 +--
> > >   fs/ubifs/io.c                        |   2 +-
> > >   fs/ubifs/log.c                       |  99 ++++++++++++++++++++++++++++++
> > >   fs/ubifs/lpt_commit.c                |  21 +++++++
> > >   5 files changed, 239 insertions(+), 5 deletions(-)
> > >   create mode 100644 arch/microblaze/include/asm/atomic.h
> >
> > Hmm... what exactly do you fix? Can you add a commit message please?
> >
> > It seems to me, you get ubifs working on microblaze arch?
> >
> > And may you can split this patch into at least two pieces, one for the
> > arch fixes, and one for the ubifs fixes?
> >
> > ubifs read support works for me on some arm based plattforms ...
> > what exactly do you fix with your fs/ubifs/* changes?
> >
> > Thanks!
> >
> > bye,
> > Heiko
> > > diff --git a/arch/microblaze/include/asm/atomic.h
> > > b/arch/microblaze/include/asm/atomic.h
> > > new file mode 100644
> > > index 0000000..2872149
> > > --- /dev/null
> > > +++ b/arch/microblaze/include/asm/atomic.h
> > > @@ -0,0 +1,114 @@
> > > +/*
> > > + *  linux/include/asm-arm/atomic.h
> > > + *
> > > + *  Copyright (c) 1996 Russell King.
> > > + *
> > > + * 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.
> > > + *
> > > + *  Changelog:
> > > + *   27-06-1996    RMK     Created
> > > + *   13-04-1997    RMK     Made functions atomic!
> > > + *   07-12-1997    RMK     Upgraded for v2.1.
> > > + *   26-08-1998    PJB     Added #ifdef __KERNEL__
> > > + */
> > > +#ifndef __ASM_ARM_ATOMIC_H
> > > +#define __ASM_ARM_ATOMIC_H
> > > +
> > > +#ifdef CONFIG_SMP
> > > +#error SMP not supported
> > > +#endif
> > > +
> > > +typedef struct { volatile int counter; } atomic_t;
> > > +
> > > +#define ATOMIC_INIT(i)     { (i) }
> > > +
> > > +#ifdef __KERNEL__
> > > +#include <asm/system.h>
> > > +
> > > +#define atomic_read(v)     ((v)->counter)
> > > +#define atomic_set(v,i)    (((v)->counter) = (i))
> > > +
> > > +
> > > +
> > > +
> > > +static inline void atomic_add(int i, volatile atomic_t *v) {
> > > +   unsigned long flags = 0;
> > > +
> > > +   local_irq_save(flags);
> > > +   v->counter += i;
> > > +   local_irq_restore(flags);
> > > +}
> > > +
> > > +static inline void atomic_sub(int i, volatile atomic_t *v) {
> > > +   unsigned long flags = 0;
> > > +
> > > +   local_irq_save(flags);
> > > +   v->counter -= i;
> > > +   local_irq_restore(flags);
> > > +}
> > > +
> > > +static inline void atomic_inc(volatile atomic_t *v) {
> > > +   unsigned long flags = 0;
> > > +
> > > +   local_irq_save(flags);
> > > +   v->counter += 1;
> > > +   local_irq_restore(flags);
> > > +}
> > > +
> > > +static inline void atomic_dec(volatile atomic_t *v) {
> > > +   unsigned long flags = 0;
> > > +
> > > +   local_irq_save(flags);
> > > +   v->counter -= 1;
> > > +   local_irq_restore(flags);
> > > +}
> > > +
> > > +static inline int atomic_dec_and_test(volatile atomic_t *v) {
> > > +   unsigned long flags = 0;
> > > +   int val;
> > > +
> > > +   local_irq_save(flags);
> > > +   val = v->counter;
> > > +   v->counter = val -= 1;
> > > +   local_irq_restore(flags);
> > > +
> > > +   return val == 0;
> > > +}
> > > +
> > > +static inline int atomic_add_negative(int i, volatile atomic_t *v) {
> > > +   unsigned long flags = 0;
> > > +   int val;
> > > +
> > > +   local_irq_save(flags);
> > > +   val = v->counter;
> > > +   v->counter = val += i;
> > > +   local_irq_restore(flags);
> > > +
> > > +   return val < 0;
> > > +}
> > > +
> > > +static inline void atomic_clear_mask(unsigned long mask, unsigned
> > > +long *addr) {
> > > +   unsigned long flags = 0;
> > > +
> > > +   local_irq_save(flags);
> > > +   *addr &= ~mask;
> > > +   local_irq_restore(flags);
> > > +}
> > > +
> > > +/* Atomic operations are already serializing on ARM */
> > > +#define smp_mb__before_atomic_dec()        barrier()
> > > +#define smp_mb__after_atomic_dec() barrier()
> > > +#define smp_mb__before_atomic_inc()        barrier()
> > > +#define smp_mb__after_atomic_inc() barrier()
> > > +
> > > +#endif
> > > +#endif
> > > diff --git a/arch/microblaze/include/asm/bitops.h
> > > b/arch/microblaze/include/asm/bitops.h
> > > index 2cab2ac..b3b17b9 100644
> > > --- a/arch/microblaze/include/asm/bitops.h
> > > +++ b/arch/microblaze/include/asm/bitops.h
> > > @@ -204,10 +204,10 @@ static inline int __test_bit(int nr, volatile
> > > void
> > *addr)
> > >     return ((mask & *a) != 0);
> > >   }
> > >
> > > -#define test_bit(nr,addr) \
> > > -(__builtin_constant_p(nr) ? \
> > > - __constant_test_bit((nr),(addr)) : \
> > > - __test_bit((nr),(addr)))
> > > +static inline int test_bit(int nr, const void * addr) {
> > > +   return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
> > >
> > >   #define find_first_zero_bit(addr, size) \
> > >     find_next_zero_bit((addr), (size), 0) diff --git a/fs/ubifs/io.c
> > > b/fs/ubifs/io.c index 51a95bb..685713e 100644
> > > --- a/fs/ubifs/io.c
> > > +++ b/fs/ubifs/io.c
> > > @@ -847,6 +847,7 @@ out:
> > >     ubifs_dump_leb(c, wbuf->lnum);
> > >     return err;
> > >   }
> > > +#endif
> > >
> > >   /**
> > >    * ubifs_write_node - write node to the media.
> > > @@ -885,7 +886,6 @@ int ubifs_write_node(struct ubifs_info *c, void
> > > *buf, int len, int lnum,
> > >
> > >     return err;
> > >   }
> > > -#endif
> > >
> > >   /**
> > >    * ubifs_read_node_wbuf - read node from the media or write-buffer.
> > > diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index a07fdef..10302b9
> > > 100644
> > > --- a/fs/ubifs/log.c
> > > +++ b/fs/ubifs/log.c
> > > @@ -743,3 +743,102 @@ static int dbg_check_bud_bytes(struct
> > > ubifs_info
> > > *c)
> > >
> > >     return err;
> > >   }
> > > +
> > > +
> > > +/**
> > > + * ubifs_commit_required - set commit state to "required".
> > > + * @c: UBIFS file-system description object
> > > + *
> > > + * This function is called if a commit is required but cannot be
> > > +done from the
> > > + * calling function, so it is just flagged instead.
> > > + */
> > > +void ubifs_commit_required(struct ubifs_info *c) {
> > > +   spin_lock(&c->cs_lock);
> > > +   switch (c->cmt_state) {
> > > +   case COMMIT_RESTING:
> > > +   case COMMIT_BACKGROUND:
> > > +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > > +                   dbg_cstate(COMMIT_REQUIRED));
> > > +           c->cmt_state = COMMIT_REQUIRED;
> > > +           break;
> > > +   case COMMIT_RUNNING_BACKGROUND:
> > > +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > > +                   dbg_cstate(COMMIT_RUNNING_REQUIRED));
> > > +           c->cmt_state = COMMIT_RUNNING_REQUIRED;
> > > +           break;
> > > +   case COMMIT_REQUIRED:
> > > +   case COMMIT_RUNNING_REQUIRED:
> > > +   case COMMIT_BROKEN:
> > > +           break;
> > > +   }
> > > +   spin_unlock(&c->cs_lock);
> > > +}
> > > +
> > > +/**
> > > + * ubifs_write_master - write master node.
> > > + * @c: UBIFS file-system description object
> > > + *
> > > + * This function writes the master node. Returns zero in case of
> > > +success and a
> > > + * negative error code in case of failure. The master node is
> > > +written twice to
> > > + * enable recovery.
> > > + */
> > > +int ubifs_write_master(struct ubifs_info *c) {
> > > +   int err, lnum, offs, len;
> > > +
> > > +   ubifs_assert(!c->ro_media && !c->ro_mount);
> > > +   if (c->ro_error)
> > > +           return -EROFS;
> > > +
> > > +   lnum = UBIFS_MST_LNUM;
> > > +   offs = c->mst_offs + c->mst_node_alsz;
> > > +   len = UBIFS_MST_NODE_SZ;
> > > +
> > > +   if (offs + UBIFS_MST_NODE_SZ > c->leb_size) {
> > > +           err = ubifs_leb_unmap(c, lnum);
> > > +           if (err)
> > > +                   return err;
> > > +           offs = 0;
> > > +   }
> > > +
> > > +   c->mst_offs = offs;
> > > +   c->mst_node->highest_inum = cpu_to_le64(c->highest_inum);
> > > +
> > > +   err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> > > +   if (err)
> > > +           return err;
> > > +
> > > +   lnum += 1;
> > > +
> > > +   if (offs == 0) {
> > > +           err = ubifs_leb_unmap(c, lnum);
> > > +           if (err)
> > > +                   return err;
> > > +   }
> > > +   err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
> > > +
> > > +   return err;
> > > +}
> > > +
> > > +/**
> > > + * ubifs_request_bg_commit - notify the background thread to do a
> > commit.
> > > + * @c: UBIFS file-system description object
> > > + *
> > > + * This function is called if the journal is full enough to make a
> > > +commit
> > > + * worthwhile, so background thread is kicked to start it.
> > > + */
> > > +void ubifs_request_bg_commit(struct ubifs_info *c) {
> > > +   spin_lock(&c->cs_lock);
> > > +   if (c->cmt_state == COMMIT_RESTING) {
> > > +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
> > > +                   dbg_cstate(COMMIT_BACKGROUND));
> > > +           c->cmt_state = COMMIT_BACKGROUND;
> > > +           spin_unlock(&c->cs_lock);
> > > +           ubifs_wake_up_bgt(c);
> > > +   } else
> > > +           spin_unlock(&c->cs_lock); }
> > > +
> > > +
> > > diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index
> > > 2df9130..61b2cc8 100644
> > > --- a/fs/ubifs/lpt_commit.c
> > > +++ b/fs/ubifs/lpt_commit.c
> > > @@ -2039,4 +2039,25 @@ static int dbg_populate_lsave(struct
> > > ubifs_info
> > > *c)
> > >
> > >     return 1;
> > >   }
> > > +#else
> > > +
> > > +int dbg_chk_lpt_free_spc(struct ubifs_info *c) {
> > > +   return 0;
> > > +}
> > > +
> > > +int dbg_check_ltab(struct ubifs_info *c) {
> > > +   return 0;
> > > +}
> > > +
> > > +int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) {
> > > +   return 0;
> > > +}
> > > +
> > > +void ubifs_dump_lpt_lebs(const struct ubifs_info *c) { }
> > > +
> > >   #endif
> > >
> >
> > --
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> >

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-09-01 12:45       ` [U-Boot] " Hoefle Marco
@ 2016-09-02  7:57         ` Heiko Schocher
  0 siblings, 0 replies; 11+ messages in thread
From: Heiko Schocher @ 2016-09-02  7:57 UTC (permalink / raw)
  To: u-boot

Hello Marco,

Am 01.09.2016 um 14:45 schrieb Hoefle Marco:
> Hello Heiko and Michal,
> Do you agree that the u-boot sources need to be adapted in order to have ubifs on the Microblaze?

As you found an error, yes!

> It would be good if the changes are somehow in the mainline.

Of course ... Hmm I wrote on"12.08.2016 07:05":
> Hmm... what exactly do you fix? Can you add a commit message please?
>
> It seems to me, you get ubifs working on microblaze arch?
>
> And may you can split this patch into at least two pieces, one for the
> arch fixes, and one for the ubifs fixes?
>
> ubifs read support works for me on some arm based plattforms ...
> what exactly do you fix with your fs/ubifs/* changes?

May I was unclear ... I am waiting for a v2 ;-)

Please split your patch into 2 pieces, write a commit message
and resend them as a v2 to the list with Michal and me in CC

Thanks!

bye,
Heiko

> BR
> Marco
>
>
>> -----Original Message-----
>> From: Hoefle Marco
>> Sent: Montag, 15. August 2016 13:55
>> To: u-boot at lists.denx.de; hs at denx.de
>> Cc: monstr at monstr.eu
>> Subject: WG: [U-Boot] [PATCH] getting ubifs to run
>>
>> Hello Heiko,
>> You are right, there are two parts: the Microblaze part and the ubifs stuff.
>> To get u-boot compiled I added the following to the Microblaze architecture:
>> atomic.h based on the ARM architecture, was missing before.
>> Modified bitops.h to get rid of compiler warnings The three ubifs files had
>> #defines which didn't work for me.
>> With the changes of the patch I sent I can successfully load the Kernel from a
>> ubifs partition on a Microblaze.
>>
>>
>> That were the problems:
>>
>> CC      fs/ubifs/ubifs.o
>> In file included from /home/hoefle/projects/u-
>> boot_patch/fs/ubifs/ubifs.c:17:0:
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/ubifs.h:35:24: fatal error:
>> asm/atomic.h: No such file or directory  #include <asm/atomic.h>
>>                          ^
>> compilation terminated.
>>
>>
>> /home/hoefle/projects/u-
>> boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected
>> 'volatile void *' but argument is of type 'const long unsigned int *'
>>   static inline int __test_bit(int nr, volatile void *addr)
>>                     ^
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function
>> 'ubifs_zn_obsolete':
>> /home/hoefle/projects/u-
>> boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing
>> argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
>>    __test_bit((nr),(addr)))
>>                    ^
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:38:11: note: in
>> expansion of macro 'test_bit'
>>    return !!test_bit(OBSOLETE_ZNODE, &znode->flags);
>>             ^
>> /home/hoefle/projects/u-
>> boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected
>> 'volatile void *' but argument is of type 'const long unsigned int *'
>>   static inline int __test_bit(int nr, volatile void *addr)
>>                     ^
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h: In function
>> 'ubifs_zn_cow':
>> /home/hoefle/projects/u-
>> boot_patch/arch/microblaze/include/asm/bitops.h:210:18: warning: passing
>> argument 2 of '__test_bit' discards 'const' qualifier from pointer target type
>>    __test_bit((nr),(addr)))
>>                    ^
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/misc.h:50:11: note: in
>> expansion of macro 'test_bit'
>>    return !!test_bit(COW_ZNODE, &znode->flags);
>>             ^
>> /home/hoefle/projects/u-
>> boot_patch/arch/microblaze/include/asm/bitops.h:197:19: note: expected
>> 'volatile void *' but argument is of type 'const long unsigned int *'
>>   static inline int __test_bit(int nr, volatile void *addr)
>>                     ^
>>
>>
>>
>> fs/built-in.o: In function `ubifs_lpt_start_commit':
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1232:
>> undefined reference to `dbg_chk_lpt_free_spc'
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:1235:
>> undefined reference to `dbg_check_ltab'
>> fs/built-in.o: In function `layout_cnodes':
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:195: undefined
>> reference to `dbg_chk_lpt_sz'
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:211: undefined
>> reference to `dbg_chk_lpt_sz'
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:219: undefined
>> reference to `dbg_chk_lpt_sz'
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:233: undefined
>> reference to `dbg_chk_lpt_sz'
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:246: undefined
>> reference to `dbg_chk_lpt_sz'
>> fs/built-in.o:/home/hoefle/projects/u-
>> boot_patch/fs/ubifs/lpt_commit.c:254: more undefined references to
>> `dbg_chk_lpt_sz' follow
>> fs/built-in.o: In function `layout_cnodes':
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/lpt_commit.c:322: undefined
>> reference to `ubifs_dump_lpt_lebs'
>> fs/built-in.o: In function `ubifs_add_bud_to_log':
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:194: undefined
>> reference to `ubifs_commit_required'
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:225: undefined
>> reference to `ubifs_request_bg_commit'
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:265: undefined
>> reference to `ubifs_write_node'
>> fs/built-in.o: In function `ubifs_log_end_commit':
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/log.c:479: undefined
>> reference to `ubifs_write_master'
>> fs/built-in.o: In function `write_orph_node':
>> /home/hoefle/projects/u-boot_patch/fs/ubifs/orphan.c:248: undefined
>> reference to `ubifs_write_node'
>>
>>
>> Regards,
>> Marco
>>
>>
>>
>>> -----Original Message-----
>>> From: Heiko Schocher [mailto:hs at denx.de]
>>> Sent: Freitag, 12. August 2016 07:05
>>> To: Hoefle Marco <Marco.Hoefle@nanotronic.ch>
>>> Cc: monstr at monstr.eu; u-boot at lists.denx.de
>>> Subject: Re: [U-Boot] [PATCH] getting ubifs to run
>>>
>>> Hello Marco,
>>>
>>> Am 11.08.2016 um 11:56 schrieb Marco:
>>>> Signed-off-by: Marco <marco.hoefle@nanotronic.ch>
>>>> ---
>>>>    arch/microblaze/include/asm/atomic.h | 114
>>> +++++++++++++++++++++++++++++++++++
>>>>    arch/microblaze/include/asm/bitops.h |   8 +--
>>>>    fs/ubifs/io.c                        |   2 +-
>>>>    fs/ubifs/log.c                       |  99 ++++++++++++++++++++++++++++++
>>>>    fs/ubifs/lpt_commit.c                |  21 +++++++
>>>>    5 files changed, 239 insertions(+), 5 deletions(-)
>>>>    create mode 100644 arch/microblaze/include/asm/atomic.h
>>>
>>> Hmm... what exactly do you fix? Can you add a commit message please?
>>>
>>> It seems to me, you get ubifs working on microblaze arch?
>>>
>>> And may you can split this patch into at least two pieces, one for the
>>> arch fixes, and one for the ubifs fixes?
>>>
>>> ubifs read support works for me on some arm based plattforms ...
>>> what exactly do you fix with your fs/ubifs/* changes?
>>>
>>> Thanks!
>>>
>>> bye,
>>> Heiko
>>>> diff --git a/arch/microblaze/include/asm/atomic.h
>>>> b/arch/microblaze/include/asm/atomic.h
>>>> new file mode 100644
>>>> index 0000000..2872149
>>>> --- /dev/null
>>>> +++ b/arch/microblaze/include/asm/atomic.h
>>>> @@ -0,0 +1,114 @@
>>>> +/*
>>>> + *  linux/include/asm-arm/atomic.h
>>>> + *
>>>> + *  Copyright (c) 1996 Russell King.
>>>> + *
>>>> + * 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.
>>>> + *
>>>> + *  Changelog:
>>>> + *   27-06-1996    RMK     Created
>>>> + *   13-04-1997    RMK     Made functions atomic!
>>>> + *   07-12-1997    RMK     Upgraded for v2.1.
>>>> + *   26-08-1998    PJB     Added #ifdef __KERNEL__
>>>> + */
>>>> +#ifndef __ASM_ARM_ATOMIC_H
>>>> +#define __ASM_ARM_ATOMIC_H
>>>> +
>>>> +#ifdef CONFIG_SMP
>>>> +#error SMP not supported
>>>> +#endif
>>>> +
>>>> +typedef struct { volatile int counter; } atomic_t;
>>>> +
>>>> +#define ATOMIC_INIT(i)     { (i) }
>>>> +
>>>> +#ifdef __KERNEL__
>>>> +#include <asm/system.h>
>>>> +
>>>> +#define atomic_read(v)     ((v)->counter)
>>>> +#define atomic_set(v,i)    (((v)->counter) = (i))
>>>> +
>>>> +
>>>> +
>>>> +
>>>> +static inline void atomic_add(int i, volatile atomic_t *v) {
>>>> +   unsigned long flags = 0;
>>>> +
>>>> +   local_irq_save(flags);
>>>> +   v->counter += i;
>>>> +   local_irq_restore(flags);
>>>> +}
>>>> +
>>>> +static inline void atomic_sub(int i, volatile atomic_t *v) {
>>>> +   unsigned long flags = 0;
>>>> +
>>>> +   local_irq_save(flags);
>>>> +   v->counter -= i;
>>>> +   local_irq_restore(flags);
>>>> +}
>>>> +
>>>> +static inline void atomic_inc(volatile atomic_t *v) {
>>>> +   unsigned long flags = 0;
>>>> +
>>>> +   local_irq_save(flags);
>>>> +   v->counter += 1;
>>>> +   local_irq_restore(flags);
>>>> +}
>>>> +
>>>> +static inline void atomic_dec(volatile atomic_t *v) {
>>>> +   unsigned long flags = 0;
>>>> +
>>>> +   local_irq_save(flags);
>>>> +   v->counter -= 1;
>>>> +   local_irq_restore(flags);
>>>> +}
>>>> +
>>>> +static inline int atomic_dec_and_test(volatile atomic_t *v) {
>>>> +   unsigned long flags = 0;
>>>> +   int val;
>>>> +
>>>> +   local_irq_save(flags);
>>>> +   val = v->counter;
>>>> +   v->counter = val -= 1;
>>>> +   local_irq_restore(flags);
>>>> +
>>>> +   return val == 0;
>>>> +}
>>>> +
>>>> +static inline int atomic_add_negative(int i, volatile atomic_t *v) {
>>>> +   unsigned long flags = 0;
>>>> +   int val;
>>>> +
>>>> +   local_irq_save(flags);
>>>> +   val = v->counter;
>>>> +   v->counter = val += i;
>>>> +   local_irq_restore(flags);
>>>> +
>>>> +   return val < 0;
>>>> +}
>>>> +
>>>> +static inline void atomic_clear_mask(unsigned long mask, unsigned
>>>> +long *addr) {
>>>> +   unsigned long flags = 0;
>>>> +
>>>> +   local_irq_save(flags);
>>>> +   *addr &= ~mask;
>>>> +   local_irq_restore(flags);
>>>> +}
>>>> +
>>>> +/* Atomic operations are already serializing on ARM */
>>>> +#define smp_mb__before_atomic_dec()        barrier()
>>>> +#define smp_mb__after_atomic_dec() barrier()
>>>> +#define smp_mb__before_atomic_inc()        barrier()
>>>> +#define smp_mb__after_atomic_inc() barrier()
>>>> +
>>>> +#endif
>>>> +#endif
>>>> diff --git a/arch/microblaze/include/asm/bitops.h
>>>> b/arch/microblaze/include/asm/bitops.h
>>>> index 2cab2ac..b3b17b9 100644
>>>> --- a/arch/microblaze/include/asm/bitops.h
>>>> +++ b/arch/microblaze/include/asm/bitops.h
>>>> @@ -204,10 +204,10 @@ static inline int __test_bit(int nr, volatile
>>>> void
>>> *addr)
>>>>      return ((mask & *a) != 0);
>>>>    }
>>>>
>>>> -#define test_bit(nr,addr) \
>>>> -(__builtin_constant_p(nr) ? \
>>>> - __constant_test_bit((nr),(addr)) : \
>>>> - __test_bit((nr),(addr)))
>>>> +static inline int test_bit(int nr, const void * addr) {
>>>> +   return ((unsigned char *) addr)[nr >> 3] & (1U << (nr & 7)); }
>>>>
>>>>    #define find_first_zero_bit(addr, size) \
>>>>      find_next_zero_bit((addr), (size), 0) diff --git a/fs/ubifs/io.c
>>>> b/fs/ubifs/io.c index 51a95bb..685713e 100644
>>>> --- a/fs/ubifs/io.c
>>>> +++ b/fs/ubifs/io.c
>>>> @@ -847,6 +847,7 @@ out:
>>>>      ubifs_dump_leb(c, wbuf->lnum);
>>>>      return err;
>>>>    }
>>>> +#endif
>>>>
>>>>    /**
>>>>     * ubifs_write_node - write node to the media.
>>>> @@ -885,7 +886,6 @@ int ubifs_write_node(struct ubifs_info *c, void
>>>> *buf, int len, int lnum,
>>>>
>>>>      return err;
>>>>    }
>>>> -#endif
>>>>
>>>>    /**
>>>>     * ubifs_read_node_wbuf - read node from the media or write-buffer.
>>>> diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index a07fdef..10302b9
>>>> 100644
>>>> --- a/fs/ubifs/log.c
>>>> +++ b/fs/ubifs/log.c
>>>> @@ -743,3 +743,102 @@ static int dbg_check_bud_bytes(struct
>>>> ubifs_info
>>>> *c)
>>>>
>>>>      return err;
>>>>    }
>>>> +
>>>> +
>>>> +/**
>>>> + * ubifs_commit_required - set commit state to "required".
>>>> + * @c: UBIFS file-system description object
>>>> + *
>>>> + * This function is called if a commit is required but cannot be
>>>> +done from the
>>>> + * calling function, so it is just flagged instead.
>>>> + */
>>>> +void ubifs_commit_required(struct ubifs_info *c) {
>>>> +   spin_lock(&c->cs_lock);
>>>> +   switch (c->cmt_state) {
>>>> +   case COMMIT_RESTING:
>>>> +   case COMMIT_BACKGROUND:
>>>> +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
>>>> +                   dbg_cstate(COMMIT_REQUIRED));
>>>> +           c->cmt_state = COMMIT_REQUIRED;
>>>> +           break;
>>>> +   case COMMIT_RUNNING_BACKGROUND:
>>>> +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
>>>> +                   dbg_cstate(COMMIT_RUNNING_REQUIRED));
>>>> +           c->cmt_state = COMMIT_RUNNING_REQUIRED;
>>>> +           break;
>>>> +   case COMMIT_REQUIRED:
>>>> +   case COMMIT_RUNNING_REQUIRED:
>>>> +   case COMMIT_BROKEN:
>>>> +           break;
>>>> +   }
>>>> +   spin_unlock(&c->cs_lock);
>>>> +}
>>>> +
>>>> +/**
>>>> + * ubifs_write_master - write master node.
>>>> + * @c: UBIFS file-system description object
>>>> + *
>>>> + * This function writes the master node. Returns zero in case of
>>>> +success and a
>>>> + * negative error code in case of failure. The master node is
>>>> +written twice to
>>>> + * enable recovery.
>>>> + */
>>>> +int ubifs_write_master(struct ubifs_info *c) {
>>>> +   int err, lnum, offs, len;
>>>> +
>>>> +   ubifs_assert(!c->ro_media && !c->ro_mount);
>>>> +   if (c->ro_error)
>>>> +           return -EROFS;
>>>> +
>>>> +   lnum = UBIFS_MST_LNUM;
>>>> +   offs = c->mst_offs + c->mst_node_alsz;
>>>> +   len = UBIFS_MST_NODE_SZ;
>>>> +
>>>> +   if (offs + UBIFS_MST_NODE_SZ > c->leb_size) {
>>>> +           err = ubifs_leb_unmap(c, lnum);
>>>> +           if (err)
>>>> +                   return err;
>>>> +           offs = 0;
>>>> +   }
>>>> +
>>>> +   c->mst_offs = offs;
>>>> +   c->mst_node->highest_inum = cpu_to_le64(c->highest_inum);
>>>> +
>>>> +   err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
>>>> +   if (err)
>>>> +           return err;
>>>> +
>>>> +   lnum += 1;
>>>> +
>>>> +   if (offs == 0) {
>>>> +           err = ubifs_leb_unmap(c, lnum);
>>>> +           if (err)
>>>> +                   return err;
>>>> +   }
>>>> +   err = ubifs_write_node(c, c->mst_node, len, lnum, offs);
>>>> +
>>>> +   return err;
>>>> +}
>>>> +
>>>> +/**
>>>> + * ubifs_request_bg_commit - notify the background thread to do a
>>> commit.
>>>> + * @c: UBIFS file-system description object
>>>> + *
>>>> + * This function is called if the journal is full enough to make a
>>>> +commit
>>>> + * worthwhile, so background thread is kicked to start it.
>>>> + */
>>>> +void ubifs_request_bg_commit(struct ubifs_info *c) {
>>>> +   spin_lock(&c->cs_lock);
>>>> +   if (c->cmt_state == COMMIT_RESTING) {
>>>> +           dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state),
>>>> +                   dbg_cstate(COMMIT_BACKGROUND));
>>>> +           c->cmt_state = COMMIT_BACKGROUND;
>>>> +           spin_unlock(&c->cs_lock);
>>>> +           ubifs_wake_up_bgt(c);
>>>> +   } else
>>>> +           spin_unlock(&c->cs_lock); }
>>>> +
>>>> +
>>>> diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index
>>>> 2df9130..61b2cc8 100644
>>>> --- a/fs/ubifs/lpt_commit.c
>>>> +++ b/fs/ubifs/lpt_commit.c
>>>> @@ -2039,4 +2039,25 @@ static int dbg_populate_lsave(struct
>>>> ubifs_info
>>>> *c)
>>>>
>>>>      return 1;
>>>>    }
>>>> +#else
>>>> +
>>>> +int dbg_chk_lpt_free_spc(struct ubifs_info *c) {
>>>> +   return 0;
>>>> +}
>>>> +
>>>> +int dbg_check_ltab(struct ubifs_info *c) {
>>>> +   return 0;
>>>> +}
>>>> +
>>>> +int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) {
>>>> +   return 0;
>>>> +}
>>>> +
>>>> +void ubifs_dump_lpt_lebs(const struct ubifs_info *c) { }
>>>> +
>>>>    #endif
>>>>
>>>
>>> --
>>> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>>> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>>>
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
@ 2016-09-21 20:05 Travis Waters
  2016-09-26  4:38 ` Heiko Schocher
  0 siblings, 1 reply; 11+ messages in thread
From: Travis Waters @ 2016-09-21 20:05 UTC (permalink / raw)
  To: u-boot

Hello,

I am working to enable UBIFS for use on the sparc platform and I am running
into the same linking trouble flagged in this thread:

uboot/fs/ubifs/lpt_commit.c:1232: undefined reference to
`dbg_chk_lpt_free_spc'
uboot/fs/ubifs/lpt_commit.c:1235: undefined reference to `dbg_check_ltab'
fs/built-in.o: In function `layout_cnodes':
uboot/fs/ubifs/lpt_commit.c:195: undefined reference to `dbg_chk_lpt_sz'
uboot/fs/ubifs/lpt_commit.c:211: undefined reference to `dbg_chk_lpt_sz'
uboot/fs/ubifs/lpt_commit.c:219: undefined reference to `dbg_chk_lpt_sz'
uboot/fs/ubifs/lpt_commit.c:233: undefined reference to `dbg_chk_lpt_sz'
uboot/fs/ubifs/lpt_commit.c:246: undefined reference to `dbg_chk_lpt_sz'
fs/built-in.o:uboot/fs/ubifs/lpt_commit.c:254: more undefined references to
`dbg_chk_lpt_sz' follow
fs/built-in.o: In function `layout_cnodes':
uboot/fs/ubifs/lpt_commit.c:322: undefined reference to
`ubifs_dump_lpt_lebs'
fs/built-in.o: In function `ubifs_add_bud_to_log':
uboot/fs/ubifs/log.c:194: undefined reference to `ubifs_commit_required'
uboot/fs/ubifs/log.c:225: undefined reference to `ubifs_request_bg_commit'
uboot/fs/ubifs/log.c:265: undefined reference to `ubifs_write_node'
fs/built-in.o: In function `ubifs_log_end_commit':
uboot/fs/ubifs/log.c:479: undefined reference to `ubifs_write_master'
fs/built-in.o: In function `do_write_orph_node':
uboot/fs/ubifs/orphan.c:248: undefined reference to `ubifs_write_node'


What is the status of the patch that was addressing this?

Thanks!
-Travis

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-09-21 20:05 Travis Waters
@ 2016-09-26  4:38 ` Heiko Schocher
  2016-09-26  4:43   ` Travis Waters
  0 siblings, 1 reply; 11+ messages in thread
From: Heiko Schocher @ 2016-09-26  4:38 UTC (permalink / raw)
  To: u-boot

Hello Travis,

Am 21.09.2016 um 22:05 schrieb Travis Waters:
> Hello,
>
> I am working to enable UBIFS for use on the sparc platform and I am running
> into the same linking trouble flagged in this thread:
>
> uboot/fs/ubifs/lpt_commit.c:1232: undefined reference to
> `dbg_chk_lpt_free_spc'
> uboot/fs/ubifs/lpt_commit.c:1235: undefined reference to `dbg_check_ltab'
> fs/built-in.o: In function `layout_cnodes':
> uboot/fs/ubifs/lpt_commit.c:195: undefined reference to `dbg_chk_lpt_sz'
> uboot/fs/ubifs/lpt_commit.c:211: undefined reference to `dbg_chk_lpt_sz'
> uboot/fs/ubifs/lpt_commit.c:219: undefined reference to `dbg_chk_lpt_sz'
> uboot/fs/ubifs/lpt_commit.c:233: undefined reference to `dbg_chk_lpt_sz'
> uboot/fs/ubifs/lpt_commit.c:246: undefined reference to `dbg_chk_lpt_sz'
> fs/built-in.o:uboot/fs/ubifs/lpt_commit.c:254: more undefined references to
> `dbg_chk_lpt_sz' follow
> fs/built-in.o: In function `layout_cnodes':
> uboot/fs/ubifs/lpt_commit.c:322: undefined reference to
> `ubifs_dump_lpt_lebs'
> fs/built-in.o: In function `ubifs_add_bud_to_log':
> uboot/fs/ubifs/log.c:194: undefined reference to `ubifs_commit_required'
> uboot/fs/ubifs/log.c:225: undefined reference to `ubifs_request_bg_commit'
> uboot/fs/ubifs/log.c:265: undefined reference to `ubifs_write_node'
> fs/built-in.o: In function `ubifs_log_end_commit':
> uboot/fs/ubifs/log.c:479: undefined reference to `ubifs_write_master'
> fs/built-in.o: In function `do_write_orph_node':
> uboot/fs/ubifs/orphan.c:248: undefined reference to `ubifs_write_node'
>
>
> What is the status of the patch that was addressing this?

Hmm... my last message to Marco (added to Cc) was, to split the patch
into 2 pieces (one for the sparc fixes and one for the ubifs fixes)

IIRC I saw a fix for the sparc errors, but none for ubifs ...

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-09-26  4:38 ` Heiko Schocher
@ 2016-09-26  4:43   ` Travis Waters
  2016-09-26  4:52     ` Heiko Schocher
  0 siblings, 1 reply; 11+ messages in thread
From: Travis Waters @ 2016-09-26  4:43 UTC (permalink / raw)
  To: u-boot

Thanks for the response. I went ahead and used the current patch as-is,
which allowed me to build.  I haven't yet verified whether the result  is
functional, though.  (We are probably a couple weeks out from having our
FLASH driver in place).  I'll let you know what we find.
-Travis

On Sep 25, 2016 10:38 PM, "Heiko Schocher" <hs@denx.de> wrote:

> Hello Travis,
>
> Am 21.09.2016 um 22:05 schrieb Travis Waters:
>
>> Hello,
>>
>> I am working to enable UBIFS for use on the sparc platform and I am
>> running
>> into the same linking trouble flagged in this thread:
>>
>> uboot/fs/ubifs/lpt_commit.c:1232: undefined reference to
>> `dbg_chk_lpt_free_spc'
>> uboot/fs/ubifs/lpt_commit.c:1235: undefined reference to `dbg_check_ltab'
>> fs/built-in.o: In function `layout_cnodes':
>> uboot/fs/ubifs/lpt_commit.c:195: undefined reference to `dbg_chk_lpt_sz'
>> uboot/fs/ubifs/lpt_commit.c:211: undefined reference to `dbg_chk_lpt_sz'
>> uboot/fs/ubifs/lpt_commit.c:219: undefined reference to `dbg_chk_lpt_sz'
>> uboot/fs/ubifs/lpt_commit.c:233: undefined reference to `dbg_chk_lpt_sz'
>> uboot/fs/ubifs/lpt_commit.c:246: undefined reference to `dbg_chk_lpt_sz'
>> fs/built-in.o:uboot/fs/ubifs/lpt_commit.c:254: more undefined references
>> to
>> `dbg_chk_lpt_sz' follow
>> fs/built-in.o: In function `layout_cnodes':
>> uboot/fs/ubifs/lpt_commit.c:322: undefined reference to
>> `ubifs_dump_lpt_lebs'
>> fs/built-in.o: In function `ubifs_add_bud_to_log':
>> uboot/fs/ubifs/log.c:194: undefined reference to `ubifs_commit_required'
>> uboot/fs/ubifs/log.c:225: undefined reference to `ubifs_request_bg_commit'
>> uboot/fs/ubifs/log.c:265: undefined reference to `ubifs_write_node'
>> fs/built-in.o: In function `ubifs_log_end_commit':
>> uboot/fs/ubifs/log.c:479: undefined reference to `ubifs_write_master'
>> fs/built-in.o: In function `do_write_orph_node':
>> uboot/fs/ubifs/orphan.c:248: undefined reference to `ubifs_write_node'
>>
>>
>> What is the status of the patch that was addressing this?
>>
>
> Hmm... my last message to Marco (added to Cc) was, to split the patch
> into 2 pieces (one for the sparc fixes and one for the ubifs fixes)
>
> IIRC I saw a fix for the sparc errors, but none for ubifs ...
>
> bye,
> Heiko
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-09-26  4:43   ` Travis Waters
@ 2016-09-26  4:52     ` Heiko Schocher
  2016-09-26 13:28       ` Hoefle Marco
  0 siblings, 1 reply; 11+ messages in thread
From: Heiko Schocher @ 2016-09-26  4:52 UTC (permalink / raw)
  To: u-boot

Hello Travis,

Am 26.09.2016 um 06:43 schrieb Travis Waters:
> Thanks for the response. I went ahead and used the current patch as-is, which allowed me to build.
> I haven't yet verified whether the result  is functional, though.  (We are probably a couple weeks
> out from having our FLASH driver in place).  I'll let you know what we find.

Ok, thanks! A patch would be nice ;-)

bye,
Heiko
> -Travis
>
>
> On Sep 25, 2016 10:38 PM, "Heiko Schocher" <hs at denx.de <mailto:hs@denx.de>> wrote:
>
>     Hello Travis,
>
>     Am 21.09.2016 um 22:05 schrieb Travis Waters:
>
>         Hello,
>
>         I am working to enable UBIFS for use on the sparc platform and I am running
>         into the same linking trouble flagged in this thread:
>
>         uboot/fs/ubifs/lpt_commit.c:1232: undefined reference to
>         `dbg_chk_lpt_free_spc'
>         uboot/fs/ubifs/lpt_commit.c:1235: undefined reference to `dbg_check_ltab'
>         fs/built-in.o: In function `layout_cnodes':
>         uboot/fs/ubifs/lpt_commit.c:195: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:211: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:219: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:233: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:246: undefined reference to `dbg_chk_lpt_sz'
>         fs/built-in.o:uboot/fs/ubifs/lpt_commit.c:254: more undefined references to
>         `dbg_chk_lpt_sz' follow
>         fs/built-in.o: In function `layout_cnodes':
>         uboot/fs/ubifs/lpt_commit.c:322: undefined reference to
>         `ubifs_dump_lpt_lebs'
>         fs/built-in.o: In function `ubifs_add_bud_to_log':
>         uboot/fs/ubifs/log.c:194: undefined reference to `ubifs_commit_required'
>         uboot/fs/ubifs/log.c:225: undefined reference to `ubifs_request_bg_commit'
>         uboot/fs/ubifs/log.c:265: undefined reference to `ubifs_write_node'
>         fs/built-in.o: In function `ubifs_log_end_commit':
>         uboot/fs/ubifs/log.c:479: undefined reference to `ubifs_write_master'
>         fs/built-in.o: In function `do_write_orph_node':
>         uboot/fs/ubifs/orphan.c:248: undefined reference to `ubifs_write_node'
>
>
>         What is the status of the patch that was addressing this?
>
>
>     Hmm... my last message to Marco (added to Cc) was, to split the patch
>     into 2 pieces (one for the sparc fixes and one for the ubifs fixes)
>
>     IIRC I saw a fix for the sparc errors, but none for ubifs ...
>
>     bye,
>     Heiko
>     --
>     DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [PATCH] getting ubifs to run
  2016-09-26  4:52     ` Heiko Schocher
@ 2016-09-26 13:28       ` Hoefle Marco
  0 siblings, 0 replies; 11+ messages in thread
From: Hoefle Marco @ 2016-09-26 13:28 UTC (permalink / raw)
  To: u-boot

Hello Heiko and Travis,
our IT blocked the SMTP Server for relaying internally -> git send-email is not working anymore.
We have to use Outlook and mails get often rejected by mailing lists due to additional stuff Outlook appends.
So currently I can not send patches via git send-email.

Sorry,
Marco





________________________________________
Von: Heiko Schocher <hs@denx.de>
Gesendet: Montag, 26. September 2016 06:52
An: Travis Waters
Cc: Hoefle Marco; u-boot at lists.denx.de
Betreff: Re: [U-Boot] [PATCH] getting ubifs to run

Hello Travis,

Am 26.09.2016 um 06:43 schrieb Travis Waters:
> Thanks for the response. I went ahead and used the current patch as-is, which allowed me to build.
> I haven't yet verified whether the result  is functional, though.  (We are probably a couple weeks
> out from having our FLASH driver in place).  I'll let you know what we find.

Ok, thanks! A patch would be nice ;-)

bye,
Heiko
> -Travis
>
>
> On Sep 25, 2016 10:38 PM, "Heiko Schocher" <hs at denx.de <mailto:hs@denx.de>> wrote:
>
>     Hello Travis,
>
>     Am 21.09.2016 um 22:05 schrieb Travis Waters:
>
>         Hello,
>
>         I am working to enable UBIFS for use on the sparc platform and I am running
>         into the same linking trouble flagged in this thread:
>
>         uboot/fs/ubifs/lpt_commit.c:1232: undefined reference to
>         `dbg_chk_lpt_free_spc'
>         uboot/fs/ubifs/lpt_commit.c:1235: undefined reference to `dbg_check_ltab'
>         fs/built-in.o: In function `layout_cnodes':
>         uboot/fs/ubifs/lpt_commit.c:195: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:211: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:219: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:233: undefined reference to `dbg_chk_lpt_sz'
>         uboot/fs/ubifs/lpt_commit.c:246: undefined reference to `dbg_chk_lpt_sz'
>         fs/built-in.o:uboot/fs/ubifs/lpt_commit.c:254: more undefined references to
>         `dbg_chk_lpt_sz' follow
>         fs/built-in.o: In function `layout_cnodes':
>         uboot/fs/ubifs/lpt_commit.c:322: undefined reference to
>         `ubifs_dump_lpt_lebs'
>         fs/built-in.o: In function `ubifs_add_bud_to_log':
>         uboot/fs/ubifs/log.c:194: undefined reference to `ubifs_commit_required'
>         uboot/fs/ubifs/log.c:225: undefined reference to `ubifs_request_bg_commit'
>         uboot/fs/ubifs/log.c:265: undefined reference to `ubifs_write_node'
>         fs/built-in.o: In function `ubifs_log_end_commit':
>         uboot/fs/ubifs/log.c:479: undefined reference to `ubifs_write_master'
>         fs/built-in.o: In function `do_write_orph_node':
>         uboot/fs/ubifs/orphan.c:248: undefined reference to `ubifs_write_node'
>
>
>         What is the status of the patch that was addressing this?
>
>
>     Hmm... my last message to Marco (added to Cc) was, to split the patch
>     into 2 pieces (one for the sparc fixes and one for the ubifs fixes)
>
>     IIRC I saw a fix for the sparc errors, but none for ubifs ...
>
>     bye,
>     Heiko
>     --
>     DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
>     HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
>

--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-09-26 13:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-11  9:56 [U-Boot] [PATCH] getting ubifs to run Marco
2016-08-12  5:05 ` Heiko Schocher
2016-08-12  7:24   ` Hoefle Marco
2016-08-15 11:55     ` [U-Boot] WG: " Hoefle Marco
2016-09-01 12:45       ` [U-Boot] " Hoefle Marco
2016-09-02  7:57         ` Heiko Schocher
  -- strict thread matches above, loose matches on Subject: below --
2016-09-21 20:05 Travis Waters
2016-09-26  4:38 ` Heiko Schocher
2016-09-26  4:43   ` Travis Waters
2016-09-26  4:52     ` Heiko Schocher
2016-09-26 13:28       ` Hoefle Marco

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox