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 08:11:19 +0000 |
commit | d5af8539c0a1718a7254bcdcfa973e3c887dfbd6 (patch) | |
tree | 635b3967f9defe604a950233f31a1f07ad00162a /meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch | |
parent | 96ca20db0f4e06a5298f706b30313079af54f1bc (diff) | |
download | openembedded-core-d5af8539c0a1718a7254bcdcfa973e3c887dfbd6.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.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
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 @@ +From a95b831e18dd123f859bc5e6c4cecdcc0184ee37 Mon Sep 17 00:00:00 2001 +From: Robert Yang <liezhi.yang@windriver.com> +Date: Fri, 2 Jan 2015 12:18:02 +0800 +Subject: [PATCH 7/9] linux/syslinux: implement ext_construct_sectmap_fs() + +The ext_construct_sectmap_fs() constucts the sector according to the +bmap. + +Upstream-Status: Submitted + +Signed-off-by: Robert Yang <liezhi.yang@windriver.com> +Tested-by: Du Dolpher <dolpher.du@intel.com> +--- + linux/syslinux.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 50 insertions(+) + +diff --git a/linux/syslinux.c b/linux/syslinux.c +index f0c97a8..c741750 100755 +--- a/linux/syslinux.c ++++ b/linux/syslinux.c +@@ -421,10 +421,60 @@ int install_bootblock(int fd, const char *device) + { + } + ++/* The file's block count */ ++int block_count = 0; ++static int get_block_count(ext2_filsys fs EXT2FS_ATTR((unused)), ++ blk64_t *blocknr EXT2FS_ATTR((unused)), ++ e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), ++ blk64_t ref_block EXT2FS_ATTR((unused)), ++ int ref_offset EXT2FS_ATTR((unused)), ++ void *private EXT2FS_ATTR((unused))) ++{ ++ block_count++; ++ return 0; ++} ++ + /* Construct the boot file map */ + int ext_construct_sectmap_fs(ext2_filsys fs, ext2_ino_t newino, + sector_t *sectors, int nsect) + { ++ blk64_t pblk, blksize, blk = 0; ++ sector_t sec; ++ unsigned int i; ++ int retval; ++ ++ blksize = fs->blocksize; ++ blksize >>= SECTOR_SHIFT; ++ ++ /* Get the total blocks no. */ ++ retval = ext2fs_block_iterate3(fs, newino, BLOCK_FLAG_READ_ONLY, ++ NULL, get_block_count, NULL); ++ if (retval) { ++ fprintf(stderr, "%s: ERROR: ext2fs_block_iterate3() failed.\n", program); ++ return -1; ++ } ++ ++ while (nsect) { ++ if (block_count-- == 0) ++ break; ++ ++ /* Get the physical block no. (bmap) */ ++ retval = ext2fs_bmap2(fs, newino, 0, 0, 0, blk, 0, &pblk); ++ if (retval) { ++ fprintf(stderr, "%s: ERROR: ext2fs_bmap2() failed.\n", program); ++ return -1; ++ } ++ ++ blk++; ++ sec = (sector_t)pblk * blksize; ++ for (i = 0; i < blksize; i++) { ++ *sectors++ = sec++; ++ if (! --nsect) ++ break; ++ } ++ } ++ ++ return 0; + } + + static int handle_adv_on_ext(void) +-- +1.9.1 + |