Re: Problem with iPod, not an MSDOS filesystem

2006-12-07 Thread Mikolaj Kucharski
On Wed, Dec 06, 2006 at 04:44:32AM +, Mikolaj Kucharski wrote:
 On Tue, Dec 05, 2006 at 09:27:39PM -0700, Chris Kuethe wrote:
  On 12/5/06, Mikolaj Kucharski [EMAIL PROTECTED] wrote:
  sd0 at scsibus1 targ 1 lun 0: Apple, iPod, 1.62 SCSI0 0/direct removable
  sd0: 76319MB, 19079 cyl, 64 head, 32 sec, 2048 bytes/sec, 39075372 sec 
  total
  
  80GB. Maybe it's one of the ipods with 2K sectors. Look in the
  archives for an experimental patch to possibly make this work.
 
 It looks like perfect answer. Thanks.
 
 http://marc.theaimsgroup.com/?t=11634568114r=1w=2

I used all patches from thread above (sd, msdosfs, and fdisk patch) and
iPod and fdisk are working like a charm. Thanks!

$ sysctl -n kern.version
OpenBSD 4.0-current (ACPI) #8: Wed Dec  6 03:34:00 MST 2006
[EMAIL PROTECTED]:/usr/src/sys/arch/i386/compile/ACPI


Patches attached in this mail too.

-- 
best regards
q#
Index: sbin/fdisk/cmd.c
===
RCS file: /cvs/src/sbin/fdisk/cmd.c,v
retrieving revision 1.42
diff -u -r1.42 cmd.c
--- sbin/fdisk/cmd.c2006/07/27 04:06:13 1.42
+++ sbin/fdisk/cmd.c2006/12/06 18:34:36
@@ -46,7 +46,7 @@
char buf[DEV_BSIZE];
 
/* Copy template MBR */
-   MBR_make(tt, buf);
+   MBR_make(tt, buf, disk-real-sec_size);
MBR_parse(disk, buf, mbr-offset, mbr-reloffset, mbr);
 
MBR_init(disk, mbr);
@@ -321,8 +321,8 @@
printf(Writing MBR at offset %d.\n, offset);
 
fd = DISK_open(disk-name, O_RDWR);
-   MBR_make(mbr, mbr_buf);
-   if (MBR_write(fd, offset, mbr_buf) != -1)
+   MBR_make(mbr, mbr_buf, disk-real-sec_size);
+   if (MBR_write(fd, offset, mbr_buf, disk-real-sec_size) != -1)
ret = CMD_CLEAN;
close(fd);
return (ret);
Index: sbin/fdisk/disk.c
===
RCS file: /cvs/src/sbin/fdisk/disk.c,v
retrieving revision 1.25
diff -u -r1.25 disk.c
--- sbin/fdisk/disk.c   2006/11/19 20:17:12 1.25
+++ sbin/fdisk/disk.c   2006/12/06 18:34:36
@@ -99,11 +99,21 @@
lm-heads = dl.d_ntracks;
lm-sectors = dl.d_nsectors;
lm-size = dl.d_secperunit;
+   lm-sec_size = dl.d_secsize;
unit_types[SECTORS].conversion = dl.d_secsize;
}
DISK_close(fd);
}
 
+   if (lm  lm-sec_size != 512  lm-sec_size != 1024 
+   lm-sec_size != 2048  lm-sec_size != 4096 
+   lm-sec_size != 8192) {
+
+   warnx(Invalid sector size %d, setting to %d, lm-sec_size,
+   DEV_BSIZE);
+   lm-sec_size = DEV_BSIZE;
+   }
+
return (lm);
 }
 
@@ -157,6 +167,7 @@
bm-heads = di.bios_heads;
bm-sectors = di.bios_sectors;
bm-size = di.bios_cylinders * di.bios_heads * di.bios_sectors;
+   bm-sec_size = DEV_BSIZE;
return (bm);
 }
 #else
@@ -187,6 +198,13 @@
disk-label = DISK_getlabelmetrics(disk-name);
disk-bios = DISK_getbiosmetrics(disk-name);
 
