Discussion:
[yocto] wic creates invalid image
Donal Morrissey
2018-11-13 19:12:23 UTC
Permalink
Hi There,
I have a problem with an image being created by wic. If I add more than 4
partition definitions to the wks file, the generated image will include an
additional partition with no Fstype, and spanning the full length of the
additional partitions.

Take the following wks file:

part --source rawcopy --sourceparams="file=<long path>/image-r0/uboot.env"
--ondisk "mmcblk0" --align 4096 --no-table
part --source bootimg-partition --ondisk "mmcblk0" --fstype=vfat --label
boot --align 4096 --active --fixed-size 40
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label primary
--align 4096 --fixed-size 147456k --exclude-path data/
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label secondary
--align 4096 --fixed-size 147456k --exclude-path data/
part --ondisk "mmcblk0" --fstype=ext4 --label appdata1 --align 4096
--fixed-size 147456k
part --ondisk "mmcblk0" --fstype=ext4 --label appdata2 --align 4096
--fixed-size 147456k
bootloader --ptable msdos

wic will create a .direct file with the following structure:
Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 360709632 666894335 306184704
5 360710144 511705087 150994944 ext4
6 515899392 666894335 150994944 ext4

Note the start and end addresses of partition 4, it spans from the start of
partitions 5 (appdata1) to the end of partition 6 (appdata2).

If I modify the wks file and remove the entry for appdata2, the created
direct file is valid:

Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 356515840 507510783 150994944 ext4

Any suggestions on what is going on here?

Cheers,
Donal
Alex Kiernan
2018-11-13 19:22:44 UTC
Permalink
On Tue, Nov 13, 2018 at 7:13 PM Donal Morrissey
Post by Donal Morrissey
Hi There,
I have a problem with an image being created by wic. If I add more than 4 partition definitions to the wks file, the generated image will include an additional partition with no Fstype, and spanning the full length of the additional partitions.
part --source rawcopy --sourceparams="file=<long path>/image-r0/uboot.env" --ondisk "mmcblk0" --align 4096 --no-table
part --source bootimg-partition --ondisk "mmcblk0" --fstype=vfat --label boot --align 4096 --active --fixed-size 40
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label primary --align 4096 --fixed-size 147456k --exclude-path data/
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label secondary --align 4096 --fixed-size 147456k --exclude-path data/
part --ondisk "mmcblk0" --fstype=ext4 --label appdata1 --align 4096 --fixed-size 147456k
part --ondisk "mmcblk0" --fstype=ext4 --label appdata2 --align 4096 --fixed-size 147456k
bootloader --ptable msdos
Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 360709632 666894335 306184704
5 360710144 511705087 150994944 ext4
6 515899392 666894335 150994944 ext4
Note the start and end addresses of partition 4, it spans from the start of partitions 5 (appdata1) to the end of partition 6 (appdata2).
Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 356515840 507510783 150994944 ext4
Any suggestions on what is going on here?
I've not checked, but I'd assume it's switched to extended partitions,
since MBR only has 4 primary partitions.
--
Alex Kiernan
--
Dimitris Tassopoulos
2018-11-13 19:29:11 UTC
Permalink
Hi Alex,

If you don't want the extended partitions you need to create a gpt
partition, you can do this by adding this to your wks file.

bootloader --ptable gpt

