summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2015-02-13 00:59:08 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-15 21:58:29 +0000
commita2bfd4b1fb055e63a48d80e7e55a6cff475e06d1 (patch)
tree104a6937a3153b4dbf78e6111c36be6cd213be13 /meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch
parent06ff3c420ca3b4237271879571d9933bbe6463ec (diff)
downloadpoky-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/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch')
-rw-r--r--meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch b/meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch
new file mode 100644
index 0000000000..3913811917
--- /dev/null
+++ b/meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch
@@ -0,0 +1,84 @@
1From a95b831e18dd123f859bc5e6c4cecdcc0184ee37 Mon Sep 17 00:00:00 2001
2From: Robert Yang <liezhi.yang@windriver.com>
3Date: Fri, 2 Jan 2015 12:18:02 +0800
4Subject: [PATCH 7/9] linux/syslinux: implement ext_construct_sectmap_fs()
5
6The ext_construct_sectmap_fs() constucts the sector according to the
7bmap.
8
9Upstream-Status: Submitted
10
11Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
12Tested-by: Du Dolpher <dolpher.du@intel.com>
13---
14 linux/syslinux.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
15 1 file changed, 50 insertions(+)
16
17diff --git a/linux/syslinux.c b/linux/syslinux.c
18index f0c97a8..c741750 100755
19--- a/linux/syslinux.c
20+++ b/linux/syslinux.c
21@@ -421,10 +421,60 @@ int install_bootblock(int fd, const char *device)
22 {
23 }
24
25+/* The file's block count */
26+int block_count = 0;
27+static int get_block_count(ext2_filsys fs EXT2FS_ATTR((unused)),
28+ blk64_t *blocknr EXT2FS_ATTR((unused)),
29+ e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
30+ blk64_t ref_block EXT2FS_ATTR((unused)),
31+ int ref_offset EXT2FS_ATTR((unused)),
32+ void *private EXT2FS_ATTR((unused)))
33+{
34+ block_count++;
35+ return 0;
36+}
37+
38 /* Construct the boot file map */
39 int ext_construct_sectmap_fs(ext2_filsys fs, ext2_ino_t newino,
40 sector_t *sectors, int nsect)
41 {
42+ blk64_t pblk, blksize, blk = 0;
43+ sector_t sec;
44+ unsigned int i;
45+ int retval;
46+
47+ blksize = fs->blocksize;
48+ blksize >>= SECTOR_SHIFT;
49+
50+ /* Get the total blocks no. */
51+ retval = ext2fs_block_iterate3(fs, newino, BLOCK_FLAG_READ_ONLY,
52+ NULL, get_block_count, NULL);
53+ if (retval) {
54+ fprintf(stderr, "%s: ERROR: ext2fs_block_iterate3() failed.\n", program);
55+ return -1;
56+ }
57+
58+ while (nsect) {
59+ if (block_count-- == 0)
60+ break;
61+
62+ /* Get the physical block no. (bmap) */
63+ retval = ext2fs_bmap2(fs, newino, 0, 0, 0, blk, 0, &pblk);
64+ if (retval) {
65+ fprintf(stderr, "%s: ERROR: ext2fs_bmap2() failed.\n", program);
66+ return -1;
67+ }
68+
69+ blk++;
70+ sec = (sector_t)pblk * blksize;
71+ for (i = 0; i < blksize; i++) {
72+ *sectors++ = sec++;
73+ if (! --nsect)
74+ break;
75+ }
76+ }
77+
78+ return 0;
79 }
80
81 static int handle_adv_on_ext(void)
82--
831.9.1
84