Opened 13 years ago

Closed 13 years ago

#5211 closed bug (fixed)

[patch] detect host sfdisk

Reported by: mmadia Owned by: mmu_man
Priority: normal Milestone:
Component: Build System Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

u-boot/Jamfile#L147 currently hard codes SDIMAGE_FDISK on $(image) = /sbin/sfdisk ;

sfdisk doesn't reside in /sbin on all OS's. Example, /usr/local/sbin for FreeBSD.

The attached patch introduces a new variable HOST_SFDISK. In configure it first defaults to '=sfdisk'. Later in the file, configure attempts to find the binary in places that may be outside of the user's $PATH

Attachments (1)

ConfigureDetectSfdisk.patch (1.8 KB ) - added by mmadia 13 years ago.
Fixed typos. Introduced another variable to handle 'sfdisk-linux' for FreeBSD

Download all attachments as: .zip

Change History (6)

comment:1 by mmadia, 13 years ago

Milestone: R1
Owner: changed from bonefish to mmu_man
Status: newassigned
Version: R1/alpha1R1/Development

by mmadia, 13 years ago

Attachment: ConfigureDetectSfdisk.patch added

Fixed typos. Introduced another variable to handle 'sfdisk-linux' for FreeBSD

comment:2 by mmadia, 13 years ago

It seems FreeBSD's sfdisk is not the same as linux's sfdisk.

[FreeBSD]$ /usr/local/sbin/sfdisk 
usage: fdisk [-n] [-d] $disk

from u-boot/Jamfile:

echo -e '$(SDIMAGE_FDISK_SCRIPT)' | $(SDIMAGE_FDISK) -f -D \
		-H $(SDIMAGE_FDISK_H) -S $(SDIMAGE_FDISK_S) \
		-u$(SDIMAGE_FDISK_UNIT) $(<)

Turns out FreeBSD provides a sysutils/linuxfdisk/.

When the above attached patch is applied, the following is part of the output of jam -qj1 -sHAIKU_BOOT_BOARD=verdex haiku.mmc

BuildUBootSDImage1 haiku.mmc 
256+0 records in
256+0 records out
268435456 bytes transferred in 3.747654 secs (71627599 bytes/sec)
Warning: haiku.mmc is not a block device
Disk haiku.mmc: cannot get size
Disk haiku.mmc: cannot get geometry

Disk haiku.mmc: 0 cylinders, 255 heads, 63 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 haiku.mmc: unrecognized partition
Old situation:
No partitions found
Warning: given size (40) exceeds max allowable size (0)
New situation:
Units = mebibytes of 1048576 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start   End    MiB    #blocks   Id  System
haiku.mmc1         0+    39-    40-     40131    c  Win95 FAT32 (LBA)
haiku.mmc2         0      -      0          0   eb  BeOS fs
haiku.mmc3         0      -      0          0    0  Empty
haiku.mmc4         0      -      0          0    0  Empty
Warning: partition 2 has size 0 but is not marked Empty
Warning: partition 1 extends past end of disk
Successfully wrote the new partition table

Re-reading the partition table ...

If you created or changed a DOS partition, /dev/foo7, say, then use dd(1)
to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512 count=1
(See fdisk(8).)
Partitions 1 and 2 badly ordered or overlapping
Warning: inconsistent partition table
Possibly unpartitioned device

*** Maybe try without partition=1 in device definition ***

If this is a PCMCIA card, or a disk partitioned on another computer, this message may be in error: add mtools_skip_check=1 to your .mtoolsrc file to suppress this warning
Partitions 1 and 2 badly ordered or overlapping
Warning: inconsistent partition table
Possibly unpartitioned device

*** Maybe try without partition=1 in device definition ***

If this is a PCMCIA card, or a disk partitioned on another computer, this message may be in error: add mtools_skip_check=1 to your .mtoolsrc file to suppress this warning
...updated 46 target(s)...
[mmadia@amd-939 /storage/rewrite2/output/generated.arm]$

comment:3 by mmu_man, 13 years ago

Status: assignedin-progress

Patch applied in hrev34940.

comment:4 by mmu_man, 13 years ago

The first error and warnings are ok (the file is empty and thus doesn't contain any partition table). The last warnings seem to come from mtools and look suspicious.

comment:5 by mmadia, 13 years ago

Resolution: fixed
Status: in-progressclosed

Fixed with hrev34940 , 34941, and 34943 Thanks!

Note: See TracTickets for help on using tickets.