From owner-freebsd-arm@FreeBSD.ORG Mon Oct 24 23:15:23 2011 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2F9B6106564A for ; Mon, 24 Oct 2011 23:15:23 +0000 (UTC) (envelope-from mrossi@swin.edu.au) Received: from gpo4.cc.swin.edu.au (gpo4.cc.swin.edu.au [136.186.1.33]) by mx1.freebsd.org (Postfix) with ESMTP id BB1F78FC0A for ; Mon, 24 Oct 2011 23:15:22 +0000 (UTC) Received: from mrossi.caia.swin.edu.au (mrossi.caia.swin.edu.au [136.186.229.109]) by gpo4.cc.swin.edu.au (8.14.3/8.14.3) with ESMTP id p9ONF15k000616; Tue, 25 Oct 2011 10:15:02 +1100 Message-ID: <4EA5F175.1070209@swin.edu.au> Date: Tue, 25 Oct 2011 10:15:01 +1100 From: Mattia Rossi User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:7.0.1) Gecko/20111004 Thunderbird/7.0.1 MIME-Version: 1.0 To: Ian Lepore References: <4E9290FF.7090306@swin.edu.au> <4E92D2D8.8070500@swin.edu.au> <4E9535D0.2030706@swin.edu.au> <4E9669CB.2060707@swin.edu.au> <1318783802.2245.8.camel@revolution.hippie.lan> In-Reply-To: <1318783802.2245.8.camel@revolution.hippie.lan> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-arm@freebsd.org Subject: Re: Create FAT partition/filesystem on the internal microSD flash of the Dreamplug X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2011 23:15:23 -0000 Hi Ian, I finally came around to test the attached patch for newfs_msdosfs on the dreamplug, and I can confirm that it works! It also still works on i386/x86_64 and the disk formatted on ARM is recognised properly on all systems. Is it still possible to commit this patch to 9? I believe it's a very useful and non problematic commit. Mat On 17/10/2011 03:50, Ian Lepore wrote: > On Thu, 2011-10-13 at 15:32 +1100, Mattia Rossi wrote: >> On 13/10/11 02:06, Warner Losh wrote: >>> >>> On Oct 12, 2011, at 12:38 AM, Mattia Rossi wrote: >>> >>>> -snip- >>>>>>> I've tried to recreate it using gpart and newfs_msdos, but can't >>>>>>> create any new FAT partition that mount_msdosfs would mount. >>>>>>> [snip] > > This turned out to be a difference in structure packing (it's something > that happens a lot with ARM). The patch below should get it working for > you. > > Funny aside: I opened newfs_msdos.c and within 90 seconds knew what was > wrong and how to fix it. It then took me over an hour to prove to > myself that my fix was right -- the mount was failing because I forgot > to put "option MSDOSFS" in my kernel config (and we always build our > systems with no .ko modules at all). > > -- Ian > > diff -r 0e647646c002 sbin/newfs_msdos/newfs_msdos.c > --- sbin/newfs_msdos/newfs_msdos.c.orig Thu Sep 29 08:39:38 2011 -0600 > +++ sbin/newfs_msdos/newfs_msdos.c Sun Oct 16 10:40:07 2011 -0600 > @@ -98,7 +98,7 @@ static const char rcsid[] = > struct bs { > u_int8_t bsJump[3]; /* bootstrap entry point */ > u_int8_t bsOemName[8]; /* OEM name and version */ > -}; > +} __packed; > > struct bsbpb { > u_int8_t bpbBytesPerSec[2]; /* bytes per sector */ > @@ -113,7 +113,7 @@ struct bsbpb { > u_int8_t bpbHeads[2]; /* drive heads */ > u_int8_t bpbHiddenSecs[4]; /* hidden sectors */ > u_int8_t bpbHugeSectors[4]; /* big total sectors */ > -}; > +} __packed; > > struct bsxbpb { > u_int8_t bpbBigFATsecs[4]; /* big sectors per FAT */ > @@ -123,7 +123,7 @@ struct bsxbpb { > u_int8_t bpbFSInfo[2]; /* file system info sector */ > u_int8_t bpbBackup[2]; /* backup boot sector */ > u_int8_t bpbReserved[12]; /* reserved */ > -}; > +} __packed; > > struct bsx { > u_int8_t exDriveNumber; /* drive number */ > @@ -132,7 +132,7 @@ struct bsx { > u_int8_t exVolumeID[4]; /* volume ID number */ > u_int8_t exVolumeLabel[11]; /* volume label */ > u_int8_t exFileSysType[8]; /* file system type */ > -}; > +} __packed; > > struct de { > u_int8_t deName[11]; /* name and extension */ > @@ -142,7 +142,7 @@ struct de { > u_int8_t deMDate[2]; /* creation date */ > u_int8_t deStartCluster[2]; /* starting cluster */ > u_int8_t deFileSize[4]; /* size */ > -}; > +} __packed; > > struct bpb { > u_int bpbBytesPerSec; /* bytes per sector */ > > >