Re: [Freedos-user] very small FAT12 partition?

2010-01-25 Thread Christian Masloch
> - a boot block (MBR) containing a valid description of the FS (number and
>   size of FAT[s], CHS geometry, etc. - not all of which can be tuned
>   using standard tools probably) - "BIOS Parameter Block" is what
>   you want to look for (and compare against actual values in a
>   standard size floppy image)

The CHS information is usually ignored by the driver and might be bogus.  
It sure is ignored if the partition is accessed directly by the operating  
system (from a file or RAM or ROM). Note that the FAT file system  
internally uses a sector addressing scheme like LBA: there is a sector  
number that counts the sectors starting from zero. Nothing else. The FAT  
driver doesn't care about heads and cylinders that might be addressed at a  
lower level.

The boot block is also called boot sector, but not MBR (Master Boot  
Record). The MBR isn't contained in any partition.

> - one or two FATs (starting with the magic code), big enough for your  
> *data* blocks

You certainly want only one if you have to utilize a very small partition.

Regards,
Christian

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] very small FAT12 partition?

2010-01-25 Thread Steffen Grunewald
On Sun, Jan 24, 2010 at 02:48:13PM +0100, Stefan Xenon wrote:
> Hi!
> My question is not exactly FreeDos related but I hope that you could
> help me anyway:
> 
> For an embedded project I need to create a very small FAT12 partition.
> In a proprietary project I found a partition of 4KB size (which I can
> not reuse because of license issues) but could not manage to recreate a
> similar one. Therefore on Linux I tried "mkdosfs -f 1 -F 12 -h 0 -S 512
> -C partition.iso 4" but it fails with the error message that this
> partition is too small. The smallest I could build this way was 34KB in
> size.

This may be a bit tricky, and require the use of non-standard tools, but
in theory it should be possible.

Don't forget about the general structure of floppy-based FAT filesystems.
You need:
- a boot block (MBR) containing a valid description of the FS (number and
size of FAT[s], CHS geometry, etc. - not all of which can be tuned
using standard tools probably) - "BIOS Parameter Block" is what
you want to look for (and compare against actual values in a
standard size floppy image)
- one or two FATs (starting with the magic code), big enough for your *data*
blocks
- a root directory (size also fixed in boot block!)
- space for your data (and perhaps sub-directories which are data blocks
themselves)

Apologies for being a bit vague, but I didn't use such stuff for a while,
but I've written down some details (& my notes are at home, unfortunately).


Steffen

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] very small FAT12 partition?

2010-01-24 Thread Stefan Xenon
> Unless when you write "partition-files" or "partition container files" you're
> referring to an iso filesystem or iso file, I really don't know what you

You are right, this has nothing to do with ISO. Instead I mount the
partition container file via loop device after which it looks like a
normal device.

> Maybe "error message that this partition is too small" has something to do
> with the request if executed would not be capable of being transfered to
> partitionable media?

Well, at least it works for FAT12 partition container files of 34 KB in
size.

Regards
Jan

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] very small FAT12 partition?

2010-01-24 Thread Christian Masloch
Hi Stefan,

> My question is not exactly FreeDos related but I hope that you could
> help me anyway:
>
> For an embedded project I need to create a very small FAT12 partition.
> In a proprietary project I found a partition of 4KB size (which I can
> not reuse because of license issues) but could not manage to recreate a
> similar one. Therefore on Linux I tried "mkdosfs -f 1 -F 12 -h 0 -S 512
> -C partition.iso 4" but it fails with the error message that this
> partition is too small. The smallest I could build this way was 34KB in
> size.
>
> Could you give me any hint how to create a partition smaller than 34 KB?

