diff --git a/arch/ppc/boards/geip-da923rc/env/bin/init b/arch/ppc/boards/geip-da923rc/env/bin/init index 6308999..330a435 100644 --- a/arch/ppc/boards/geip-da923rc/env/bin/init +++ b/arch/ppc/boards/geip-da923rc/env/bin/init @@ -2,3 +2,15 @@ export PATH=/env/bin source /env/config + +#Define a 26MB partition in flash starting at offset 0x20000 +addpart -n /dev/nor0 0x1a00000@0x20000(boot) +ubiattach /dev/boot + +if [ $? -ne 0 ]; then + echo "Fail to attach UBI device" + exit 1; +fi + +mkdir /mnt +mount -t ubifs /dev/ubi0.boot /mnt diff --git a/arch/ppc/configs/da923rc_defconfig b/arch/ppc/configs/da923rc_defconfig index a9dc0df..da1b13a 100644 --- a/arch/ppc/configs/da923rc_defconfig +++ b/arch/ppc/configs/da923rc_defconfig @@ -42,6 +42,12 @@ CONFIG_CFI_BUFFER_WRITE=y CONFIG_MTD=y CONFIG_MTD_WRITE=y +CONFIG_MTD_UBI=y +CONFIG_CMD_UBI=y +CONFIG_FS_UBIFS=y +CONFIG_FS_UBIFS_COMPRESSION_LZO=y +CONFIG_CMD_UNLZO=y +CONFIG_LZO_DECOMPRESS=y CONFIG_MALLOC_SIZE=0x2800000 CONFIG_PROMPT="GE> " CONFIG_BAUDRATE=9600 diff --git a/arch/ppc/cpu-85xx/tlb.c b/arch/ppc/cpu-85xx/tlb.c index 3f56655..3c70572 100644 --- a/arch/ppc/cpu-85xx/tlb.c +++ b/arch/ppc/cpu-85xx/tlb.c @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include void e500_invalidate_tlb(u8 tlb) diff --git a/arch/ppc/include/asm/bitops.h b/arch/ppc/include/asm/bitops.h index 3b31d54..eea9e0c 100644 --- a/arch/ppc/include/asm/bitops.h +++ b/arch/ppc/include/asm/bitops.h @@ -6,13 +6,7 @@ #define _PPC_BITOPS_H #include - -extern void set_bit(int nr, volatile void *addr); -extern void clear_bit(int nr, volatile void *addr); -extern void change_bit(int nr, volatile void *addr); -extern int test_and_set_bit(int nr, volatile void *addr); -extern int test_and_clear_bit(int nr, volatile void *addr); -extern int test_and_change_bit(int nr, volatile void *addr); +#include /* * Arguably these bit operations don't imply any memory barrier or @@ -143,13 +137,6 @@ } #endif /* __INLINE_BITOPS */ -extern __inline__ int test_bit(int nr, __const__ volatile void *addr) -{ - __const__ unsigned int *p = (__const__ unsigned int *) addr; - - return ((p[nr >> 5] >> (nr & 0x1f)) & 1) != 0; -} - /* Return the bit position of the most significant 1 bit in a word */ extern __inline__ int __ilog2(unsigned int x) { @@ -178,36 +165,6 @@ return 32 - lz; } -/* - * fls64 - find last set bit in a 64-bit word - * @x: the word to search - * - * This is defined in a similar way as the libc and compiler builtin - * ffsll, but returns the position of the most significant set bit. - * - * fls64(value) returns 0 if value is 0 or the position of the last - * set bit if value is nonzero. The last (most significant) bit is - * at position 64. - */ - -static inline int fls64(__u64 x) -{ - __u32 h = x >> 32; - if (h) - return fls(h) + 32; - return fls(x); -} - -static inline int __ilog2_u64(u64 n) -{ - return fls64(n) - 1; -} - -static inline int ffs64(u64 x) -{ - return __ilog2_u64(x & -x) + 1ull; -} - #ifdef __KERNEL__ /* @@ -220,6 +177,7 @@ return __ilog2(x & -x) + 1; } +#include #include #endif /* __KERNEL__ */ diff --git a/arch/ppc/mach-mpc85xx/fsl_law.c b/arch/ppc/mach-mpc85xx/fsl_law.c index 34c039d..38902e3 100644 --- a/arch/ppc/mach-mpc85xx/fsl_law.c +++ b/arch/ppc/mach-mpc85xx/fsl_law.c @@ -24,6 +24,7 @@ #include #include #include +#include #define FSL_HW_NUM_LAWS FSL_NUM_LAWS diff --git a/arch/ppc/mach-mpc85xx/include/mach/ffs64.h b/arch/ppc/mach-mpc85xx/include/mach/ffs64.h new file mode 100644 index 0000000..045498c --- /dev/null +++ b/arch/ppc/mach-mpc85xx/include/mach/ffs64.h @@ -0,0 +1,20 @@ +/* + * Copyright 2013 GE Intelligent Platforms, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include + +static inline int ffs64(u64 x) +{ + return __ilog2_u64(x & -x) + 1ull; +} diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 62617b6..dbc7f18 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h @@ -85,7 +85,7 @@ #define ubifs_assert(expr) do { \ if (unlikely(!(expr))) { \ - printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ + pr_crit("UBIFS assert failed in %s at %u (pid %d)\n", \ __func__, __LINE__, 0); \ dbg_dump_stack(); \ } \ @@ -94,7 +94,7 @@ #define ubifs_assert_cmt_locked(c) do { \ if (unlikely(down_write_trylock(&(c)->commit_sem))) { \ up_write(&(c)->commit_sem); \ - printk(KERN_CRIT "commit lock is not locked!\n"); \ + pr_crit("commit lock is not locked!\n"); \ ubifs_assert(0); \ } \ } while (0) @@ -107,7 +107,7 @@ /* Generic debugging messages */ #define dbg_msg(fmt, ...) do { \ spin_lock(&dbg_lock); \ - printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", 0, \ + pr_debug("UBIFS DBG (pid %d): %s: " fmt "\n", 0, \ __func__, ##__VA_ARGS__); \ spin_unlock(&dbg_lock); \ } while (0) @@ -310,7 +310,7 @@ /* Use "if (0)" to make compiler check arguments even if debugging is off */ #define ubifs_assert(expr) do { \ if (0 && (expr)) \ - printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ + pr_crit("UBIFS assert failed in %s at %u (pid %d)\n", \ __func__, __LINE__, 0); \ } while (0) @@ -321,7 +321,7 @@ #define dbg_msg(fmt, ...) do { \ if (0) \ - printk(KERN_DEBUG "UBIFS DBG (pid %d): %s: " fmt "\n", \ + pr_debug("UBIFS DBG (pid %d): %s: " fmt "\n", \ 0, __func__, ##__VA_ARGS__); \ } while (0) diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index dfa6107..e2f9593 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -24,6 +24,7 @@ */ #include +#include #include #include #include @@ -549,6 +550,42 @@ return 0; } +static char *ubifs_symlink(struct inode *inode) +{ + struct ubifs_inode *ui; + char *symlink; + + ui = ubifs_inode(inode); + symlink = malloc(ui->data_len + 1); + + memcpy(symlink, ui->data, ui->data_len); + symlink[ui->data_len] = '\0'; + + return symlink; +} + +static int ubifs_readlink(struct device_d *dev, const char *pathname, char *buf, + size_t bufsz) +{ + struct ubifs_priv *priv = dev->priv; + struct inode *inode; + char *symlink; + int len; + + inode = ubifs_findfile(priv->sb, pathname); + + if (!inode) + return -ENOENT; + + symlink = ubifs_symlink(inode); + + len = min(bufsz, strlen(symlink)); + memcpy(buf, symlink, len); + free(symlink); + + return 0; +} + static int ubifs_probe(struct device_d *dev) { struct fs_device_d *fsdev = dev_to_fs_device(dev); @@ -609,6 +646,7 @@ .readdir = ubifs_readdir, .closedir = ubifs_closedir, .stat = ubifs_stat, + .readlink = ubifs_readlink, .type = filetype_ubifs, .flags = 0, .drv = { diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 1e6c0f5..fea1584 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h @@ -474,15 +474,15 @@ #define ubifs_msg(fmt, ...) #else #define ubifs_msg(fmt, ...) \ - printk(KERN_NOTICE "UBIFS: " fmt "\n", ##__VA_ARGS__) + pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__) #endif /* UBIFS error messages */ #define ubifs_err(fmt, ...) \ - printk(KERN_ERR "UBIFS error (pid %d): %s: " fmt "\n", 0, \ + pr_err("UBIFS error (pid %d): %s: " fmt "\n", 0, \ __func__, ##__VA_ARGS__) /* UBIFS warning messages */ #define ubifs_warn(fmt, ...) \ - printk(KERN_WARNING "UBIFS warning (pid %d): %s: " fmt "\n", \ + pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \ 0, __func__, ##__VA_ARGS__) /* UBIFS file system VFS magic number */