wic: Add SD/MMC-Cards support
PATCH 1/1 wic: Add SD/MMC-Cards support
If the following .wks is set up to mmcblk0 (sdcard)
part /boot --source bootimg-pcbios --ondisk mmcblk0 --fstype=msdos --label boot --active --align 1024 part / --source rootfs --ondisk mmcblk0 --fstype=ext3 --label platform --align 1024
bootloader --timeout=0 --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0"
And the user inspect this file /var/tmp/wic/build/hdd/boot/syslinux.cfg, the 'root=' will be '/dev/mmcblk02' instead of '/dev/mmcblk0p2'.
This patch add the support to constrain the disk and make the adjusts when mmcblk devices are used.
I am not sure if is not necessary to fix others places. Until now it's the single point.
João Henrique Ferreira de Freitas (1):
wic: Add SD/MMC-Cards support to '--ondisk' param
scripts/lib/mic/imager/direct.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.2
PATCH 1/1 wic: Add SD/MMC-Cards support to '--ondisk' param
The special case when wic is set up to use SD/MMC-Cards in place of sdX disks is not handled properly.
Append 'p' to the rootdev when disk is SD/MMC-Cards fix this situation.
--- scripts/lib/mic/imager/direct.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/lib/mic/imager/direct.py +6 -2
@@ -345,10 +345,14 @@ class DirectImageCreator(BaseImageCreator): parts = self._get_parts() for num, p in enumerate(parts, 1): if p.mountpoint == "/": + part = '' + if p.disk.startswith('mmcblk'): + part = 'p' + if self._ptable_format == 'msdos' and num > 3: - rootdev = "/dev/%s%-d" % (p.disk, num + 1) + rootdev = "/dev/%s%s%-d" % (p.disk, part, num + 1) else: - rootdev = "/dev/%s%-d" % (p.disk, num) + rootdev = "/dev/%s%s%-d" % (p.disk, part, num) root_part_uuid = p.part_type return (rootdev, root_part_uuid)
Signature · 1 line
1.8.3.2
Re: [PATCH] wic: Add SD/MMC-Cards support to '--ondisk' param
Quoted 4 lines · João Henrique Ferreira de Freitas
The special case when wic is set up to use SD/MMC-Cards in place of sdX disks is not handled properly.
Append 'p' to the rootdev when disk is SD/MMC-Cards fix this situation.
This is missing your Signed-off-by. Other than that,
Quoted 28 lines
--- scripts/lib/mic/imager/direct.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)scripts/lib/mic/imager/direct.py +6
-2@@ -345,10 +345,14 @@ class DirectImageCreator(BaseImageCreator): parts = self._get_parts() for num, p in enumerate(parts, 1): if p.mountpoint == "/": + part = '' + if p.disk.startswith('mmcblk'): + part = 'p' + if self._ptable_format == 'msdos' and num > 3: - rootdev = "/dev/%s%-d" % (p.disk, num + 1) + rootdev = "/dev/%s%s%-d" % (p.disk, part, num + 1) else: - rootdev = "/dev/%s%-d" % (p.disk, num) + rootdev = "/dev/%s%s%-d" % (p.disk, part, num) root_part_uuid = p.part_type return (rootdev, root_part_uuid)Signature · 1 line
1.8.3.2
PATCH v2 1/1 wic: Add SD/MMC-Cards support to '--ondisk' param
In reply to João Henrique Ferreira de FreitasThe special case when wic is set up to use SD/MMC-Cards in place of sdX disks is not handled properly.
Append 'p' to the rootdev when disk is SD/MMC-Cards fix this situation.
---
changes since previous version:
* add Signed-off-by
scripts/lib/mic/imager/direct.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
scripts/lib/mic/imager/direct.py +6 -2
@@ -345,10 +345,14 @@ class DirectImageCreator(BaseImageCreator): parts = self._get_parts() for num, p in enumerate(parts, 1): if p.mountpoint == "/": + part = '' + if p.disk.startswith('mmcblk'): + part = 'p' + if self._ptable_format == 'msdos' and num > 3: - rootdev = "/dev/%s%-d" % (p.disk, num + 1) + rootdev = "/dev/%s%s%-d" % (p.disk, part, num + 1) else: - rootdev = "/dev/%s%-d" % (p.disk, num) + rootdev = "/dev/%s%s%-d" % (p.disk, part, num) root_part_uuid = p.part_type return (rootdev, root_part_uuid)
Signature · 1 line
1.8.3.2
Quoted 7 lines · João Henrique Ferreira de Freitas
If the following .wks is set up to mmcblk0 (sdcard)
part /boot --source bootimg-pcbios --ondisk mmcblk0 --fstype=msdos --label boot --active --align 1024 part / --source rootfs --ondisk mmcblk0 --fstype=ext3 --label platform --align 1024
bootloader --timeout=0 --append="rootwait rootfstype=ext3 video=vesafb vga=0x318 console=tty0"
Quoted 7 lines
And the user inspect this file
/var/tmp/wic/build/hdd/boot/syslinux.cfg, the 'root=' will be '/dev/mmcblk02' instead of '/dev/mmcblk0p2'.This patch add the support to constrain the disk and make the adjusts when mmcblk devices are used.
I am not sure if is not necessary to fix others places. Until now it's the single point.
I think this is a sub-optimal solution; we ought to add support for UUID as this is ensure to be stable across boot iterations; we cannot guarantee all kernels will enumerate the devices in same order, specially in DeviceTree time where this is async. There are some patches merged in master to partially address this issue for the grub and maybe you could see if a similar approach fits here as well.
Signature · 3 lines
Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
Hi Otavio
Quoted 5 lines · Otavio Salvador
Quoted 1 line
I am not sure if is not necessary to fix others places. Until now it's
the single point.
I think this is a sub-optimal solution; we ought to add support for UUID as this is ensure to be stable across boot iterations;
You mean filesystem UUID or GUID ?
I think the root= kernel param accept a valid GUID (<kernel>/init/do_mounts.c) not fs UUID.
wic has some code to support gpt partitions. So GUID will be passed to kernel root param (if the .wks was enable to it). I have never used but I am going to try.
The patch fixes the mbr partitions (which is the default of wic).
Thanks.
Signature · 2 lines
João Henrique Ferreira de Freitas - joaohf_at_gmail.com Campinas-SP-Brasil