diff options
Diffstat (limited to 'meta/recipes-devtools/syslinux/syslinux/0001-linux-syslinux-support-ext2-3-4-device.patch')
-rw-r--r-- | meta/recipes-devtools/syslinux/syslinux/0001-linux-syslinux-support-ext2-3-4-device.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-devtools/syslinux/syslinux/0001-linux-syslinux-support-ext2-3-4-device.patch b/meta/recipes-devtools/syslinux/syslinux/0001-linux-syslinux-support-ext2-3-4-device.patch new file mode 100644 index 0000000000..3ab7875274 --- /dev/null +++ b/meta/recipes-devtools/syslinux/syslinux/0001-linux-syslinux-support-ext2-3-4-device.patch | |||
@@ -0,0 +1,84 @@ | |||
1 | From 60f3833ab2b5899771b4eab654e88f9888b99501 Mon Sep 17 00:00:00 2001 | ||
2 | From: Robert Yang <liezhi.yang@windriver.com> | ||
3 | Date: Wed, 31 Dec 2014 16:01:55 +0800 | ||
4 | Subject: [PATCH 1/9] linux/syslinux: support ext2/3/4 device | ||
5 | |||
6 | * Support ext2/3/4 deivce. | ||
7 | * The open_ext2_fs() checks whether it is an ext2/3/4 device, | ||
8 | do the ext2/3/4 installation (install_to_ext2()) if yes, otherwise go | ||
9 | on to the fat/ntfs. | ||
10 | * The ext2/3/4 support doesn't require root privileges since it doesn't need | ||
11 | mount (but write permission is required). | ||
12 | |||
13 | Upstream-Status: Submitted | ||
14 | |||
15 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
16 | Tested-by: Du Dolpher <dolpher.du@intel.com> | ||
17 | --- | ||
18 | linux/syslinux.c | 36 ++++++++++++++++++++++++++++++++++++ | ||
19 | 1 file changed, 36 insertions(+) | ||
20 | |||
21 | diff --git a/linux/syslinux.c b/linux/syslinux.c | ||
22 | index 912de71..36fc202 100755 | ||
23 | --- a/linux/syslinux.c | ||
24 | +++ b/linux/syslinux.c | ||
25 | @@ -256,6 +256,23 @@ int do_open_file(char *name) | ||
26 | return fd; | ||
27 | } | ||
28 | |||
29 | +/* | ||
30 | + * Check whether the device contains an ext2, ext3 or ext4 fs and open it if | ||
31 | + * true. | ||
32 | + * return value: | ||
33 | + * 0: Everything is OK | ||
34 | + * 1: Not an ext2, ext3 or ext4 | ||
35 | + * -1: unexpected error | ||
36 | + */ | ||
37 | +static int open_ext2_fs(const char *device, const char *subdir) | ||
38 | +{ | ||
39 | +} | ||
40 | + | ||
41 | +/* The install func for ext2, ext3 and ext4 */ | ||
42 | +static int install_to_ext2(const char *device, int dev_fd, const char *subdir) | ||
43 | +{ | ||
44 | +} | ||
45 | + | ||
46 | int main(int argc, char *argv[]) | ||
47 | { | ||
48 | static unsigned char sectbuf[SECTOR_SIZE]; | ||
49 | @@ -313,6 +330,24 @@ int main(int argc, char *argv[]) | ||
50 | die("can't combine an offset with a block device"); | ||
51 | } | ||
52 | |||
53 | + /* | ||
54 | + * Check if it is an ext2, ext3 or ext4 | ||
55 | + */ | ||
56 | + rv = open_ext2_fs(opt.device, subdir); | ||
57 | + if (rv == 0) { | ||
58 | + if (install_to_ext2(opt.device, dev_fd, subdir)) { | ||
59 | + fprintf(stderr, "%s: installation failed\n", opt.device); | ||
60 | + exit(1); | ||
61 | + } | ||
62 | + return 0; | ||
63 | + /* Unexpected errors */ | ||
64 | + } else if (rv == -1) { | ||
65 | + exit(1); | ||
66 | + } | ||
67 | + | ||
68 | + /* Reset rv */ | ||
69 | + rv = 0; | ||
70 | + | ||
71 | xpread(dev_fd, sectbuf, SECTOR_SIZE, opt.offset); | ||
72 | fsync(dev_fd); | ||
73 | |||
74 | @@ -322,6 +357,7 @@ int main(int argc, char *argv[]) | ||
75 | */ | ||
76 | if ((errmsg = syslinux_check_bootsect(sectbuf, &fs_type))) { | ||
77 | fprintf(stderr, "%s: %s\n", opt.device, errmsg); | ||
78 | + fprintf(stderr, "%s: supported fs: fat/ntfs/ext2/ex3/ext4\n", program); | ||
79 | exit(1); | ||
80 | } | ||
81 | |||
82 | -- | ||
83 | 1.9.1 | ||
84 | |||