From aef04a8aa1164bf2605db102fa051a34f646c0a1 Mon Sep 17 00:00:00 2001 From: Matteo Ghidoni Date: Thu, 29 Oct 2020 13:48:01 +0100 Subject: km: replace hardcoded address for imported environment Instead of using an hard coded address, make use of an already defined address for importing the environment for ramfs and nfs boot. This allows boards having different mapping to use the same code. CC: Heiko Schocher CC: Tom Rini Signed-off-by: Matteo Ghidoni Signed-off-by: Holger Brunck --- include/configs/km/keymile-common.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h index c1968048a7d..851b13e063d 100644 --- a/include/configs/km/keymile-common.h +++ b/include/configs/km/keymile-common.h @@ -90,12 +90,12 @@ "set_fdthigh cramfsloadkernel flashargs add_default " \ "addpanic boot\0" \ "develop=" \ - "tftp 200000 scripts/develop-${arch}.txt && " \ - "env import -t 200000 ${filesize} && " \ + "tftp ${load_addr_r} scripts/develop-${arch}.txt && " \ + "env import -t ${load_addr_r} ${filesize} && " \ "run setup_debug_env\0" \ "ramfs=" \ - "tftp 200000 scripts/ramfs-${arch}.txt && " \ - "env import -t 200000 ${filesize} && " \ + "tftp ${load_addr_r} scripts/ramfs-${arch}.txt && " \ + "env import -t ${load_addr_r} ${filesize} && " \ "run setup_debug_env\0" \ "" -- cgit v1.3.1 From c904a0b762aedccf603ce492687450efb0e8924c Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Thu, 29 Oct 2020 13:54:54 +0100 Subject: km/ppc: use Kconfig for MEMTEST configuration Also change back SYS_MEMTEST_END to 0x00f00000. 0xe00000 was wrong and introduced due to the global Kconfig migration of this option in u-boot. CC: Heiko Schocher CC: Tom Rini Signed-off-by: Holger Brunck --- board/keymile/km83xx/Kconfig | 6 ++++++ board/keymile/km83xx/km83xx.c | 8 ++------ include/configs/kmcoge5ne.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/board/keymile/km83xx/Kconfig b/board/keymile/km83xx/Kconfig index bbafabdcb2c..8247ae39d32 100644 --- a/board/keymile/km83xx/Kconfig +++ b/board/keymile/km83xx/Kconfig @@ -15,6 +15,12 @@ config KM_ENABLE_FULL_DM_DTS_SUPPORT select PHYLIB endmenu +config SYS_MEMTEST_START + default 0x00100000 + +config SYS_MEMTEST_END + default 0x00f00000 + if TARGET_KMETER1 config SYS_BOARD diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c index 9eb000cca4d..a984165e241 100644 --- a/board/keymile/km83xx/km83xx.c +++ b/board/keymile/km83xx/km83xx.c @@ -236,12 +236,8 @@ void post_word_store(ulong value) int arch_memory_test_prepare(u32 *vstart, u32 *size, phys_addr_t *phys_offset) { - /* - * These match CONFIG_SYS_MEMTEST_START and - * (CONFIG_SYS_MEMTEST_END - CONFIG_SYS_MEMTEST_START) - */ - *vstart = 0x00100000; - *size = 0xe00000; + *vstart = CONFIG_SYS_MEMTEST_START; + *size = CONFIG_SYS_MEMTEST_END - CONFIG_SYS_MEMTEST_START; debug("arch_memory_test_prepare 0x%08X 0x%08X\n", *vstart, *size); return 0; diff --git a/include/configs/kmcoge5ne.h b/include/configs/kmcoge5ne.h index 4d01f236c31..cdfb280aeee 100644 --- a/include/configs/kmcoge5ne.h +++ b/include/configs/kmcoge5ne.h @@ -51,7 +51,7 @@ /* enable POST tests */ #define CONFIG_POST (CONFIG_SYS_POST_MEMORY|CONFIG_SYS_POST_MEM_REGIONS) #define CONFIG_POST_EXTERNAL_WORD_FUNCS /* use own functions, not generic */ -#define CPM_POST_WORD_ADDR 0x00f00000 +#define CPM_POST_WORD_ADDR CONFIG_SYS_MEMTEST_END #define CONFIG_TESTPIN_REG gprt3 /* for kmcoge5ne */ #define CONFIG_TESTPIN_MASK 0x20 /* for kmcoge5ne */ -- cgit v1.3.1 From dd4866b43754b18f0c06672e341d93e16b8bf674 Mon Sep 17 00:00:00 2001 From: Richard Genoud Date: Tue, 3 Nov 2020 12:11:26 +0100 Subject: fs/squashfs: implement exists() function This permits to find a file and use the distro_bootcmd Reviewed-by: Joao Marcos Costa Signed-off-by: Richard Genoud --- fs/fs.c | 2 +- fs/squashfs/sqfs.c | 38 ++++++++++++++++++++++++++++++++++++++ include/squashfs.h | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/fs/fs.c b/fs/fs.c index fb27c910d4f..7a4020607a3 100644 --- a/fs/fs.c +++ b/fs/fs.c @@ -296,7 +296,7 @@ static struct fstype_info fstypes[] = { .size = sqfs_size, .close = sqfs_close, .closedir = sqfs_closedir, - .exists = fs_exists_unsupported, + .exists = sqfs_exists, .uuid = fs_uuid_unsupported, .write = fs_write_unsupported, .ln = fs_ln_unsupported, diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c index 80a85e76e8a..608a2bb454c 100644 --- a/fs/squashfs/sqfs.c +++ b/fs/squashfs/sqfs.c @@ -1649,6 +1649,44 @@ free_strings: return ret; } +int sqfs_exists(const char *filename) +{ + struct fs_dir_stream *dirsp = NULL; + struct squashfs_dir_stream *dirs; + char *dir, *file; + struct fs_dirent *dent; + int ret; + + sqfs_split_path(&file, &dir, filename); + /* + * sqfs_opendir will uncompress inode and directory tables, and will + * return a pointer to the directory that contains the requested file. + */ + ret = sqfs_opendir(dir, &dirsp); + if (ret) { + ret = -EINVAL; + goto free_strings; + } + + dirs = (struct squashfs_dir_stream *)dirsp; + + while (!sqfs_readdir(dirsp, &dent)) { + ret = strcmp(dent->name, file); + if (!ret) + break; + free(dirs->entry); + dirs->entry = NULL; + } + + sqfs_closedir(dirsp); + +free_strings: + free(dir); + free(file); + + return ret == 0; +} + void sqfs_close(void) { free(ctxt.sblk); diff --git a/include/squashfs.h b/include/squashfs.h index 819cf8c2da8..7489eefa1f2 100644 --- a/include/squashfs.h +++ b/include/squashfs.h @@ -19,6 +19,7 @@ int sqfs_probe(struct blk_desc *fs_dev_desc, int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len, loff_t *actread); int sqfs_size(const char *filename, loff_t *size); +int sqfs_exists(const char *filename); void sqfs_close(void); void sqfs_closedir(struct fs_dir_stream *dirs); -- cgit v1.3.1