+   /*
+* If we have a disklabel, the kernel tells us what size sector
+* this raw device has.  As such, use it.  Yes, not pretty.
+*/
+   if (disk-label  disk-bios)
+   disk-bios-sec_size = disk-label-sec_size;
+
/* If user supplied, use that */
if (user) {
disk-real = user;
@@ -236,11 +254,12 @@
size = ((double)disk-real-size * unit_types[SECTORS].conversion) /
unit_types[i].conversion;
printf(Disk: %s\t, disk-name);
-   if (disk-real)
-   printf(geometry: %d/%d/%d [%.0f %s]\n, disk-real-cylinders,
+   if (disk-real) {
+   printf(geometry: %d/%d/%d [%.0f %s] , disk-real-cylinders,
disk-real-heads, disk-real-sectors, size,
unit_types[i].lname);
-   else
+   printf((%d byte sectors)\n, disk-real-sec_size);
+   } else
printf(geometry: none\n);
 
return (0);
Index: sbin/fdisk/disk.h
===
RCS file: /cvs/src/sbin/fdisk/disk.h,v
retrieving revision 1.8
diff -u -r1.8 disk.h
--- sbin/fdisk/disk.h   2004/08/03 09:22:03 1.8
+++ sbin/fdisk/disk.h   2006/12/06 18:34:36
@@ -34,6 +34,7 @@
u_int32_t heads;
u_int32_t sectors;
u_int32_t size;
+   u_int32_t sec_size;
 } DISK_metrics;
 
 typedef struct _disk_t {
Index: sbin/fdisk/fdisk.c
===
RCS file: /cvs/src/sbin/fdisk/fdisk.c,v
retrieving revision 1.46
diff -u -r1.46 fdisk.c
--- sbin/fdisk/fdisk.c  2006/11/09 00:01:10 1.46
+++ sbin/fdisk/fdisk.c  2006/12/06 18:34:43
@@ -78,8 +78,10 @@
char *mbrfile = NULL;
 #endif
mbr_t mbr;
-   char mbr_buf[DEV_BSIZE];
+   char mbr_buf[MBR_MAX_SIZE];
 
+   

Problem with iPod, not an MSDOS filesystem

2006-12-05 Thread Mikolaj Kucharski
Hi,

I have strange problem with mounting an iPod. On new device I have
this problem:


# cat /etc/fstab | grep ipod
/dev/sd0j /home/disks/ipod msdos rw,nodev,noexec,-u=mikolaj,-g=mikolaj,noauto 0 0
# mount /home/disks/ipod
mount_msdos: /dev/sd0j on /home/disks/ipod: not an MSDOS filesystem


# disklabel sd0
# /dev/rsd0c:
type: SCSI
disk: SCSI disk
label: iPod
flags:
bytes/sector: 2048
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 19079
total sectors: 39075372
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0   # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0 

16 partitions:
# sizeoffset  fstype [fsize bsize  cpg]
  c:  39075372 0  unused  0 0  # Cyl 0 - 19079*
  i: 6419763  unused  0 0  # Cyl 0*- 31*
  j:  39005820 64260   MSDOS   # Cyl31*- 19077*


sd0 at scsibus1 targ 1 lun 0: Apple, iPod, 1.62 SCSI0 0/direct removable
sd0: 76319MB, 19079 cyl, 64 head, 32 sec, 2048 bytes/sec, 39075372 sec total


I tried a nano version from a friend formated under Windows without any
problems. Any ideas?

# sysctl -n kern.version
OpenBSD 4.0-current (GENERIC) #7: Mon Nov 27 22:32:07 MST 2006
[EMAIL PROTECTED]:/usr/src/sys/arch/i386/compile/GENERIC

-- 
best regards
q#



Re: Problem with iPod, not an MSDOS filesystem

2006-12-05 Thread Tim Hoolihan
On 12/5/06, Mikolaj Kucharski [EMAIL PROTECTED] wrote:

 Hi,

 I have strange problem with mounting an iPod. On new device I have
 this problem:


 # cat /etc/fstab | grep ipod
 /dev/sd0j /home/disks/ipod msdos
 rw,nodev,noexec,-u=mikolaj,-g=mikolaj,noauto 0 0
 # mount /home/disks/ipod
 mount_msdos: /dev/sd0j on /home/disks/ipod: not an MSDOS filesystem


Are you sure it's a windows formatted ipod?  It might be  apple formatted in
which case you probably need to look into hfsplus in ports.
Good luck.



Re: Problem with iPod, not an MSDOS filesystem

2006-12-05 Thread Chris Kuethe

On 12/5/06, Mikolaj Kucharski [EMAIL PROTECTED] wrote:

sd0 at scsibus1 targ 1 lun 0: Apple, iPod, 1.62 SCSI0 0/direct removable
sd0: 76319MB, 19079 cyl, 64 head, 32 sec, 2048 bytes/sec, 39075372 sec total


80GB. Maybe it's one of the ipods with 2K sectors. Look in the
archives for an experimental patch to possibly make this work.

CK

--
GDB has a 'break' feature; why doesn't it have 'fix' too?



Re: Problem with iPod, not an MSDOS filesystem

2006-12-05 Thread Mikolaj Kucharski
On Tue, Dec 05, 2006 at 11:14:34PM -0500, Tim Hoolihan wrote:
 I have strange problem with mounting an iPod. On new device I have
 this problem:
 
 
 # cat /etc/fstab | grep ipod
 /dev/sd0j /home/disks/ipod msdos
 rw,nodev,noexec,-u=mikolaj,-g=mikolaj,noauto 0 0
 # mount /home/disks/ipod
 mount_msdos: /dev/sd0j on /home/disks/ipod: not an MSDOS filesystem
 
 Are you sure it's a windows formatted ipod?  It might be  apple formatted in
 which case you probably need to look into hfsplus in ports.

# file -sL /dev/sd0j
/dev/sd0j: x86 boot sector, code offset 0x3c, OEM-ID *UOKJIHC, \
Bytes/sector 2048, sectors/cluster 8, Media descriptor 0xf8, \
heads 255, hidden sectors 64260, sectors 39005818 (volumes  32 MB) , \
FAT (32 bit), sectors/FAT 9521, serial number 0x890cf46a, \
label: IPOD   

# newfs_msdos -F32 -L IPOD sd0j
[...]
# file -sL /dev/sd0j
/dev/sd0j: data

..and same problem like on the original filesystem: not an MSDOS
filesystem

-- 
best regards
q#



Re: Problem with iPod, not an MSDOS filesystem

2006-12-05 Thread Mikolaj Kucharski
On Tue, Dec 05, 2006 at 09:27:39PM -0700, Chris Kuethe wrote:
 On 12/5/06, Mikolaj Kucharski [EMAIL PROTECTED] wrote:
 sd0 at scsibus1 targ 1 lun 0: Apple, iPod, 1.62 SCSI0 0/direct removable
 sd0: 76319MB, 19079 cyl, 64 head, 32 sec, 2048 bytes/sec, 39075372 sec 
 total
 
 80GB. Maybe it's one of the ipods with 2K sectors. Look in the
 archives for an experimental patch to possibly make this work.

It looks like perfect answer. Thanks.

http://marc.theaimsgroup.com/?t=11634568114r=1w=2

-- 
best regards
q#