Files
poky/meta/recipes-devtools/syslinux/syslinux/0007-linux-syslinux-implement-ext_construct_sectmap_fs.patch
Robert Yang a2bfd4b1fb 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>
2015-02-15 21:58:29 +00:00

85 lines
2.4 KiB
Diff

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