diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2015-02-13 00:59:08 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-15 21:58:29 +0000 |
commit | a2bfd4b1fb055e63a48d80e7e55a6cff475e06d1 (patch) | |
tree | 104a6937a3153b4dbf78e6111c36be6cd213be13 /meta/recipes-devtools/syslinux/syslinux/0004-linux-syslinux-add-ext_file_read-and-ext_file_write.patch | |
parent | 06ff3c420ca3b4237271879571d9933bbe6463ec (diff) | |
download | ast2050-yocto-poky-a2bfd4b1fb055e63a48d80e7e55a6cff475e06d1.zip ast2050-yocto-poky-a2bfd4b1fb055e63a48d80e7e55a6cff475e06d1.tar.gz |
syslinux: support ext2/3/4 device
* Support ext2/3/4 deivce.
* The open_ext2_fs() checks whether it is an ext2/3/4 device,
do the ext2/3/4 installation (install_to_ext2()) if yes, otherwise go
on to the fat/ntfs.
* The ext2/3/4 support doesn't require root privileges since it doesn't need
mount (but write permission is required).
Next:
* Get rid of fat filesystem from the boot image.
These patches have been sent to upstream, we may adjust them (maybe put
the extX support to syslinux-mtools), I will go on working with the
upstream.
(From OE-Core rev: d5af8539c0a1718a7254bcdcfa973e3c887dfbd6)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/syslinux/syslinux/0004-linux-syslinux-add-ext_file_read-and-ext_file_write.patch')
-rw-r--r-- | meta/recipes-devtools/syslinux/syslinux/0004-linux-syslinux-add-ext_file_read-and-ext_file_write.patch | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/meta/recipes-devtools/syslinux/syslinux/0004-linux-syslinux-add-ext_file_read-and-ext_file_write.patch b/meta/recipes-devtools/syslinux/syslinux/0004-linux-syslinux-add-ext_file_read-and-ext_file_write.patch new file mode 100644 index 0000000..64b56d9 --- /dev/null +++ b/meta/recipes-devtools/syslinux/syslinux/0004-linux-syslinux-add-ext_file_read-and-ext_file_write.patch @@ -0,0 +1,91 @@ +From 35d3842cc4b930c5102eed2921e0189b7f4fd069 Mon Sep 17 00:00:00 2001 +From: Robert Yang <liezhi.yang@windriver.com> +Date: Wed, 31 Dec 2014 16:43:37 +0800 +Subject: [PATCH 4/9] linux/syslinux: add ext_file_read() and ext_file_write() + +Will use them to read and write on the extX device. + +Upstream-Status: Submitted + +Signed-off-by: Robert Yang <liezhi.yang@windriver.com> +Tested-by: Du Dolpher <dolpher.du@intel.com> +--- + linux/syslinux.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 62 insertions(+) + +diff --git a/linux/syslinux.c b/linux/syslinux.c +index 45f080d..247c86a 100755 +--- a/linux/syslinux.c ++++ b/linux/syslinux.c +@@ -349,6 +349,68 @@ fail: + + } + ++/* Read from an ext2_file */ ++static int ext_file_read(ext2_file_t e2_file, void *buf, size_t count, ++ off_t offset, const char *msg) ++{ ++ int retval; ++ char *ptr = (char *) buf; ++ unsigned int got = 0; ++ size_t done = 0; ++ ++ /* Always lseek since e2_file is uncontrolled by this func */ ++ if (ext2fs_file_lseek(e2_file, offset, EXT2_SEEK_SET, NULL)) { ++ fprintf(stderr, "%s: ext2fs_file_lseek() failed.\n", ++ program); ++ return -1; ++ } ++ ++ while (1) { ++ retval = ext2fs_file_read(e2_file, ptr, count, &got); ++ if (retval) { ++ fprintf(stderr, "%s: error while reading %s\n", ++ program, msg); ++ return -1; ++ } ++ count -= got; ++ ptr += got; ++ done += got; ++ if (got == 0 || count == 0) ++ break; ++ } ++ ++ return done; ++} ++ ++/* Write to an ext2_file */ ++static int ext_file_write(ext2_file_t e2_file, const void *buf, size_t count, ++ off_t offset) ++{ ++ const char *ptr = (const char *) buf; ++ unsigned int written = 0; ++ size_t done = 0; ++ ++ /* Always lseek since e2_file is uncontrolled by this func */ ++ if (ext2fs_file_lseek(e2_file, offset, EXT2_SEEK_SET, NULL)) { ++ fprintf(stderr, "%s: ext2fs_file_lseek() failed.\n", ++ program); ++ return -1; ++ } ++ ++ while (count > 0) { ++ if (ext2fs_file_write(e2_file, ptr, count, &written)) { ++ fprintf(stderr, "%s: failed to write syslinux adv.\n", ++ program); ++ return -1; ++ } ++ count -= written; ++ ptr += written; ++ done += written; ++ } ++ ++ return done; ++} ++ + /* + * Install the boot block on the specified device. + * Must be run AFTER file installed. +-- +1.9.1 + |