Regards,
Dimitris
Post by Alex Kiernan
On Tue, Nov 13, 2018 at 7:13 PM Donal Morrissey
Post by Donal Morrissey
Hi There,
I have a problem with an image being created by wic. If I add more than
4 partition definitions to the wks file, the generated image will include
an additional partition with no Fstype, and spanning the full length of the
additional partitions.
Post by Donal Morrissey
part --source rawcopy --sourceparams="file=<long
path>/image-r0/uboot.env" --ondisk "mmcblk0" --align 4096 --no-table
Post by Donal Morrissey
part --source bootimg-partition --ondisk "mmcblk0" --fstype=vfat --label
boot --align 4096 --active --fixed-size 40
Post by Donal Morrissey
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label primary
--align 4096 --fixed-size 147456k --exclude-path data/
Post by Donal Morrissey
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label secondary
--align 4096 --fixed-size 147456k --exclude-path data/
Post by Donal Morrissey
part --ondisk "mmcblk0" --fstype=ext4 --label appdata1 --align 4096
--fixed-size 147456k
Post by Donal Morrissey
part --ondisk "mmcblk0" --fstype=ext4 --label appdata2 --align 4096
--fixed-size 147456k
Post by Donal Morrissey
bootloader --ptable msdos
Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 360709632 666894335 306184704
5 360710144 511705087 150994944 ext4
6 515899392 666894335 150994944 ext4
Note the start and end addresses of partition 4, it spans from the start
of partitions 5 (appdata1) to the end of partition 6 (appdata2).
Post by Donal Morrissey
If I modify the wks file and remove the entry for appdata2, the created
Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 356515840 507510783 150994944 ext4
Any suggestions on what is going on here?
I've not checked, but I'd assume it's switched to extended partitions,
since MBR only has 4 primary partitions.
--
Alex Kiernan
--
_______________________________________________
yocto mailing list
https://lists.yoctoproject.org/listinfo/yocto
Donal Morrissey
2018-11-14 15:32:27 UTC
Permalink
Hi Alex & Dimitris,
Thank you for the info.
I tried to use gpt partition table as you suggested, but the raspberry pi
compute module 3 I am using wouldn't boot, so i switched back to mbr/msdos.
Now that I understand the origin of the extra extended partition, I can
work around it.
best regards,
Donal
Post by Dimitris Tassopoulos
Hi Alex,
If you don't want the extended partitions you need to create a gpt
partition, you can do this by adding this to your wks file.
bootloader --ptable gpt
Regards,
Dimitris
Post by Alex Kiernan
On Tue, Nov 13, 2018 at 7:13 PM Donal Morrissey
Post by Donal Morrissey
Hi There,
I have a problem with an image being created by wic. If I add more than
4 partition definitions to the wks file, the generated image will include
an additional partition with no Fstype, and spanning the full length of the
additional partitions.
Post by Donal Morrissey
part --source rawcopy --sourceparams="file=<long
path>/image-r0/uboot.env" --ondisk "mmcblk0" --align 4096 --no-table
Post by Donal Morrissey
part --source bootimg-partition --ondisk "mmcblk0" --fstype=vfat
--label boot --align 4096 --active --fixed-size 40
Post by Donal Morrissey
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label primary
--align 4096 --fixed-size 147456k --exclude-path data/
Post by Donal Morrissey
part --source rootfs --ondisk "mmcblk0" --fstype=ext4 --label secondary
--align 4096 --fixed-size 147456k --exclude-path data/
Post by Donal Morrissey
part --ondisk "mmcblk0" --fstype=ext4 --label appdata1 --align 4096
--fixed-size 147456k
Post by Donal Morrissey
part --ondisk "mmcblk0" --fstype=ext4 --label appdata2 --align 4096
--fixed-size 147456k
Post by Donal Morrissey
bootloader --ptable msdos
Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 360709632 666894335 306184704
5 360710144 511705087 150994944 ext4
6 515899392 666894335 150994944 ext4
Note the start and end addresses of partition 4, it spans from the
start of partitions 5 (appdata1) to the end of partition 6 (appdata2).
Post by Donal Morrissey
If I modify the wks file and remove the entry for appdata2, the created
Num Start End Size Fstype
1 12582912 54525951 41943040 fat16
2 54525952 205520895 150994944 ext4
3 205520896 356515839 150994944 ext4
4 356515840 507510783 150994944 ext4
Any suggestions on what is going on here?
I've not checked, but I'd assume it's switched to extended partitions,
since MBR only has 4 primary partitions.
--
Alex Kiernan
--
_______________________________________________
yocto mailing list
https://lists.yoctoproject.org/listinfo/yocto
Loading...