Hi, following is a series of patches derived from my proposed diff. Based on syslinux-6.03-pre1, but should also apply down to 4.xx. I hope to have imitated the changelog style sufficiently. Mine are a bit longer than usual with patches in the archive, i fear. Instructions for the future are welcome. Each intermediate state is tested for its designated purpose only. The final state after applying all patches is tested with various options, suitable and unsuitable file types of various sizes. ---------------------------------------------------------------- I will think about another patch for an option which zeroizes the whole device even if the partition size is given explicitely and matches a cylinder end. (mkdiskimage_05.patch only zeroizes a known incomplete cylinder after the partition end.) Although mkdiskimage should be suitable now for USB sticks on unix-like systems beyond Linux, i still have no clue about USB sticks at NT/2K/XP/DOS systems. There is hope that the sysseek() method of size determination will work with a suitable file object. If only it has an address for sysopen(). Have a nice day :) Thomas
Thomas Schmitt
2014-Jan-30 20:55 UTC
[syslinux] [PATCH 01/05] utils/mkdiskimage.in: Option -s caused freshly created image files to be too small by a factor of 512.
utils/mkdiskimage.in: Option -s caused freshly created image files to be too small by a factor of 512. --- utils/mkdiskimage_orig.in 2014-01-23 12:23:34.000000000 +0100 +++ utils/mkdiskimage.in 2014-01-30 20:35:13.000000000 +0100 @@ -218,7 +218,7 @@ $totalsize = $c*$h*$s; $tracks = $c*$h; # If -s is given, try to simply use truncate... -unless ($opt{'s'} && truncate(OUTPUT, $totalsize)) { +unless ($opt{'s'} && truncate(OUTPUT, $totalsize * 512)) { $track = "\0" x (512*$s); # Print fractional track
Thomas Schmitt
2014-Jan-30 20:59 UTC
[syslinux] [PATCH 02/05] utils/mkdiskimage.in: With option -s: Avoid zeroizing the partition even if truncate() failed
utils/mkdiskimage.in: With option -s: Avoid zeroizing the partition even if truncate() failed. --- utils/mkdiskimage_patched_01.in 2014-01-30 20:43:02.000000000 +0100 +++ utils/mkdiskimage.in 2014-01-30 20:45:09.000000000 +0100 @@ -217,8 +217,11 @@ print OUTPUT "\x55\xaa"; $totalsize = $c*$h*$s; $tracks = $c*$h; -# If -s is given, try to simply use truncate... -unless ($opt{'s'} && truncate(OUTPUT, $totalsize * 512)) { +# If -s is given, simply use truncate. Do not care for success. Failure is +# normal with Linux block devices. +if ($opt{'s'}) { + truncate(OUTPUT, $totalsize * 512); +} else { $track = "\0" x (512*$s); # Print fractional track
Op 2014-01-30 om 21:54 schreef Thomas Schmitt:> Hi, > > following is a series of patches derived from my proposed diff. > Based on syslinux-6.03-pre1, but should also apply down to 4.xx. > > I hope to have imitated the changelog style sufficiently. > Mine are a bit longer than usual with patches in the archive, i fear.Yes, they are long.> Instructions for the future are welcome.A few weeks ago we did some hand-ons training with a new series of patches. That learning-by-doing was somehow pushed/helped/guided by having these patch series in the e-mail backlog. I'll repost the patches in a format that can be processed with a tool like `git am` which does "apply patch" and "add commit message". Please feel free to ask again for feedback on provided patches. Don't worry about somebodies else email-backlog, just show that you care.> Each intermediate state is tested for its designated purpose only. > The final state after applying all patches is tested with various > options, suitable and unsuitable file types of various sizes. > > ---------------------------------------------------------------- > > I will think about another patch for an option which zeroizes > the whole device even if the partition size is given explicitely > and matches a cylinder end. (mkdiskimage_05.patch only zeroizes > a known incomplete cylinder after the partition end.) > > Although mkdiskimage should be suitable now for USB sticks > on unix-like systems beyond Linux, i still have no clue about > USB sticks at NT/2K/XP/DOS systems. > There is hope that the sysseek() method of size determination > will work with a suitable file object. If only it has an address > for sysopen(). > > > Have a nice day :) > > Thomas >Groeten Geert Stappers -- Leven en laten leven
Thomas Schmitt
2014-Jul-10 19:21 UTC
[syslinux] [PATCH 1/5] utils/mkdiskimage.in: Option -s caused freshly created image files to be too small by a factor of 512.
--- utils/mkdiskimage.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/mkdiskimage.in b/utils/mkdiskimage.in index 533193a..a95a077 100644 --- a/utils/mkdiskimage.in +++ b/utils/mkdiskimage.in @@ -218,7 +218,7 @@ $totalsize = $c*$h*$s; $tracks = $c*$h; # If -s is given, try to simply use truncate... -unless ($opt{'s'} && truncate(OUTPUT, $totalsize)) { +unless ($opt{'s'} && truncate(OUTPUT, $totalsize * 512)) { $track = "\0" x (512*$s); # Print fractional track -- 2.0.0
On 07/10/2014 12:18 PM, Geert Stappers wrote:>> >> following is a series of patches derived from my proposed diff. >> Based on syslinux-6.03-pre1, but should also apply down to 4.xx. >> >> I hope to have imitated the changelog style sufficiently. >> Mine are a bit longer than usual with patches in the archive, i fear. > > Yes, they are long. >There seems to be no patch descriptions at all, which would really help long-term maintainability. -hpa
Possibly Parallel Threads
- [PATCH 1/5] utils/mkdiskimage.in: Option -s caused freshly created image files to be too small by a factor of 512.
- [PATCH] Proposal for a pacifier option with mkdiskimage
- [PATCH] Mending proposals for mkdiskimage
- [PATCH] Proposal for a pacifier option with mkdiskimage
- [PATCH 00/05] Mending for mkdiskimage