Date: Wed, 23 May 2007 09:18:49 +0300 From: Krassimir Slavchev <krassi@bulinfo.net> To: Warner Losh <imp@bsdimp.com> Cc: freebsd-embedded@FreeBSD.org Subject: Re: [nanobsd] Calculation of new flash image size Message-ID: <4653DCC9.5060108@bulinfo.net> In-Reply-To: <20070522.094257.74690293.imp@bsdimp.com> References: <465233FF.8060100@miralink.com> <20070522.094257.74690293.imp@bsdimp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
What about diskinfo? I always use output from diskinfo -v without any problems. Warner Losh wrote: > From: Sean Bruno <sbruno@miralink.com> > Subject: [nanobsd] Calculation of new flash image size > Date: Mon, 21 May 2007 17:06:23 -0700 > > >> If the manufacturer doesn't provide me with the specific values for >> NANO_SECTS, NANO_HEADS and NANO_MEDIASIZE, I assume that I would be able >> to use the output of fdisk to calculate it for me: >> >> fmybox# fdisk /dev/ad0 >> ******* Working on device /dev/ad0 ******* >> parameters extracted from in-core disklabel are: >> cylinders=993 heads=16 sectors/track=63 (1008 blks/cyl) >> >> parameters to be used for BIOS calculations are: >> cylinders=993 heads=16 sectors/track=63 (1008 blks/cyl) >> >> >> So in this case, NANO_SECTS=63, NANO_HEADS=16 and NANO_MEDIASIZE=(993 * >> 16 * 63)=1000944? >> >> I added the following to Flashdevices.sub: >> >> dom512m) >> # Source: sbruno@miralink.com >> NANO_MEDIASIZE=`expr 512483328 / 512` >> NANO_HEADS=16 >> NANO_SECTS=63 >> ;; >> > > The flashdevices.sub database is lame. It is a misfeature to require > it. > > >> If I do this for my new Transcend module, the system won't boot properly >> and freezes on the BTX boot loader startup. >> >> What am I doing wrong here? >> > > There's a fundamental flaw in nanobsd. That is that it requires one > to know the geometry of the target device. fdisk won't tell you this > when you are using a scsi card reader, so you can't find it out > automatically. This is because the scsi layer uses a fake geometry > here (I can't recall if it is FreeBSD software, or the card reader). > Nanobsd is supposed to use 'packet mode' so that geometry doesn't > matter. You should make sure that the CF/disk created is in packet > mode. > > If you have a card that you've re-fdisked since you bought it, dd > about 30k of zeros to the front of it from /dev/zero. Then insert it > into a camera that can do the formatting of flash cards. Put that > back into your freebsd box and run fdisk again and see what the > partitions look like. > > You'll see something that looks like: > > fdisk da0 > > ******* Working on device /dev/da0 ******* > parameters extracted from in-core disklabel are: > cylinders=CCC heads=HHH sectors/track=SSS (SSS * HHH blks/cyl) > > Figures below won't work with BIOS for partitions not in cyl 1 > parameters to be used for BIOS calculations are: > cylinders=CCC heads=HHH sectors/track=SSS (SSS * HHH blks/cyl) > > Media sector size is 512 > Warning: BIOS sector numbering starts with sector 1 > Information from DOS bootblock is: > The data for partition 1 is: > sysid 6 (0x6),(Primary 'big' DOS (>= 32MB) > start SSS, size XXX (YYY Meg), flag 80 (active) > beg: cyl 0/ head 1/ sector 1; > end: cyl CCC/ head HHH/ sector SSS > The data for partition 2 is: > <UNUSED> > The data for partition 3 is: > <UNUSED> > The data for partition 4 is: > <UNUSED> > > CCC, HHH and SSS are the numbers you need. > > Also, you can put this card in your target device and look at the BIOS > in that target device. It will tell you what it thinks it is. > > Warner > _______________________________________________ > freebsd-embedded@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-embedded > To unsubscribe, send any mail to "freebsd-embedded-unsubscribe@freebsd.org" > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4653DCC9.5060108>