diff options
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.patch | 84 |
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 @@ | |||
1 | From a95b831e18dd123f859bc5e6c4cecdcc0184ee37 Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Fri, 2 Jan 2015 12:18:02 +0800 | ||
4 | Subject: [PATCH 7/9] linux/syslinux: implement ext_construct_sectmap_fs() | ||
5 | |||
6 | The ext_construct_sectmap_fs() constucts the sector according to the | ||
7 | bmap. | ||
8 | |||
9 | Upstream-Status: Submitted | ||
10 | |||
11 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
12 | Tested-by: Du Dolpher <dolpher.du@intel.com> | ||
13 | --- | ||
14 | linux/syslinux.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
15 | 1 file changed, 50 insertions(+) | ||
16 | |||
17 | diff --git a/linux/syslinux.c b/linux/syslinux.c | ||
18 | index 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 | -- | ||
83 | 1.9.1 | ||
84 | |||