Bug 6990 - make extlinux work without mount the filesystem
Summary: make extlinux work without mount the filesystem
Status: VERIFIED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: deployment (show other bugs)
Version: 1.8
Hardware: x86 Multiple
: Medium+ enhancement
Target Milestone: 1.8 M4
Assignee: Robert Yang
QA Contact: Costin
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2014-11-21 05:09 UTC by Robert Yang
Modified: 2015-05-01 19:09 UTC (History)
7 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Yang 2014-11-21 05:09:52 UTC
Currently, the extlinux only can work after the filesystem (or disk partation) is mounted, for example:

mount image.ext3 /tmp/mnt
extlinux -i /tmp/mnt

The mount requires the root privilege, we can make extlinux to directly write to  without the mount, for example:

extlinux -i -d image.ext3
Comment 1 Robert Yang 2014-12-24 09:13:05 UTC
Sent the patches to syslinux community:

The following changes since commit 81ad566f155fac31089fde69c87059b217e7e9b6:

  NEWS: Update for 6.03 release (2014-10-06 09:27:44 -0700)

are available in the git repository at:

  https://github.com/robertlinux/sys_tmp.git unmounted_ext

for you to fetch changes up to a3603826b88c5f000c5b0ba519cd0a5252eb6c6b:

  libinstaller/syslxopt.c: update the help text. (2014-12-24 16:07:50 +0800)
Robert Yang (8):
  extlinux/main.c: support unmounted ext2/3/4 filesystem
  extlinux/main.c: implement install_file_to_device()
  extlinux/main.c: implement handle_adv_on_device()
  extlinux/main.c: implent ext_read/write_xx_fs()
  extlinux/main.c: implement write_to_device()
  extlinux/main.c: implement patch_syslinux_bootsect()
  extlinux/main.c: implement ext_construct_sectmap_fs()
  libinstaller/syslxopt.c: update the help text.

 extlinux/Makefile       |   2 +-
 extlinux/main.c         | 611 +++++++++++++++++++++++++++++++++++++++++++-----
 libinstaller/syslxopt.c |   2 +-
 3 files changed, 553 insertions(+), 62 deletions(-)
Comment 3 Costin 2015-04-02 11:27:58 UTC
Hello,

Tested on latest master hash: 9e4adec98db325112ca7a8b9dd95722d4d0ab642

BB_VERSION        = "1.27.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Ubuntu-14.04"
TARGET_SYS        = "i586-poky-linux"
MACHINE           = "genericx86"
DISTRO            = "poky"
DISTRO_VERSION    = "1.8+snapshot-20150401"
TUNE_FEATURES     = "m32 core2"
TARGET_FPU        = ""
meta
meta-yocto
meta-yocto-bsp    = "master:9e4adec98db325112ca7a8b9dd95722d4d0ab642"


Steps performed to test this enhancement:
1) bitbake syslinux-native
2) sudo dd if=/dev/zero of=test.img bs=1M count=1k

~/poky/build$ ls -lh test.img
-rw-r--r-- 1 root root 1.0G Apr  1 11:33 test.img
...

3)sudo mkfs.ext3 -F test.img

4) $ pwd
/home/autobuilder/poky/build/tmp/sysroots/x86_64-linux/usr/bin
$ ./syslinux -i ../../../../../test.img
./syslinux: invalid media signature (not an FAT/NTFS volume?)

It seems not to work with ext3 filesystem. I also tried ext2 and ext4.

Costin
Comment 4 Robert Yang 2015-04-13 03:15:45 UTC
It is because:
/home/autobuilder/poky/build/tmp/sysroots/x86_64-linux/usr/bin/syslinux

is syslinux-mtools, please use this one atm:

./tmp/work/x86_64-linux/syslinux-native/6.03-r0/syslinux-6.03/bios/linux/syslinux

We still need more work to do with syslinux, I will file another 2 to track them, so I will mark it as done atm.
Comment 5 Costin 2015-05-01 19:09:20 UTC
Hello,

Checked as per last comment's recommendation. It worked:

Steps performed:

all as on comment#3, the exception being the use of syslinux from this dir:
/media/poky/3poky/build/tmp/work/x86_64-linux/syslinux-native/6.03-r0/syslinux-6.03/bios/linux
This time, i put the test.img in this dir also (for ease of use)


To verify:
1)mkdir test
2)sudo mount test.img test
3)ls test
drwxr-xr-x 3 root    root      4096 mai  1 22:10 ./
drwxrwxr-x 3 cosscat cosscat   4096 mai  1 22:11 ../
-r--r--r-- 1 root    root    122308 mai  1 22:11 ldlinux.c32
-r--r--r-- 1 root    root     69632 mai  1 22:11 ldlinux.sys
drwx------ 2 root    root     16384 mai  1 22:10 lost+found/


Marking as verified

Costin