If there's no tool to do what you want, you might be able to create it  
yourself with an assembler. For this, I found a nice NASM (the Netwide  
Assembler, at http://www.nasm.us/) macro to create FAT12 images on this  
german blog:

http://superschurke.wordpress.com/2006/06/09/mit-nasm-fat12-images-erstellen/#more-5

(Don't worry, you should be able to copy and read the code without  
problems even in case you don't speak german. Though if you need a  
translation, don't hesitate to ask me for it.)

Regards,
Christian

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] very small FAT12 partition?

2010-01-24 Thread Felix Miata
On 2010/01/24 17:53 (GMT+0100) Stefan Xenon composed:

> I want to make clear that I need the described file system in a
> partition-files so that it is not directly on a hard disk. Mkdosfs seems
> to create such partition files directly with the provided parameters
> noted in my previous post - at least it works for me.

> So I assume your tips on heady and cylinders is not transferable to
> partition container files?

Unless when you write "partition-files" or "partition container files" you're
referring to an iso filesystem or iso file, I really don't know what you
mean. I've been partitioning and creating filesystems well over a decade, and
can't recall ever running across those terms used that way before.

Maybe "error message that this partition is too small" has something to do
with the request if executed would not be capable of being transfered to
partitionable media?
-- 
"Our Constitution was made only for a moral and religious
people. It is wholly inadequate to the government of any
other."  John Adams, 2nd US President

 Team OS/2 ** Reg. Linux User #211409

Felix Miata  ***  http://fm.no-ip.com/

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] very small FAT12 partition?

2010-01-24 Thread Stefan Xenon
Hi Felix and thanks for your answer!

I want to make clear that I need the described file system in a
partition-files so that it is not directly on a hard disk. Mkdosfs seems
to create such partition files directly with the provided parameters
noted in my previous post - at least it works for me.

So I assume your tips on heady and cylinders is not transferable to
partition container files?

Regards
Stefan

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user


Re: [Freedos-user] very small FAT12 partition?

2010-01-24 Thread Felix Miata
On 2010/01/24 14:48 (GMT+0100) Stefan Xenon composed:

> For an embedded project I need to create a very small FAT12 partition.
> In a proprietary project I found a partition of 4KB size (which I can
> not reuse because of license issues) but could not manage to recreate a
> similar one. Therefore on Linux I tried "mkdosfs -f 1 -F 12 -h 0 -S 512
> -C partition.iso 4" but it fails with the error message that this
> partition is too small. The smallest I could build this way was 34KB in
> size.

mkdosfs only creates a filesystem on an already existing partition. It cannot
create a partition.

> Could you give me any hint how to create a partition smaller than 34 KB?

This is easier said than done on modern disks. DOS-compatible partitioners
normally define a "cylinder" as the smallest possible partition size, and a
"boundary" as the first sector following a "cylinder" multiple. A "cylinder"
is defined as

heads X sectors X 512

On contemporary hard drives this is usually one of the following:

255 X 63 X 512 = 8,225,280 bytes = 8,032.5 KiB (usually desktop HDs)
240 X 63 X 512 = 7,741,440 bytes = 7,560 KiB (usually laptop HDs)

To create a smaller partition than one "cylinder" requires use of a
partitioning program capable of defining a partition that does not end on a
"boundary". No DOS executables I'm aware of can do this. Some of the Linux
tools can, possibly disk druid, cfdisk or sfdisk, but the result will
probably be that any further attempts to partition with a DOS compatible tool
will halt with an error message about corrupt partition table or illegal
partition table.

Possible ways around the problem are disks much smaller than common today,
such that a "cylinder" is much smaller than 7-8M. By "smaller" I mean
something in the 80 MiB (not GiB) or smaller range. Possibly a 64M CFlash
chip or other tiny solid state media would work.

Personally I don't remember ever creating a partition smaller than about 1 MiB.
-- 
"Our Constitution was made only for a moral and religious
people. It is wholly inadequate to the government of any
other."  John Adams, 2nd US President

 Team OS/2 ** Reg. Linux User #211409

Felix Miata  ***  http://fm.no-ip.com/

--
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
___
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user