* [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command
@ 2012-03-13 9:57 Maximilian Schwerin
2012-03-13 9:57 ` [U-Boot] [PATCH 2/2] Add support for loading and saving the environment to a FAT partition Maximilian Schwerin
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Maximilian Schwerin @ 2012-03-13 9:57 UTC (permalink / raw)
To: u-boot
From: Donggeun Kim <dg77.kim at>
Once CONFIG_FAT_WRITE is defined,
users can invoke 'fatwrite' command that saves data in RAM as a FAT file.
This patch also removes compile error after patch of
'fs/fat: Fix FAT detection to support non-DOS partition tables'.
Signed-off-by: Donggeun Kim <dg77.kim <at> samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park <at> samsung.com>
---
common/cmd_fat.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
fs/fat/fat_write.c | 20 +++++++-----------
2 files changed, 65 insertions(+), 12 deletions(-)
diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index 0220494..fef1c82 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -184,3 +184,60 @@ U_BOOT_CMD(
"<interface> <dev[:part]>\n"
" - print information about filesystem from 'dev' on 'interface'"
);
+
+#ifdef CONFIG_FAT_WRITE
+static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
+ int argc, char * const argv[])
+{
+ long size;
+ unsigned long addr;
+ unsigned long count;
+ block_dev_desc_t *dev_desc = NULL;
+ int dev = 0;
+ int part = 1;
+ char *ep;
+
+ if (argc < 5)
+ return cmd_usage(cmdtp);
+
+ dev = (int)simple_strtoul(argv[2], &ep, 16);
+ dev_desc = get_dev(argv[1], dev);
+ if (dev_desc == NULL) {
+ puts("\n** Invalid boot device **\n");
+ return 1;
+ }
+ if (*ep) {
+ if (*ep != ':') {
+ puts("\n** Invalid boot device, use `dev[:part]' **\n");
+ return 1;
+ }
+ part = (int)simple_strtoul(++ep, NULL, 16);
+ }
+ if (fat_register_device(dev_desc, part) != 0) {
+ printf("\n** Unable to use %s %d:%d for fatwrite **\n",
+ argv[1], dev, part);
+ return 1;
+ }
+ addr = simple_strtoul(argv[3], NULL, 16);
+ count = simple_strtoul(argv[5], NULL, 16);
+
+ size = file_fat_write(argv[4], (void *)addr, count);
+ if (size == -1) {
+ printf("\n** Unable to write \"%s\" from %s %d:%d **\n",
+ argv[4], argv[1], dev, part);
+ return 1;
+ }
+
+ printf("%ld bytes write\n", size);
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ fatwrite, 6, 0, do_fat_fswrite,
+ "write file into a dos filesystem",
+ "<interface> <dev[:part]> <addr> <filename> <bytes>\n"
+ " - write file 'filename' from the address 'addr' in RAM\n"
+ " to 'dev' on 'interface'"
+);
+#endif
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 3bfc1c4..16f8400 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -41,23 +41,19 @@ static void uppercase(char *str, int len)
}
static int total_sector;
-static int disk_write(__u32 startblock, __u32 getsize, __u8 *bufptr)
+static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
{
- if (cur_dev == NULL)
+ if (!cur_dev || !cur_dev->block_write)
return -1;
- if (startblock + getsize > total_sector) {
+ if (cur_part_info.start + block + nr_blocks >
+ cur_part_info.start + total_sector) {
printf("error: overflow occurs\n");
return -1;
}
- startblock += part_offset;
-
- if (cur_dev->block_read) {
- return cur_dev->block_write(cur_dev->dev, startblock, getsize,
- (unsigned long *) bufptr);
- }
- return -1;
+ return cur_dev->block_write(cur_dev->dev,
+ cur_part_info.start + block, nr_blocks, buf);
}
/*
@@ -797,7 +793,7 @@ static int check_overflow(fsdata *mydata, __u32 clustnum, unsigned long size)
if (size % mydata->sect_size)
sect_num++;
- if (startsect + sect_num > total_sector)
+ if (startsect + sect_num > cur_part_info.start + total_sector)
return -1;
return 0;
@@ -947,7 +943,7 @@ static int do_fat_write(const char *filename, void *buffer,
total_sector = bs.total_sect;
if (total_sector == 0)
- total_sector = part_size;
+ total_sector = cur_part_info.size;
root_cluster = bs.root_cluster;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] Add support for loading and saving the environment to a FAT partition
2012-03-13 9:57 [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Maximilian Schwerin
@ 2012-03-13 9:57 ` Maximilian Schwerin
2012-03-30 20:40 ` Wolfgang Denk
2012-03-18 21:04 ` [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Wolfgang Denk
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Maximilian Schwerin @ 2012-03-13 9:57 UTC (permalink / raw)
To: u-boot
The following must be defined:
CONFIG_ENV_IS_IN_FAT
Enable this saving environment to FAT.
FAT_ENV_INTERFACE
Interface the FAT resides on (e.g. mmc).
FAT_ENV_DEVICE
The interface device number (e.g. 0 for mmc0)
FAT_ENV_PART
The device part (e.g. 1 for mmc0:1)
FAT_ENV_FILE
The filename of the environment file.
---
common/Makefile | 1 +
common/cmd_nvedit.c | 3 +-
common/env_fat.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 161 insertions(+), 1 deletions(-)
create mode 100644 common/env_fat.c
diff --git a/common/Makefile b/common/Makefile
index 2a31c62..7fcb108 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -54,6 +54,7 @@ COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_embedded.o
COBJS-$(CONFIG_ENV_IS_IN_FLASH) += env_flash.o
COBJS-$(CONFIG_ENV_IS_IN_MG_DISK) += env_mgdisk.o
COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
+COBJS-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index 22f9821..b1494dc 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -61,13 +61,14 @@ DECLARE_GLOBAL_DATA_PTR;
!defined(CONFIG_ENV_IS_IN_DATAFLASH) && \
!defined(CONFIG_ENV_IS_IN_MG_DISK) && \
!defined(CONFIG_ENV_IS_IN_MMC) && \
+ !defined(CONFIG_ENV_IS_IN_FAT) && \
!defined(CONFIG_ENV_IS_IN_NAND) && \
!defined(CONFIG_ENV_IS_IN_NVRAM) && \
!defined(CONFIG_ENV_IS_IN_ONENAND) && \
!defined(CONFIG_ENV_IS_IN_SPI_FLASH) && \
!defined(CONFIG_ENV_IS_NOWHERE)
# error Define one of CONFIG_ENV_IS_IN_{EEPROM|FLASH|DATAFLASH|ONENAND|\
-SPI_FLASH|MG_DISK|NVRAM|MMC} or CONFIG_ENV_IS_NOWHERE
+SPI_FLASH|MG_DISK|NVRAM|MMC|FAT} or CONFIG_ENV_IS_NOWHERE
#endif
#define XMK_STR(x) #x
diff --git a/common/env_fat.c b/common/env_fat.c
new file mode 100644
index 0000000..a1bba3c
--- /dev/null
+++ b/common/env_fat.c
@@ -0,0 +1,158 @@
+/*
+ * (c) Copyright 2011 by Tigris Elektronik GmbH
+ *
+ * Author:
+ * Maximilian Schwerin <mvs@tigris.de>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/* #define DEBUG */
+
+#include <common.h>
+
+#include <command.h>
+#include <environment.h>
+#include <linux/stddef.h>
+#include <malloc.h>
+#include <search.h>
+#include <errno.h>
+#include <fat.h>
+#include <mmc.h>
+
+char *env_name_spec = "FAT";
+
+env_t *env_ptr;
+
+DECLARE_GLOBAL_DATA_PTR;
+
+uchar env_get_char_spec(int index)
+{
+ return *((uchar *)(gd->env_addr + index));
+}
+
+int env_init(void)
+{
+ /* use default */
+ gd->env_addr = (ulong)&default_environment[0];
+ gd->env_valid = 1;
+
+ return 0;
+}
+
+#ifdef CONFIG_CMD_SAVEENV
+int saveenv(void)
+{
+ env_t env_new;
+ ssize_t len;
+ char *res;
+ block_dev_desc_t *dev_desc = NULL;
+ int dev = FAT_ENV_DEVICE;
+ int part = FAT_ENV_PART;
+
+ res = (char *)&env_new.data;
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE, 0, NULL);
+ if (len < 0) {
+ error("Cannot export environment: errno = %d\n", errno);
+ return 1;
+ }
+
+#ifdef CONFIG_MMC
+ if (strcmp (FAT_ENV_INTERFACE, "mmc") == 0) {
+ struct mmc *mmc = find_mmc_device(dev);
+
+ if (!mmc) {
+ printf("no mmc device@slot %x\n", dev);
+ return 1;
+ }
+
+ mmc->has_init = 0;
+ mmc_init(mmc);
+ }
+#endif /* CONFIG_MMC */
+
+ dev_desc = get_dev(FAT_ENV_INTERFACE, dev);
+ if (dev_desc == NULL) {
+ printf("Failed to find %s%d\n",
+ FAT_ENV_INTERFACE, dev);
+ return 1;
+ }
+ if (fat_register_device(dev_desc, part) != 0) {
+ printf("Failed to register %s%d:%d\n",
+ FAT_ENV_INTERFACE, dev, part);
+ return 1;
+ }
+
+ env_new.crc = crc32(0, env_new.data, ENV_SIZE);
+ if (file_fat_write(FAT_ENV_FILE, (void *)&env_new, sizeof(env_t)) == -1) {
+ printf("\n** Unable to write \"%s\" from %s%d:%d **\n",
+ FAT_ENV_FILE, FAT_ENV_INTERFACE, dev, part);
+ return 1;
+ }
+
+ puts("done\n");
+ return 0;
+}
+#endif /* CONFIG_CMD_SAVEENV */
+
+void env_relocate_spec(void)
+{
+ char buf[CONFIG_ENV_SIZE];
+ block_dev_desc_t *dev_desc = NULL;
+ int dev = FAT_ENV_DEVICE;
+ int part = FAT_ENV_PART;
+
+#ifdef CONFIG_MMC
+ if (strcmp (FAT_ENV_INTERFACE, "mmc") == 0) {
+ struct mmc *mmc = find_mmc_device(dev);
+
+ if (!mmc) {
+ printf("no mmc device at slot %x\n", dev);
+ set_default_env(NULL);
+ return;
+ }
+
+ mmc->has_init = 0;
+ mmc_init(mmc);
+ }
+#endif /* CONFIG_MMC */
+
+ dev_desc = get_dev(FAT_ENV_INTERFACE, dev);
+ if (dev_desc == NULL) {
+ printf("Failed to find %s%d\n",
+ FAT_ENV_INTERFACE, dev);
+ set_default_env(NULL);
+ return;
+ }
+ if (fat_register_device(dev_desc, part) != 0) {
+ printf("Failed to register %s%d:%d\n",
+ FAT_ENV_INTERFACE, dev, part);
+ set_default_env(NULL);
+ return;
+ }
+
+ if (file_fat_read(FAT_ENV_FILE, (unsigned char *)&buf, CONFIG_ENV_SIZE) == -1) {
+ printf("\n** Unable to read \"%s\" from %s%d:%d **\n",
+ FAT_ENV_FILE, FAT_ENV_INTERFACE, dev, part);
+ set_default_env(NULL);
+ return;
+ }
+
+ env_import(buf, 1);
+}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command
2012-03-13 9:57 [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Maximilian Schwerin
2012-03-13 9:57 ` [U-Boot] [PATCH 2/2] Add support for loading and saving the environment to a FAT partition Maximilian Schwerin
@ 2012-03-18 21:04 ` Wolfgang Denk
2012-03-22 14:38 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Maximilian Schwerin
2012-03-22 14:38 ` [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command Maximilian Schwerin
3 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2012-03-18 21:04 UTC (permalink / raw)
To: u-boot
Dear Maximilian,
In message <1331632670-14874-1-git-send-email-mvs@tigris.de> you wrote:
> From: Donggeun Kim <dg77.kim at>
>
> Once CONFIG_FAT_WRITE is defined,
> users can invoke 'fatwrite' command that saves data in RAM as a FAT file.
Thanks for picking up this patch. A few minor comments:
Please add documentation for the new CONFIG_FAT_WRITE config option to
the top level README.
> This patch also removes compile error after patch of
> 'fs/fat: Fix FAT detection to support non-DOS partition tables'.
Which compile error would that be? I am not aware of any such error.
If ther eis one, the fix should be in a separate patch; otherwise
this comment should be removed.
Thanks!
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 1/2] FAT write: Fix compile errors
2012-03-13 9:57 [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Maximilian Schwerin
2012-03-13 9:57 ` [U-Boot] [PATCH 2/2] Add support for loading and saving the environment to a FAT partition Maximilian Schwerin
2012-03-18 21:04 ` [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Wolfgang Denk
@ 2012-03-22 14:38 ` Maximilian Schwerin
2012-03-24 23:57 ` [U-Boot] [PATCH] fs/fat/fat_write.c: Fix GCC 4.6 warnings Anatolij Gustschin
2012-03-25 0:17 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Anatolij Gustschin
2012-03-22 14:38 ` [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command Maximilian Schwerin
3 siblings, 2 replies; 14+ messages in thread
From: Maximilian Schwerin @ 2012-03-22 14:38 UTC (permalink / raw)
To: u-boot
This patch removes compile errors introduced by
'fs/fat: Fix FAT detection to support non-DOS partition tables'.
This patch was originally part of
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847
Reported-by: Donggeun Kim <dg77.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
fs/fat/fat_write.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 3bfc1c4..16f8400 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -41,23 +41,19 @@ static void uppercase(char *str, int len)
}
static int total_sector;
-static int disk_write(__u32 startblock, __u32 getsize, __u8 *bufptr)
+static int disk_write(__u32 block, __u32 nr_blocks, void *buf)
{
- if (cur_dev == NULL)
+ if (!cur_dev || !cur_dev->block_write)
return -1;
- if (startblock + getsize > total_sector) {
+ if (cur_part_info.start + block + nr_blocks >
+ cur_part_info.start + total_sector) {
printf("error: overflow occurs\n");
return -1;
}
- startblock += part_offset;
-
- if (cur_dev->block_read) {
- return cur_dev->block_write(cur_dev->dev, startblock, getsize,
- (unsigned long *) bufptr);
- }
- return -1;
+ return cur_dev->block_write(cur_dev->dev,
+ cur_part_info.start + block, nr_blocks, buf);
}
/*
@@ -797,7 +793,7 @@ static int check_overflow(fsdata *mydata, __u32 clustnum, unsigned long size)
if (size % mydata->sect_size)
sect_num++;
- if (startsect + sect_num > total_sector)
+ if (startsect + sect_num > cur_part_info.start + total_sector)
return -1;
return 0;
@@ -947,7 +943,7 @@ static int do_fat_write(const char *filename, void *buffer,
total_sector = bs.total_sect;
if (total_sector == 0)
- total_sector = part_size;
+ total_sector = cur_part_info.size;
root_cluster = bs.root_cluster;
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command
2012-03-13 9:57 [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Maximilian Schwerin
` (2 preceding siblings ...)
2012-03-22 14:38 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Maximilian Schwerin
@ 2012-03-22 14:38 ` Maximilian Schwerin
2012-03-25 0:26 ` Anatolij Gustschin
3 siblings, 1 reply; 14+ messages in thread
From: Maximilian Schwerin @ 2012-03-22 14:38 UTC (permalink / raw)
To: u-boot
Once CONFIG_FAT_WRITE is defined, users can invoke 'fatwrite' command
that saves data in RAM as a FAT file.
This patch was originally part of
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847
Reported-by: Donggeun Kim <dg77.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
README | 8 +++++-
common/cmd_fat.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 2 deletions(-)
diff --git a/README b/README
index 1f8bd20..fe077b9 100644
--- a/README
+++ b/README
@@ -1250,8 +1250,12 @@ The following options need to be configured:
- FAT(File Allocation Table) filesystem write function support:
CONFIG_FAT_WRITE
- Support for saving memory data as a file
- in FAT formatted partition
+
+ Define this to enable support for saving memory data as a
+ file in FAT formatted partition.
+
+ This will also enable the command "fatwrite" enabling the
+ user to write files to FAT.
- Keyboard Support:
CONFIG_ISA_KEYBOARD
diff --git a/common/cmd_fat.c b/common/cmd_fat.c
index 0220494..fef1c82 100644
--- a/common/cmd_fat.c
+++ b/common/cmd_fat.c
@@ -184,3 +184,60 @@ U_BOOT_CMD(
"<interface> <dev[:part]>\n"
" - print information about filesystem from 'dev' on 'interface'"
);
+
+#ifdef CONFIG_FAT_WRITE
+static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
+ int argc, char * const argv[])
+{
+ long size;
+ unsigned long addr;
+ unsigned long count;
+ block_dev_desc_t *dev_desc = NULL;
+ int dev = 0;
+ int part = 1;
+ char *ep;
+
+ if (argc < 5)
+ return cmd_usage(cmdtp);
+
+ dev = (int)simple_strtoul(argv[2], &ep, 16);
+ dev_desc = get_dev(argv[1], dev);
+ if (dev_desc == NULL) {
+ puts("\n** Invalid boot device **\n");
+ return 1;
+ }
+ if (*ep) {
+ if (*ep != ':') {
+ puts("\n** Invalid boot device, use `dev[:part]' **\n");
+ return 1;
+ }
+ part = (int)simple_strtoul(++ep, NULL, 16);
+ }
+ if (fat_register_device(dev_desc, part) != 0) {
+ printf("\n** Unable to use %s %d:%d for fatwrite **\n",
+ argv[1], dev, part);
+ return 1;
+ }
+ addr = simple_strtoul(argv[3], NULL, 16);
+ count = simple_strtoul(argv[5], NULL, 16);
+
+ size = file_fat_write(argv[4], (void *)addr, count);
+ if (size == -1) {
+ printf("\n** Unable to write \"%s\" from %s %d:%d **\n",
+ argv[4], argv[1], dev, part);
+ return 1;
+ }
+
+ printf("%ld bytes write\n", size);
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ fatwrite, 6, 0, do_fat_fswrite,
+ "write file into a dos filesystem",
+ "<interface> <dev[:part]> <addr> <filename> <bytes>\n"
+ " - write file 'filename' from the address 'addr' in RAM\n"
+ " to 'dev' on 'interface'"
+);
+#endif
--
1.7.0.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] fs/fat/fat_write.c: Fix GCC 4.6 warnings
2012-03-22 14:38 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Maximilian Schwerin
@ 2012-03-24 23:57 ` Anatolij Gustschin
2012-03-25 0:30 ` Anatolij Gustschin
2012-03-25 0:17 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Anatolij Gustschin
1 sibling, 1 reply; 14+ messages in thread
From: Anatolij Gustschin @ 2012-03-24 23:57 UTC (permalink / raw)
To: u-boot
Fix:
fat_write.c: In function 'find_directory_entry':
fat_write.c:826:8: warning: variable 'prevcksum' set but not used
[-Wunused-but-set-variable]
fat_write.c: In function 'do_fat_write':
fat_write.c:933:6: warning: variable 'root_cluster' set but not used
[-Wunused-but-set-variable]
fat_write.c:925:12: warning: variable 'slotptr' set but not used
[-Wunused-but-set-variable]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Donggeun Kim <dg77.kim@samsung.com>
---
fs/fat/fat_write.c | 10 +---------
1 files changed, 1 insertions(+), 9 deletions(-)
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 16f8400..a6181e7 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -823,7 +823,6 @@ static dir_entry *empty_dentptr;
static dir_entry *find_directory_entry(fsdata *mydata, int startsect,
char *filename, dir_entry *retdent, __u32 start)
{
- __u16 prevcksum = 0xffff;
__u32 curclust = (startsect - mydata->data_begin) / mydata->clust_size;
debug("get_dentfromdir: %s\n", filename);
@@ -857,8 +856,6 @@ static dir_entry *find_directory_entry(fsdata *mydata, int startsect,
#ifdef CONFIG_SUPPORT_VFAT
if ((dentptr->attr & ATTR_VFAT) &&
(dentptr->name[0] & LAST_LONG_ENTRY_MASK)) {
- prevcksum =
- ((dir_slot *)dentptr)->alias_checksum;
get_long_file_name(mydata, curclust,
get_dentfromdir_block,
&dentptr, l_name);
@@ -922,7 +919,6 @@ static int do_fat_write(const char *filename, void *buffer,
unsigned long size)
{
dir_entry *dentptr, *retdent;
- dir_slot *slotptr;
__u32 startsect;
__u32 start_cluster;
boot_sector bs;
@@ -930,7 +926,7 @@ static int do_fat_write(const char *filename, void *buffer,
fsdata datablock;
fsdata *mydata = &datablock;
int cursect;
- int root_cluster, ret = -1, name_len;
+ int ret = -1, name_len;
char l_filename[VFAT_MAXLEN_BYTES];
int write_size = size;
@@ -945,8 +941,6 @@ static int do_fat_write(const char *filename, void *buffer,
if (total_sector == 0)
total_sector = cur_part_info.size;
- root_cluster = bs.root_cluster;
-
if (mydata->fatsize == 32)
mydata->fatlength = bs.fat32_length;
else
@@ -1047,8 +1041,6 @@ static int do_fat_write(const char *filename, void *buffer,
goto exit;
}
} else {
- slotptr = (dir_slot *)empty_dentptr;
-
/* Set short name to set alias checksum field in dir_slot */
set_name(empty_dentptr, filename);
fill_dir_slot(mydata, &empty_dentptr, filename);
--
1.7.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 1/2] FAT write: Fix compile errors
2012-03-22 14:38 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Maximilian Schwerin
2012-03-24 23:57 ` [U-Boot] [PATCH] fs/fat/fat_write.c: Fix GCC 4.6 warnings Anatolij Gustschin
@ 2012-03-25 0:17 ` Anatolij Gustschin
1 sibling, 0 replies; 14+ messages in thread
From: Anatolij Gustschin @ 2012-03-25 0:17 UTC (permalink / raw)
To: u-boot
Hello Maximilian,
On Thu, 22 Mar 2012 15:38:55 +0100
Maximilian Schwerin <mvs@tigris.de> wrote:
> This patch removes compile errors introduced by
> 'fs/fat: Fix FAT detection to support non-DOS partition tables'.
>
> This patch was originally part of
>
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847
>
> Reported-by: Donggeun Kim <dg77.kim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> fs/fat/fat_write.c | 20 ++++++++------------
> 1 files changed, 8 insertions(+), 12 deletions(-)
Applied to u-boot-staging/agust at denx.de after fixing
commit log and all attribution tags.
NOTE: When submitting patches from other people you should
preserve their authorship and SoB and add your SoB.
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command
2012-03-22 14:38 ` [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command Maximilian Schwerin
@ 2012-03-25 0:26 ` Anatolij Gustschin
2012-03-26 0:34 ` Kyungmin Park
0 siblings, 1 reply; 14+ messages in thread
From: Anatolij Gustschin @ 2012-03-25 0:26 UTC (permalink / raw)
To: u-boot
On Thu, 22 Mar 2012 15:38:56 +0100
Maximilian Schwerin <mvs@tigris.de> wrote:
> Once CONFIG_FAT_WRITE is defined, users can invoke 'fatwrite' command
> that saves data in RAM as a FAT file.
>
> This patch was originally part of
>
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847
>
> Reported-by: Donggeun Kim <dg77.kim@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> README | 8 +++++-
> common/cmd_fat.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 63 insertions(+), 2 deletions(-)
Applied to u-boot-staging/agust at denx.de after fixing
attribution tags and a typo. Thanks.
Hmm, emails to dg77.kim at samsung.com address are now rejected:
Recipient address rejected: User unknown (in reply to RCPT TO command)
> + printf("%ld bytes write\n", size);
typo fixed, s/write/written/
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH] fs/fat/fat_write.c: Fix GCC 4.6 warnings
2012-03-24 23:57 ` [U-Boot] [PATCH] fs/fat/fat_write.c: Fix GCC 4.6 warnings Anatolij Gustschin
@ 2012-03-25 0:30 ` Anatolij Gustschin
0 siblings, 0 replies; 14+ messages in thread
From: Anatolij Gustschin @ 2012-03-25 0:30 UTC (permalink / raw)
To: u-boot
On Sun, 25 Mar 2012 00:57:06 +0100
Anatolij Gustschin <agust@denx.de> wrote:
> Fix:
> fat_write.c: In function 'find_directory_entry':
> fat_write.c:826:8: warning: variable 'prevcksum' set but not used
> [-Wunused-but-set-variable]
> fat_write.c: In function 'do_fat_write':
> fat_write.c:933:6: warning: variable 'root_cluster' set but not used
> [-Wunused-but-set-variable]
> fat_write.c:925:12: warning: variable 'slotptr' set but not used
> [-Wunused-but-set-variable]
>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> Cc: Donggeun Kim <dg77.kim@samsung.com>
> ---
> fs/fat/fat_write.c | 10 +---------
> 1 files changed, 1 insertions(+), 9 deletions(-)
I'll push this patch through my staging branch if nobody objects.
Thanks,
Anatolij
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command
2012-03-25 0:26 ` Anatolij Gustschin
@ 2012-03-26 0:34 ` Kyungmin Park
2012-03-26 7:13 ` Anatolij Gustschin
0 siblings, 1 reply; 14+ messages in thread
From: Kyungmin Park @ 2012-03-26 0:34 UTC (permalink / raw)
To: u-boot
On 3/25/12, Anatolij Gustschin <agust@denx.de> wrote:
> On Thu, 22 Mar 2012 15:38:56 +0100
> Maximilian Schwerin <mvs@tigris.de> wrote:
>
>> Once CONFIG_FAT_WRITE is defined, users can invoke 'fatwrite' command
>> that saves data in RAM as a FAT file.
>>
>> This patch was originally part of
>>
>> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847
>>
>> Reported-by: Donggeun Kim <dg77.kim@samsung.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>> README | 8 +++++-
>> common/cmd_fat.c | 57
>> ++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> 2 files changed, 63 insertions(+), 2 deletions(-)
>
> Applied to u-boot-staging/agust at denx.de after fixing
> attribution tags and a typo. Thanks.
>
> Hmm, emails to dg77.kim at samsung.com address are now rejected:
> Recipient address rejected: User unknown (in reply to RCPT TO command)
Hi,
FYI: Now Mr. Kim is left the company. So if any issue and codes from
Mr. Kim, then let me follow up.
Thank you,
Kyungmin Park
>
>
>> + printf("%ld bytes write\n", size);
>
> typo fixed, s/write/written/
>
> Thanks,
> Anatolij
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command
2012-03-26 0:34 ` Kyungmin Park
@ 2012-03-26 7:13 ` Anatolij Gustschin
2012-03-26 8:27 ` Maximilian Schwerin
2012-03-26 8:33 ` Kyungmin Park
0 siblings, 2 replies; 14+ messages in thread
From: Anatolij Gustschin @ 2012-03-26 7:13 UTC (permalink / raw)
To: u-boot
On Mon, 26 Mar 2012 09:34:07 +0900
Kyungmin Park <kyungmin.park@samsung.com> wrote:
...
> > Hmm, emails to dg77.kim at samsung.com address are now rejected:
> > Recipient address rejected: User unknown (in reply to RCPT TO command)
> Hi,
Hi,
> FYI: Now Mr. Kim is left the company. So if any issue and codes from
> Mr. Kim, then let me follow up.
Thanks for the info. When compiling the FAT write code with newer
GCC 4.6.1 I've seen some warnings and fixed them by this patch [1].
Could you please look at this patch and if it is okay, then send
your Acked-by?
> Thank you,
> Kyungmin Park
Thanks,
Anatolij
[1] http://patchwork.ozlabs.org/patch/148551/
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command
2012-03-26 7:13 ` Anatolij Gustschin
@ 2012-03-26 8:27 ` Maximilian Schwerin
2012-03-26 8:33 ` Kyungmin Park
1 sibling, 0 replies; 14+ messages in thread
From: Maximilian Schwerin @ 2012-03-26 8:27 UTC (permalink / raw)
To: u-boot
> -----Urspr?ngliche Nachricht-----
> Von: Anatolij Gustschin [mailto:agust at denx.de]
> Gesendet: Montag, 26. M?rz 2012 09:13
> An: Kyungmin Park
> Cc: Maximilian Schwerin; u-boot at lists.denx.de
> Betreff: Re: [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command
>
> On Mon, 26 Mar 2012 09:34:07 +0900
> Kyungmin Park <kyungmin.park@samsung.com> wrote:
> ...
> > > Hmm, emails to dg77.kim at samsung.com address are now rejected:
> > > Recipient address rejected: User unknown (in reply to
> RCPT TO command)
> > Hi,
>
> Hi,
>
> > FYI: Now Mr. Kim is left the company. So if any issue and codes from
> > Mr. Kim, then let me follow up.
>
> Thanks for the info. When compiling the FAT write code with newer
> GCC 4.6.1 I've seen some warnings and fixed them by this patch [1].
> Could you please look at this patch and if it is okay, then send
> your Acked-by?
>
> > Thank you,
> > Kyungmin Park
>
> Thanks,
> Anatolij
>
> [1] http://patchwork.ozlabs.org/patch/148551/
>
Acked-by: Maximilian Schwerin <mvs@tigris.de>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120326/b4fc4d0d/attachment.pgp>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command
2012-03-26 7:13 ` Anatolij Gustschin
2012-03-26 8:27 ` Maximilian Schwerin
@ 2012-03-26 8:33 ` Kyungmin Park
1 sibling, 0 replies; 14+ messages in thread
From: Kyungmin Park @ 2012-03-26 8:33 UTC (permalink / raw)
To: u-boot
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Maybe some debug codes are included.
On 3/26/12, Anatolij Gustschin <agust@denx.de> wrote:
> On Mon, 26 Mar 2012 09:34:07 +0900
> Kyungmin Park <kyungmin.park@samsung.com> wrote:
> ...
>> > Hmm, emails to dg77.kim at samsung.com address are now rejected:
>> > Recipient address rejected: User unknown (in reply to RCPT TO command)
>> Hi,
>
> Hi,
>
>> FYI: Now Mr. Kim is left the company. So if any issue and codes from
>> Mr. Kim, then let me follow up.
>
> Thanks for the info. When compiling the FAT write code with newer
> GCC 4.6.1 I've seen some warnings and fixed them by this patch [1].
> Could you please look at this patch and if it is okay, then send
> your Acked-by?
>
>> Thank you,
>> Kyungmin Park
>
> Thanks,
> Anatolij
>
> [1] http://patchwork.ozlabs.org/patch/148551/
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* [U-Boot] [PATCH 2/2] Add support for loading and saving the environment to a FAT partition
2012-03-13 9:57 ` [U-Boot] [PATCH 2/2] Add support for loading and saving the environment to a FAT partition Maximilian Schwerin
@ 2012-03-30 20:40 ` Wolfgang Denk
0 siblings, 0 replies; 14+ messages in thread
From: Wolfgang Denk @ 2012-03-30 20:40 UTC (permalink / raw)
To: u-boot
Dear Maximilian Schwerin,
In message <1331632670-14874-2-git-send-email-mvs@tigris.de> you wrote:
> The following must be defined:
>
> CONFIG_ENV_IS_IN_FAT
> Enable this saving environment to FAT.
>
> FAT_ENV_INTERFACE
> Interface the FAT resides on (e.g. mmc).
>
> FAT_ENV_DEVICE
> The interface device number (e.g. 0 for mmc0)
>
> FAT_ENV_PART
> The device part (e.g. 1 for mmc0:1)
>
> FAT_ENV_FILE
> The filename of the environment file.
> ---
> common/Makefile | 1 +
> common/cmd_nvedit.c | 3 +-
> common/env_fat.c | 158 +++++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 161 insertions(+), 1 deletions(-)
> create mode 100644 common/env_fat.c
Applied, thanks.
As your SoB was missing, I signed it. I also removed the dead
"/* #define DEBUG */" line.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PUBLIC NOTICE AS REQUIRED BY LAW: Any Use of This Product, in Any
Manner Whatsoever, Will Increase the Amount of Disorder in the
Universe. Although No Liability Is Implied Herein, the Consumer Is
Warned That This Process Will Ultimately Lead to the Heat Death of
the Universe.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2012-03-30 20:40 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-13 9:57 [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Maximilian Schwerin
2012-03-13 9:57 ` [U-Boot] [PATCH 2/2] Add support for loading and saving the environment to a FAT partition Maximilian Schwerin
2012-03-30 20:40 ` Wolfgang Denk
2012-03-18 21:04 ` [U-Boot] [PATCH 1/2] cmd_fat: add FAT write command Wolfgang Denk
2012-03-22 14:38 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Maximilian Schwerin
2012-03-24 23:57 ` [U-Boot] [PATCH] fs/fat/fat_write.c: Fix GCC 4.6 warnings Anatolij Gustschin
2012-03-25 0:30 ` Anatolij Gustschin
2012-03-25 0:17 ` [U-Boot] [PATCH 1/2] FAT write: Fix compile errors Anatolij Gustschin
2012-03-22 14:38 ` [U-Boot] [PATCH 2/2] cmd_fat: add FAT write command Maximilian Schwerin
2012-03-25 0:26 ` Anatolij Gustschin
2012-03-26 0:34 ` Kyungmin Park
2012-03-26 7:13 ` Anatolij Gustschin
2012-03-26 8:27 ` Maximilian Schwerin
2012-03-26 8:33 ` Kyungmin Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox