public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* GRUB on DoC Millennium/2000 - Instructions
@ 2002-06-18 16:43 Mark Meade
  2002-06-18 18:41 ` David Woodhouse
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Meade @ 2002-06-18 16:43 UTC (permalink / raw)
  To: linux-mtd

[-- Attachment #1: Type: text/plain, Size: 779 bytes --]

watsup@linuxmail.org wrote:

>  i have learnt from the list that we need to make room for GRUB on DOC
> ,how do i do that,david suggested to use DFORMAT,can any1 give me the
> exact cmd to do that? i dont want to use ntfl_format due to poor block
> handling

Dzuy Nguyen wrote:

> What is the status on GRUB and DoC Millenium?  I've read the posts in
> the archive but it seems that people
> have had mixed results with using GRUB to boot DoC Millenium.

In response to these questions, as well as others, I wrote up some 
instructions on how to get GRUB booting on a DoC Millennium.  The procedure 
for the DoC 2000 should be similar.

I hope this helps -- anyone who has already been successful in getting GRUB 
to boot, please let me know of any errors or omissions.

Mark




[-- Attachment #2: doc-grub.txt --]
[-- Type: text/x-c, Size: 8634 bytes --]

Booting GRUB on the DiskOnChip Millennium

1.  Preliminaries

The following procedure was done on a desktop PC, using an 8MB DoC Millennium and the M-Sys ISA Evaluation card.  A DOS partition was used to run the M-Sys utilities, prior to installing GRUB.   This procedure *might* work with a DoC 2000 -- but it has not been verified.

The Linux kernel must have the following MTD options either built-in or compiled as modules:

	MTD Support: MTD, Debugging, Direct char device access, NFTL, NTFL write support

		CONFIG_MTD=y
		CONFIG_MTD_DEBUG=y
		CONFIG_MTD_CHAR=y
		CONFIG_NFTL=y
 		CONFIG_NFTL_RW=y

	Self-contained MTD Device Drivers: M-Systems DiskOnChip 2000 and Millennium

		CONFIG_MTD_DOC2000=y  
 		CONFIG_MTD_DOCPROBE=y

In the following examples, a 2.4.18 kernel called "vmlinuz-doc" with the above MTD options built-in was used.

2.  Save DoC contents, and the Bad Block Table

Get the latest version of the DOS based M-Systems DiskOnChip Software Utilities from www.m-sys.com.  If desired, the GETIMAGE utility can be used to save the current contents of the DoC:

	getimage /win:xxxx <filename>

(where xxxx is the DoC base memory address in hex (window), for example: /win:d000)

**IMPORTANT**: Save the Bad Block Table!  Before attempting to boot with GRUB, make sure that the bad block table has been saved.  Doing this insures you can always restore the BBT in the event of the DoC being corrupted or completely erased:

	dformat /win:xxxx /noformat /log:<filename.txt>

This creates a text file containing a list of all the bad blocks on the DoC.   The dformat "uselog" option may be used to restore the BBT if needed.

	dinfo /BBT

will also display some detailed information about the DoC and the bad block table.  

3.  Verify TrueFFS Driver Version

The newer versions (5.0 or later) of the M-Systems DOC firmware may not work correctly with the latest version of the MTD drivers. This has something to do with the "UnitSizeFactor != 1" problem documented elsewhere.  An earlier version (4.2) seems to work fine.

Using version 4.2 of the DOS TrueFFS utilities available from M-Systems (www.m-sys.com), verify that the DOC is recognized, and that the firmware version is 4.2:

	dinfo

If the firmware version is 5.0 or later, run the DFORMAT utility:

	dformat /win:xxxx /s:doc42.exb

4.  Patch and compile GRUB

Get the latest grub sources:

	mkdir grub-doc
	cd grub-doc
	ftp alpha.gnu.org
	cd gnu/grub
	get grub-0.92.tar.gz
	tar xzvf grub-0.92.tar.gz

Get the latest MTD sources:

	cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs login 
	(password = anoncvs)
	cvs -z3 -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co mtd

Patch GRUB with DiskOnChip updates:

	cd grub-0.92
	patch -p0 -i ../mtd/patches/grub-2002-02-19-doc.patch

This patch may fail on the "ChangeLog" file, but all other files should patch correctly.  The 2002-02-19-doc patch was originally a patch against grub version 0.90.

5.  Build GRUB:

	aclocal && automake && autoconf

If there are any error messages here, you'll probably need up update automake and autoconf to the latest versions.

	./configure --enable-diskonchip-mil512 --enable-ext2fs --enable-diskonchip-biosnetboot \
		--disable-ffs --disable-xfs --disable-jfs --disable-vstafs --disable-reiserfs --disable-minix --disable-fat
	make

See "README_DiskOnChip" for more information regarding the ./configure options, specifically the difference between "-mil256" and "-mil512".

6.  Copy GRUB to DOC

	cd ../mtd/util
	make doc_loadbios
	./doc_loadbios /dev/mtd0 ../../grub-0.92/stage1/grub_firmware

If an error is reported regarding /dev/mtd0, you might need to run the ./MAKEDEV script to create the proper device MTD device entries in the /dev directory.

7.  TURN OFF PC!

**IMPORTANT** - The PC should be turned off (not just rebooted) after running doc_loadbios.  This may not be necessary on all types of hardware, but it was required on my PC.  From M-Systems application note DOC-044:

The boot block is implemented as a XIP block located between the flash media and the system bus.  After the DiskOnChip Millennium powers-on, or when its reset signal is negated, the contents of the first page of flash memory are copied into the Boot Block.

The "doc_loadbios" utility copies data to this first page of flash memory.  My PC must not be "negating the reset signal" to the DoC on a normal reboot -- a full power cycle is required to copy the flash memory to the boot block.

8.  Change Boot Sequence

In the BIOS setup, select NETWORK (or NIC, or its equivalent) as the first boot device.

Selecting "--enable-diskonchip-biosnetboot" causes the GRUB/DoC code to hook INT 18H, which is historically known as the "BASIC interrupt" or "Diskless Boot Interrupt".  Using this option with the DoC on a PC is useful because you change easily change the boot sequence back to the hard drive when needed.

If the BIOS does not have a NETWORK boot option, it may be possible to disable the "biosnetboot" option, rebuild GRUB, and copy grub_firmware to the DoC again.  In this case, the GRUB/DoC code will hook the INT 19H (bootstrap) handler.  This doesn't work at all on my PC, but theoretically it should override any boot sequence options in the BIOS setup.  

The downside of this option (in a PC environment, anyway) is that you may need to physically remove the DoC (or eval-board) to get the PC to boot from the hard drive again.  If that happens, it may be necessary to reinstall the DoC *after* the PC has booted, into a powered up eval board.  Of course, this is *not* recommended, but it has been done...

9.  Verify GRUB boot

The PC should now boot from the DiskOnChip.  The BIOS may say something like "Searching for boot record from Network...".  The first DoC messages displayed should be:

	DoC Mil D000
	Jumping to Grub
	DiskOnChip Millennium found at d0000

Where D000 is the "window" described earlier.

When the boot process completes, there should be a "grub>" command line.  We haven't installed a kernel or a "menu.lst" file on the DiskOnChip yet, so this step is just to verify that the "grub_firmware" was installed correctly, and that the DoC will boot.

At this point, you can either reboot again, change the boot sequence back to IDE (or whatever), and boot back into Linux.  Alternatively, if you know where your kernel and root filesystem is on the hard drive, simply type something like:

	kernel (hd0,0)/vmlinuz-doc root=/dev/hda2
	boot

10.  Partition the DiskOnChip

	fdisk /dev/nftla

If /dev/nftla is recognized, there will probably be one FAT12 partition on the DiskOnChip.  In this case, it won't be necessary to run the Linux "nftl_format" or "eraseall" utilities.  Use fdisk to delete this partition, and continue with step #11.

NOTE:  The "eraseall" utility can be dangerous as it will complete erase the DoC, including the bad block table -- saving the BBT as described in step #2 is highly recommended.

If /dev/ntfla is NOT recognized, use the nftl_format program:

	./nftl_format /dev/mtd0 98304

The "start offset" of 98304 insures that the grub_firmware is not overwritten.  As nftl_format runs, there should be notices about "skipping bad zone (factory marked)".  The bad zone values should be identical to the values in the file created in step #2.

After nftl_format is complete, reboot the PC.

11.  Create ext2 partition

To boot directly from the DoC, we'll need to create an ext2 partition, and install the kernel and GRUB menu.lst file:

	fdisk /dev/nftla		
	n p 1 <enter> <enter>	(create new primary partition, using defaults)
	w			(save new partition info)

	mke2fs /dev/nftla1	
	mkdir /mnt/doc
	mount -t ext2 /dev/nftla1 /mnt/doc
	mkdir -p /mnt/doc/boot/grub
	cp /boot/vmlinuz-doc /mnt/doc/boot

Now create a "menu.lst" file in /mnt/doc/boot/grub.  This file should contain the following:

	timeout 10
	default 0

	title DoC Millennium Boot
	kernel (dc0,0)/boot/vmlinuz-doc root=/dev/hdaX

Where hdaX is the hard drive that contains your root Linux filesystem.  You could also add another entry to the file to boot directly from the hard drive, if desired.

Umount the /mnt/doc directory, and reboot the PC.

At this point, the PC should boot entirely from the DoC, and attempt to mount the root filesystem on your hard drive.  If this works, the next step to a fully self-contained boot is to create a full root filesystem or ramdisk on the DoC.  Once that has been done, change the "root=/dev/hdaX" option to "root=/dev/ntfla1".

Credits:

Thanks to Ilguiz Latypov <ilatypov@superbt.com> for reviewing these instructions, and for answering many questions related to GRUB on the DiskOnChip.


















^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
@ 2002-06-18 16:55 Mark Meade
  2002-06-18 17:56 ` David Woodhouse
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Mark Meade @ 2002-06-18 16:55 UTC (permalink / raw)
  To: linux-mtd

My apologies for screwing up the attachment.  Here it is in text:

Booting GRUB on the DiskOnChip Millennium

1.  Preliminaries

The following procedure was done on a desktop PC, using an 8MB DoC Millennium 
and the M-Sys ISA Evaluation card.  A DOS partition was used to run the M-Sys 
utilities, prior to installing GRUB.   This procedure *might* work with a DoC 
2000 -- but it has not been verified.

The Linux kernel must have the following MTD options either built-in or 
compiled as modules:

        MTD Support: MTD, Debugging, Direct char device access, NFTL, NTFL 
        write support:

                CONFIG_MTD=y
                CONFIG_MTD_DEBUG=y
                CONFIG_MTD_CHAR=y
                CONFIG_NFTL=y
                CONFIG_NFTL_RW=y

        Self-contained MTD Device Drivers: M-Systems DiskOnChip 2000 and 
        Millennium:

                CONFIG_MTD_DOC2000=y  
                CONFIG_MTD_DOCPROBE=y

In the following examples, a 2.4.18 kernel called "vmlinuz-doc" with the 
above MTD options built-in was used.

2.  Save DoC contents, and the Bad Block Table

Get the latest version of the DOS based M-Systems DiskOnChip Software 
Utilities from www.m-sys.com.  If desired, the GETIMAGE utility can be used 
to save the current contents of the DoC:

        getimage /win:xxxx <filename>

(where xxxx is the DoC base memory address in hex (window), for example: 
/win:d000)

**IMPORTANT**: Save the Bad Block Table!  Before attempting to boot with 
GRUB, make sure that the bad block table has been saved.  Doing this insures 
you can always restore the BBT in the event of the DoC being corrupted or 
completely erased:

        dformat /win:xxxx /noformat /log:<filename.txt>

This creates a text file containing a list of all the bad blocks on the DoC.  
 The dformat "uselog" option may be used to restore the BBT if needed.

        dinfo /BBT

will also display some detailed information about the DoC and the bad block 
table.  

3.  Verify TrueFFS Driver Version

The newer versions (5.0 or later) of the M-Systems DOC firmware may not work 
correctly with the latest version of the MTD drivers. This has something to 
do with the "UnitSizeFactor != 1" problem documented elsewhere.  An earlier 
version (4.2) seems to work fine.

Using version 4.2 of the DOS TrueFFS utilities available from M-Systems 
(www.m-sys.com), verify that the DOC is recognized, and that the firmware 
version is 4.2:

        dinfo

If the firmware version is 5.0 or later, run the DFORMAT utility:

        dformat /win:xxxx /s:doc42.exb

4.  Patch and compile GRUB

Get the latest grub sources:

        mkdir grub-doc
        cd grub-doc
        ftp alpha.gnu.org
        cd gnu/grub
        get grub-0.92.tar.gz
        tar xzvf grub-0.92.tar.gz

Get the latest MTD sources:

        cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs login 
        (password = anoncvs)
        cvs -z3 -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co mtd

Patch GRUB with DiskOnChip updates:

        cd grub-0.92
        patch -p0 -i ../mtd/patches/grub-2002-02-19-doc.patch

This patch may fail on the "ChangeLog" file, but all other files should patch 
correctly.  The 2002-02-19-doc patch was originally a patch against grub 
version 0.90.

5.  Build GRUB:

        aclocal && automake && autoconf

If there are any error messages here, you'll probably need up update automake 
and autoconf to the latest versions.

        ./configure --enable-diskonchip-mil512 --enable-ext2fs 
--enable-diskonchip-biosnetboot \
                --disable-ffs --disable-xfs --disable-jfs --disable-vstafs 
--disable-reiserfs --disable-minix --disable-fat
        make

See "README_DiskOnChip" for more information regarding the ./configure 
options, specifically the difference between "-mil256" and "-mil512".

6.  Copy GRUB to DOC

        cd ../mtd/util
        make doc_loadbios
        ./doc_loadbios /dev/mtd0 ../../grub-0.92/stage1/grub_firmware

If an error is reported regarding /dev/mtd0, you might need to run the 
./MAKEDEV script to create the proper device MTD device entries in the /dev 
directory.

7.  TURN OFF PC!

**IMPORTANT** - The PC should be turned off (not just rebooted) after running 
doc_loadbios.  This may not be necessary on all types of hardware, but it was 
required on my PC.  From M-Systems application note DOC-044:

The boot block is implemented as a XIP block located between the flash media 
and the system bus.  After the DiskOnChip Millennium powers-on, or when its 
reset signal is negated, the contents of the first page of flash memory are 
copied into the Boot Block.

The "doc_loadbios" utility copies data to this first page of flash memory.  
My PC must not be "negating the reset signal" to the DoC on a normal reboot 
-- a full power cycle is required to copy the flash memory to the boot block.

8.  Change Boot Sequence

In the BIOS setup, select NETWORK (or NIC, or its equivalent) as the first 
boot device.

Selecting "--enable-diskonchip-biosnetboot" causes the GRUB/DoC code to hook 
INT 18H, which is historically known as the "BASIC interrupt" or "Diskless 
Boot Interrupt".  Using this option with the DoC on a PC is useful because 
you change easily change the boot sequence back to the hard drive when needed.

If the BIOS does not have a NETWORK boot option, it may be possible to 
disable the "biosnetboot" option, rebuild GRUB, and copy grub_firmware to the 
DoC again.  In this case, the GRUB/DoC code will hook the INT 19H (bootstrap) 
handler.  This doesn't work at all on my PC, but theoretically it should 
override any boot sequence options in the BIOS setup.  

The downside of this option (in a PC environment, anyway) is that you may 
need to physically remove the DoC (or eval-board) to get the PC to boot from 
the hard drive again.  If that happens, it may be necessary to reinstall the 
DoC *after* the PC has booted, into a powered up eval board.  Of course, this 
is *not* recommended, but it has been done...

9.  Verify GRUB boot

The PC should now boot from the DiskOnChip.  The BIOS may say something like 
"Searching for boot record from Network...".  The first DoC messages 
displayed should be:

        DoC Mil D000
        Jumping to Grub
        DiskOnChip Millennium found at d0000

Where D000 is the "window" described earlier.

When the boot process completes, there should be a "grub>" command line.  We 
haven't installed a kernel or a "menu.lst" file on the DiskOnChip yet, so 
this step is just to verify that the "grub_firmware" was installed correctly, 
and that the DoC will boot.

At this point, you can either reboot again, change the boot sequence back to 
IDE (or whatever), and boot back into Linux.  Alternatively, if you know 
where your kernel and root filesystem is on the hard drive, simply type 
something like:

        kernel (hd0,0)/vmlinuz-doc root=/dev/hda2
        boot

10.  Partition the DiskOnChip

        fdisk /dev/nftla

If /dev/nftla is recognized, there will probably be one FAT12 partition on 
the DiskOnChip.  In this case, it won't be necessary to run the Linux 
"nftl_format" or "eraseall" utilities.  Use fdisk to delete this partition, 
and continue with step #11.

NOTE:  The "eraseall" utility can be dangerous as it will complete erase the 
DoC, including the bad block table -- saving the BBT as described in step #2 
is highly recommended.

If /dev/ntfla is NOT recognized, use the nftl_format program:

        ./nftl_format /dev/mtd0 98304

The "start offset" of 98304 insures that the grub_firmware is not 
overwritten.  As nftl_format runs, there should be notices about "skipping 
bad zone (factory marked)".  The bad zone values should be identical to the 
values in the file created in step #2.

After nftl_format is complete, reboot the PC.

11.  Create ext2 partition

To boot directly from the DoC, we'll need to create an ext2 partition, and 
install the kernel and GRUB menu.lst file:

        fdisk /dev/nftla                
        n p 1 <enter> <enter>   (create new primary partition, using defaults)
        w                       	     (save new partition info)

        mke2fs /dev/nftla1      
        mkdir /mnt/doc
        mount -t ext2 /dev/nftla1 /mnt/doc
        mkdir -p /mnt/doc/boot/grub
        cp /boot/vmlinuz-doc /mnt/doc/boot

Now create a "menu.lst" file in /mnt/doc/boot/grub.  This file should contain 
the following:

        timeout 10
        default 0

        title DoC Millennium Boot
        kernel (dc0,0)/boot/vmlinuz-doc root=/dev/hdaX

Where hdaX is the hard drive that contains your root Linux filesystem.  You 
could also add another entry to the file to boot directly from the hard 
drive, if desired.

Umount the /mnt/doc directory, and reboot the PC.

At this point, the PC should boot entirely from the DoC, and attempt to mount 
the root filesystem on your hard drive.  If this works, the next step to a 
fully self-contained boot is to create a full root filesystem or ramdisk on 
the DoC.  Once that has been done, change the "root=/dev/hdaX" option to 
"root=/dev/ntfla1".

Credits:

Thanks to Ilguiz Latypov <ilatypov@superbt.com> for reviewing these 
instructions, and for answering many questions related to GRUB on the 
DiskOnChip.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-18 16:55 Mark Meade
@ 2002-06-18 17:56 ` David Woodhouse
  2002-06-18 19:03   ` Mark Meade
  2002-06-20  2:56 ` Dzuy Nguyen
  2002-06-24 15:01 ` Peter Keel
  2 siblings, 1 reply; 15+ messages in thread
From: David Woodhouse @ 2002-06-18 17:56 UTC (permalink / raw)
  To: Mark Meade; +Cc: linux-mtd

Mark, that's excellent documentation -- thanks. Is it OK for me to put that 
on the web site?

I have only one suggestion -- rather than using fdisk to create a single 
partition and then formatting that as ext2, we might as well just put the 
ext2 file system on /dev/nftla (i.e. the whole device), and use (dc0) in 
Grub instead.

BTW, did your 'factory marked' bad blocks in step 10 really match the ones 
from step 2? I'm still suspicious of nftl_format. It would be _really_ nice 
if we could use DFORMAT -- either a Linux port of DFORMAT to replace 
nftl_format and/or working out how to turn our Grub image into a .EXB file 
so it can be loaded directly by DFORMAT.

--
dwmw2

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-18 16:43 Mark Meade
@ 2002-06-18 18:41 ` David Woodhouse
  0 siblings, 0 replies; 15+ messages in thread
From: David Woodhouse @ 2002-06-18 18:41 UTC (permalink / raw)
  To: Mark Meade; +Cc: linux-mtd

mark@lakeshoremicro.com said:
> Patch GRUB with DiskOnChip updates:
> 	cd grub-0.92
> 	patch -p0 -i ../mtd/patches/grub-2002-02-19-doc.patch 

BTW, I finally got round to sorting out the copyright assignment for the 
DiskOnChip support in Grub, so hopefully this step won't be necessary for 
much longer.

--
dwmw2

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-18 17:56 ` David Woodhouse
@ 2002-06-18 19:03   ` Mark Meade
  0 siblings, 0 replies; 15+ messages in thread
From: Mark Meade @ 2002-06-18 19:03 UTC (permalink / raw)
  To: David Woodhouse; +Cc: linux-mtd

David Woodhouse wrote:
> Mark, that's excellent documentation -- thanks. Is it OK for me to put that
> on the web site?

Absolutely!  

> I have only one suggestion -- rather than using fdisk to create a single
> partition and then formatting that as ext2, we might as well just put the
> ext2 file system on /dev/nftla (i.e. the whole device), and use (dc0) in
> Grub instead.

Agreed.  I vaguely recall questions related to multiple partitions on the DoC 
-- my thought was writing it up as one big /dev/nftla1 partition may make it 
more obvious for those wanting to extend that to nftla2, 3, etc.

> BTW, did your 'factory marked' bad blocks in step 10 really match the ones
> from step 2? I'm still suspicious of nftl_format. 

Yes, it did.  The /LOG option in DFORMAT stuffs the bad blocks, in hex, into 
a text file.  They matched the bad blocks reported by nftl_format.

> It would be _really_ nice
> if we could use DFORMAT -- either a Linux port of DFORMAT to replace
> nftl_format and/or working out how to turn our Grub image into a .EXB file
> so it can be loaded directly by DFORMAT.

The latest DFORMAT has an option "/BDKF:<boot image file>" that supposedly 
will place a boot image file in the "binary (BDK) partition".  I tried this 
with grub_firmware, and I think it actually worked.  I'll try again, and if I 
can make this work reliably, I'll post the details.

A Linux DFORMAT that would load the grub firmware and create one ext2 
partition all in one shot (like the DOS version does with the M-Sys firmware 
and FAT12 partition) would be nice!

Regards,

Mark

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-18 16:55 Mark Meade
  2002-06-18 17:56 ` David Woodhouse
@ 2002-06-20  2:56 ` Dzuy Nguyen
  2002-06-24 15:01 ` Peter Keel
  2 siblings, 0 replies; 15+ messages in thread
From: Dzuy Nguyen @ 2002-06-20  2:56 UTC (permalink / raw)
  To: linux-mtd

Thanks, Mark.  Your procedures work for me so you can make it the 
official HOWTO.
I guess the difference is dformat.  eraseall seems to make the DoC Mil 
oblivious to the
BIOS.  Only annoying thing is you have to boot it in DOS and run 
dformat.  A linux
version of dformat would be nice.  How do we go about it?  Is there code 
to port it?

Mark Meade wrote:

>My apologies for screwing up the attachment.  Here it is in text:
>
>Booting GRUB on the DiskOnChip Millennium
>
>1.  Preliminaries
>
>The following procedure was done on a desktop PC, using an 8MB DoC Millennium 
>and the M-Sys ISA Evaluation card.  A DOS partition was used to run the M-Sys 
>utilities, prior to installing GRUB.   This procedure *might* work with a DoC 
>2000 -- but it has not been verified.
>
>The Linux kernel must have the following MTD options either built-in or 
>compiled as modules:
>
>        MTD Support: MTD, Debugging, Direct char device access, NFTL, NTFL 
>        write support:
>
>                CONFIG_MTD=y
>                CONFIG_MTD_DEBUG=y
>                CONFIG_MTD_CHAR=y
>                CONFIG_NFTL=y
>                CONFIG_NFTL_RW=y
>
>        Self-contained MTD Device Drivers: M-Systems DiskOnChip 2000 and 
>        Millennium:
>
>                CONFIG_MTD_DOC2000=y  
>                CONFIG_MTD_DOCPROBE=y
>
>In the following examples, a 2.4.18 kernel called "vmlinuz-doc" with the 
>above MTD options built-in was used.
>
>2.  Save DoC contents, and the Bad Block Table
>
>Get the latest version of the DOS based M-Systems DiskOnChip Software 
>Utilities from www.m-sys.com.  If desired, the GETIMAGE utility can be used 
>to save the current contents of the DoC:
>
>        getimage /win:xxxx <filename>
>
>(where xxxx is the DoC base memory address in hex (window), for example: 
>/win:d000)
>
>**IMPORTANT**: Save the Bad Block Table!  Before attempting to boot with 
>GRUB, make sure that the bad block table has been saved.  Doing this insures 
>you can always restore the BBT in the event of the DoC being corrupted or 
>completely erased:
>
>        dformat /win:xxxx /noformat /log:<filename.txt>
>
>This creates a text file containing a list of all the bad blocks on the DoC.  
> The dformat "uselog" option may be used to restore the BBT if needed.
>
>        dinfo /BBT
>
>will also display some detailed information about the DoC and the bad block 
>table.  
>
>3.  Verify TrueFFS Driver Version
>
>The newer versions (5.0 or later) of the M-Systems DOC firmware may not work 
>correctly with the latest version of the MTD drivers. This has something to 
>do with the "UnitSizeFactor != 1" problem documented elsewhere.  An earlier 
>version (4.2) seems to work fine.
>
>Using version 4.2 of the DOS TrueFFS utilities available from M-Systems 
>(www.m-sys.com), verify that the DOC is recognized, and that the firmware 
>version is 4.2:
>
>        dinfo
>
>If the firmware version is 5.0 or later, run the DFORMAT utility:
>
>        dformat /win:xxxx /s:doc42.exb
>
>4.  Patch and compile GRUB
>
>Get the latest grub sources:
>
>        mkdir grub-doc
>        cd grub-doc
>        ftp alpha.gnu.org
>        cd gnu/grub
>        get grub-0.92.tar.gz
>        tar xzvf grub-0.92.tar.gz
>
>Get the latest MTD sources:
>
>        cvs -d :pserver:anoncvs@cvs.infradead.org:/home/cvs login 
>        (password = anoncvs)
>        cvs -z3 -d :pserver:anoncvs@cvs.infradead.org:/home/cvs co mtd
>
>Patch GRUB with DiskOnChip updates:
>
>        cd grub-0.92
>        patch -p0 -i ../mtd/patches/grub-2002-02-19-doc.patch
>
>This patch may fail on the "ChangeLog" file, but all other files should patch 
>correctly.  The 2002-02-19-doc patch was originally a patch against grub 
>version 0.90.
>
>5.  Build GRUB:
>
>        aclocal && automake && autoconf
>
>If there are any error messages here, you'll probably need up update automake 
>and autoconf to the latest versions.
>
>        ./configure --enable-diskonchip-mil512 --enable-ext2fs 
>--enable-diskonchip-biosnetboot \
>                --disable-ffs --disable-xfs --disable-jfs --disable-vstafs 
>--disable-reiserfs --disable-minix --disable-fat
>        make
>
>See "README_DiskOnChip" for more information regarding the ./configure 
>options, specifically the difference between "-mil256" and "-mil512".
>
>6.  Copy GRUB to DOC
>
>        cd ../mtd/util
>        make doc_loadbios
>        ./doc_loadbios /dev/mtd0 ../../grub-0.92/stage1/grub_firmware
>
>If an error is reported regarding /dev/mtd0, you might need to run the 
>./MAKEDEV script to create the proper device MTD device entries in the /dev 
>directory.
>
>7.  TURN OFF PC!
>
>**IMPORTANT** - The PC should be turned off (not just rebooted) after running 
>doc_loadbios.  This may not be necessary on all types of hardware, but it was 
>required on my PC.  From M-Systems application note DOC-044:
>
>The boot block is implemented as a XIP block located between the flash media 
>and the system bus.  After the DiskOnChip Millennium powers-on, or when its 
>reset signal is negated, the contents of the first page of flash memory are 
>copied into the Boot Block.
>
>The "doc_loadbios" utility copies data to this first page of flash memory.  
>My PC must not be "negating the reset signal" to the DoC on a normal reboot 
>-- a full power cycle is required to copy the flash memory to the boot block.
>
>8.  Change Boot Sequence
>
>In the BIOS setup, select NETWORK (or NIC, or its equivalent) as the first 
>boot device.
>
>Selecting "--enable-diskonchip-biosnetboot" causes the GRUB/DoC code to hook 
>INT 18H, which is historically known as the "BASIC interrupt" or "Diskless 
>Boot Interrupt".  Using this option with the DoC on a PC is useful because 
>you change easily change the boot sequence back to the hard drive when needed.
>
>If the BIOS does not have a NETWORK boot option, it may be possible to 
>disable the "biosnetboot" option, rebuild GRUB, and copy grub_firmware to the 
>DoC again.  In this case, the GRUB/DoC code will hook the INT 19H (bootstrap) 
>handler.  This doesn't work at all on my PC, but theoretically it should 
>override any boot sequence options in the BIOS setup.  
>
>The downside of this option (in a PC environment, anyway) is that you may 
>need to physically remove the DoC (or eval-board) to get the PC to boot from 
>the hard drive again.  If that happens, it may be necessary to reinstall the 
>DoC *after* the PC has booted, into a powered up eval board.  Of course, this 
>is *not* recommended, but it has been done...
>
>9.  Verify GRUB boot
>
>The PC should now boot from the DiskOnChip.  The BIOS may say something like 
>"Searching for boot record from Network...".  The first DoC messages 
>displayed should be:
>
>        DoC Mil D000
>        Jumping to Grub
>        DiskOnChip Millennium found at d0000
>
>Where D000 is the "window" described earlier.
>
>When the boot process completes, there should be a "grub>" command line.  We 
>haven't installed a kernel or a "menu.lst" file on the DiskOnChip yet, so 
>this step is just to verify that the "grub_firmware" was installed correctly, 
>and that the DoC will boot.
>
>At this point, you can either reboot again, change the boot sequence back to 
>IDE (or whatever), and boot back into Linux.  Alternatively, if you know 
>where your kernel and root filesystem is on the hard drive, simply type 
>something like:
>
>        kernel (hd0,0)/vmlinuz-doc root=/dev/hda2
>        boot
>
>10.  Partition the DiskOnChip
>
>        fdisk /dev/nftla
>
>If /dev/nftla is recognized, there will probably be one FAT12 partition on 
>the DiskOnChip.  In this case, it won't be necessary to run the Linux 
>"nftl_format" or "eraseall" utilities.  Use fdisk to delete this partition, 
>and continue with step #11.
>
>NOTE:  The "eraseall" utility can be dangerous as it will complete erase the 
>DoC, including the bad block table -- saving the BBT as described in step #2 
>is highly recommended.
>
>If /dev/ntfla is NOT recognized, use the nftl_format program:
>
>        ./nftl_format /dev/mtd0 98304
>
>The "start offset" of 98304 insures that the grub_firmware is not 
>overwritten.  As nftl_format runs, there should be notices about "skipping 
>bad zone (factory marked)".  The bad zone values should be identical to the 
>values in the file created in step #2.
>
>After nftl_format is complete, reboot the PC.
>
>11.  Create ext2 partition
>
>To boot directly from the DoC, we'll need to create an ext2 partition, and 
>install the kernel and GRUB menu.lst file:
>
>        fdisk /dev/nftla                
>        n p 1 <enter> <enter>   (create new primary partition, using defaults)
>        w                       	     (save new partition info)
>
>        mke2fs /dev/nftla1      
>        mkdir /mnt/doc
>        mount -t ext2 /dev/nftla1 /mnt/doc
>        mkdir -p /mnt/doc/boot/grub
>        cp /boot/vmlinuz-doc /mnt/doc/boot
>
>Now create a "menu.lst" file in /mnt/doc/boot/grub.  This file should contain 
>the following:
>
>        timeout 10
>        default 0
>
>        title DoC Millennium Boot
>        kernel (dc0,0)/boot/vmlinuz-doc root=/dev/hdaX
>
>Where hdaX is the hard drive that contains your root Linux filesystem.  You 
>could also add another entry to the file to boot directly from the hard 
>drive, if desired.
>
>Umount the /mnt/doc directory, and reboot the PC.
>
>At this point, the PC should boot entirely from the DoC, and attempt to mount 
>the root filesystem on your hard drive.  If this works, the next step to a 
>fully self-contained boot is to create a full root filesystem or ramdisk on 
>the DoC.  Once that has been done, change the "root=/dev/hdaX" option to 
>"root=/dev/ntfla1".
>
>Credits:
>
>Thanks to Ilguiz Latypov <ilatypov@superbt.com> for reviewing these 
>instructions, and for answering many questions related to GRUB on the 
>DiskOnChip.
>
>______________________________________________________
>Linux MTD discussion mailing list
>http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
@ 2002-06-20 15:01 Mark Meade
  2002-06-20 16:13 ` Dzuy Nguyen
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Meade @ 2002-06-20 15:01 UTC (permalink / raw)
  To: linux-mtd

Dzuy Nguyen wrote:
>Thanks, Mark.  Your procedures work for me so you can make it the
> official HOWTO.

Have you had a chance to try it with *both* the DoC 2000 and Millennium?  
If it also works with the 2000, I'll update the instructions accordingly.

> Is there code to port it? (DFORMAT)

AFAIK, all of the M-Sys stuff, including the DOS utilities, are proprietary.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-20 15:01 Mark Meade
@ 2002-06-20 16:13 ` Dzuy Nguyen
  2002-06-20 17:13   ` cfowler
  0 siblings, 1 reply; 15+ messages in thread
From: Dzuy Nguyen @ 2002-06-20 16:13 UTC (permalink / raw)
  To: linux-mtd


Mark Meade wrote:

>Dzuy Nguyen wrote:
>
>>Thanks, Mark.  Your procedures work for me so you can make it the
>>official HOWTO.
>>
>
>Have you had a chance to try it with *both* the DoC 2000 and Millennium?  
>If it also works with the 2000, I'll update the instructions accordingly.
>
The difference in DoC 2K is I didn't have to use dformat and of course 
configure
with --enable-diskonchip-2000 instead.

>
>>Is there code to port it? (DFORMAT)
>>
>
>AFAIK, all of the M-Sys stuff, including the DOS utilities, are proprietary.
>
Can't we convince M-System to provide docs/howto/hints?  I think it's 
beneficial to
them because they can have linux support for free.

>
>______________________________________________________
>Linux MTD discussion mailing list
>http://lists.infradead.org/mailman/listinfo/linux-mtd/
>
>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-20 16:13 ` Dzuy Nguyen
@ 2002-06-20 17:13   ` cfowler
  0 siblings, 0 replies; 15+ messages in thread
From: cfowler @ 2002-06-20 17:13 UTC (permalink / raw)
  To: Dzuy Nguyen; +Cc: linux-mtd

I'm tired of booting into DOS just to use putimage and getimage.

On Thu, 2002-06-20 at 12:13, Dzuy Nguyen wrote:
> 
> 
> Mark Meade wrote:
> 
> >Dzuy Nguyen wrote:
> >
> >>Thanks, Mark.  Your procedures work for me so you can make it the
> >>official HOWTO.
> >>
> >
> >Have you had a chance to try it with *both* the DoC 2000 and Millennium?  
> >If it also works with the 2000, I'll update the instructions accordingly.
> >
> The difference in DoC 2K is I didn't have to use dformat and of course 
> configure
> with --enable-diskonchip-2000 instead.
> 
> >
> >>Is there code to port it? (DFORMAT)
> >>
> >
> >AFAIK, all of the M-Sys stuff, including the DOS utilities, are proprietary.
> >
> Can't we convince M-System to provide docs/howto/hints?  I think it's 
> beneficial to
> them because they can have linux support for free.
> 
> >
> >______________________________________________________
> >Linux MTD discussion mailing list
> >http://lists.infradead.org/mailman/listinfo/linux-mtd/
> >
> >
> 
> 
> 
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
> 
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-18 16:55 Mark Meade
  2002-06-18 17:56 ` David Woodhouse
  2002-06-20  2:56 ` Dzuy Nguyen
@ 2002-06-24 15:01 ` Peter Keel
  2 siblings, 0 replies; 15+ messages in thread
From: Peter Keel @ 2002-06-24 15:01 UTC (permalink / raw)
  To: linux-mtd

Hello. 

First off, this is very well written; I like it. I got this far:

* on the Tue, Jun 18, 2002 at 12:55:17PM -0400, Mark Meade wrote:
> 9.  Verify GRUB boot
> 
> The PC should now boot from the DiskOnChip.  The BIOS may say something like 
> "Searching for boot record from Network...".  The first DoC messages 
> displayed should be:
> 
>         DoC Mil D000
>         Jumping to Grub
>         DiskOnChip Millennium found at d0000
> 
> Where D000 is the "window" described earlier.
> 
> When the boot process completes, there should be a "grub>" command line.  We 
> haven't installed a kernel or a "menu.lst" file on the DiskOnChip yet, so 
> this step is just to verify that the "grub_firmware" was installed correctly, 
> and that the DoC will boot.

Since I can't boot from NIC, I have it booting normal, like a disk. 
Everytime, that is. Now I can't change back to lilo on the harddisk.
I have no floppy of course. And I don't like soldering the DoC off.

> At this point, you can either reboot again, change the boot sequence back to 
> IDE (or whatever), and boot back into Linux.  Alternatively, if you know 
> where your kernel and root filesystem is on the hard drive, simply type 
> something like:
> 
>         kernel (hd0,0)/vmlinuz-doc root=/dev/hda2
>         boot

I'd love to. Of course, for some reason my grub can't read the 
filesystem on the disk. The Question now is: 

"If grub can't read the filesystem, how do I tell grub where the 
kernel resides, and how do I find this out where it is?". 

This probably belongs to some grub-mailinglist, but I don't feel like
subscribing one more mailinglist, and more importantly, I think it would
be nice to have that information included in this text as well. 

Right now I'm trying to reformat and setup the disk in another machine,
in the hope that "kernel (hd0,0)/vmlinuz-doc root=/dev/hda1\nboot"
will do the trick then; if not, I really need a solution as outlined 
above.. 

Cheers
Peter
-- 
Those who give up essential liberties for temporary safety deserve 
neither liberty nor safety. -- Benjamin Franklin

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
@ 2002-06-24 15:19 Mark Meade
  2002-06-24 15:40 ` Peter Keel
  0 siblings, 1 reply; 15+ messages in thread
From: Mark Meade @ 2002-06-24 15:19 UTC (permalink / raw)
  To: linux-mtd

Peter Keel wrote:
> I'd love to. Of course, for some reason my grub can't read the
> filesystem on the disk. The Question now is:
>
> "If grub can't read the filesystem, how do I tell grub where the
> kernel resides, and how do I find this out where it is?".

Peter,

What type of filesystem is on your hard drive?  If it's ext2, GRUB should recognize the
filesystem -- if you just type "kernel (hd0,0)/" and then hit TAB, the auto-completion
feature should give you a list of possibilities.

If the hard drive you are trying to boot from has a filesystem other than ext2, you would
need to rebuild GRUB to support it -- the "./configure" script used in the instructions
explicitly disabled all other types of filesystems.

Mark

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-24 15:19 GRUB on DoC Millennium/2000 - Instructions Mark Meade
@ 2002-06-24 15:40 ` Peter Keel
  2002-06-24 16:40   ` Ilguiz Latypov
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Keel @ 2002-06-24 15:40 UTC (permalink / raw)
  To: linux-mtd

* on the Mon, Jun 24, 2002 at 11:19:10AM -0400, Mark Meade wrote:
> Peter Keel wrote:
> > I'd love to. Of course, for some reason my grub can't read the
> > filesystem on the disk. The Question now is:
> >
> > "If grub can't read the filesystem, how do I tell grub where the
> > kernel resides, and how do I find this out where it is?".
> 
> What type of filesystem is on your hard drive?  If it's ext2, 
> GRUB should recognize the filesystem -- if you just type "kernel 
> (hd0,0)/" and then hit TAB, the auto-completion 
> feature should give you a list of possibilities.

I'm hoping. It was reiserfs, but now it'll be ext3.. I hope grub 
has no problems reading ext3 since its the same as ext2 anyway...
in principle.. ;)

> If the hard drive you are trying to boot from has a filesystem 
> other than ext2, you would need to rebuild GRUB to support it -- 
> the "./configure" script used in the instructions
> explicitly disabled all other types of filesystems.

I didn't take your example, and theoretically grub should have had
support for reiserfs -- but I guess it hadn't. 

Peter
-- 
Those who give up essential liberties for temporary safety deserve 
neither liberty nor safety. -- Benjamin Franklin

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-24 15:40 ` Peter Keel
@ 2002-06-24 16:40   ` Ilguiz Latypov
  2002-06-24 18:50     ` Peter Keel
  0 siblings, 1 reply; 15+ messages in thread
From: Ilguiz Latypov @ 2002-06-24 16:40 UTC (permalink / raw)
  To: Peter Keel; +Cc: linux-mtd

Peter,

The --enable-diskonchip-biosnetboot cat not sometime prevent BIOS from
invoking the network boot code directly.  I observed this with an
Advantech PCA 6753 board.

As for the ext3 support in GRUB, I am not sure.  I know that ext3 driver 
can read ext2 partition, but I read somewhere that opposite may not always 
be possible.  For this reason I keep the kernel image in a separate ext2 
partition and the rest in ext3.

It seems that the default journalling mode in ext3 driver has been changed
from "data journalling" to "data ordered" one.  Does this mean that no
double write operation will occur with regard to the file data?

Ilguiz

On Mon, 24 Jun 2002, Peter Keel wrote:

> I'm hoping. It was reiserfs, but now it'll be ext3.. I hope grub 
> has no problems reading ext3 since its the same as ext2 anyway...
> in principle.. ;)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
  2002-06-24 16:40   ` Ilguiz Latypov
@ 2002-06-24 18:50     ` Peter Keel
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Keel @ 2002-06-24 18:50 UTC (permalink / raw)
  To: Ilguiz Latypov; +Cc: linux-mtd

* on the Mon, Jun 24, 2002 at 12:40:51PM -0400, Ilguiz Latypov wrote:
> The --enable-diskonchip-biosnetboot cat not sometime prevent BIOS from
> invoking the network boot code directly.  I observed this with an
> Advantech PCA 6753 board.

I only use --enable-diskonchip-2000. No netboot. 

> On Mon, 24 Jun 2002, Peter Keel wrote:
> 
> > I'm hoping. It was reiserfs, but now it'll be ext3.. I hope grub 
> > has no problems reading ext3 since its the same as ext2 anyway...
> > in principle.. ;)

I changed it to ext2. No avail. It just won't find anything on that
disk; all it says is "unknown filesystem type 0x83" when i set 
"root (hd0,0)", so I assume grub can read my partition table. Which
looks like this:

Disk /dev/hdc: 524 cylinders, 64 heads, 63 sectors/track
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End  #sectors  Id  System
/dev/hdc1   *        63   2032127   2032065  83  Linux
/dev/hdc2       2032128   2112767     80640  82  Linux swap


Anyway. I was looking for those blocks:

debugfs:  stat vmlinuz-2.4.18 
Inode: 31810   Type: regular    Mode:  0644   Flags: 0x0   Generation: 4021347668
User:     0   Group:     0   Size: 1142751
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 2240
Fragment:  Address: 0    Number: 0    Size: 0
ctime: 0x3d16ffac -- Mon Jun 24 13:17:00 2002
atime: 0x3d175b67 -- Mon Jun 24 19:48:23 2002
mtime: 0x3d154d99 -- Sun Jun 23 06:24:57 2002
BLOCKS:
(0-11):66038-66049, (IND):66050, (12-278):66051-66317
TOTAL: 280

But that doesn't seem to work either. 

"kernel (hd0,0)66038+280" does just nothing, namely
"Invalid or unsupported executable format" -- you always get that
when referencing to some bogus structure on the disk. Does grub
use other blocks than those? 

slowly I'm beginning to think I should subscribe to some 
grub-mailinglist. 

thank you anyway. 

Peter
-- 
Those who give up essential liberties for temporary safety deserve 
neither liberty nor safety. -- Benjamin Franklin

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: GRUB on DoC Millennium/2000 - Instructions
@ 2002-06-24 19:08 Mark Meade
  0 siblings, 0 replies; 15+ messages in thread
From: Mark Meade @ 2002-06-24 19:08 UTC (permalink / raw)
  To: linux-mtd

Peter Keel wrote:
> Disk /dev/hdc: 524 cylinders, 64 heads, 63 sectors/track
> Units = sectors of 512 bytes, counting from 0

Peter -- have you tried "root (hd2,0)"?  On my system, /dev/hda1 --> hd0,0.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2002-06-24 19:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-24 15:19 GRUB on DoC Millennium/2000 - Instructions Mark Meade
2002-06-24 15:40 ` Peter Keel
2002-06-24 16:40   ` Ilguiz Latypov
2002-06-24 18:50     ` Peter Keel
  -- strict thread matches above, loose matches on Subject: below --
2002-06-24 19:08 Mark Meade
2002-06-20 15:01 Mark Meade
2002-06-20 16:13 ` Dzuy Nguyen
2002-06-20 17:13   ` cfowler
2002-06-18 16:55 Mark Meade
2002-06-18 17:56 ` David Woodhouse
2002-06-18 19:03   ` Mark Meade
2002-06-20  2:56 ` Dzuy Nguyen
2002-06-24 15:01 ` Peter Keel
2002-06-18 16:43 Mark Meade
2002-06-18 18:41 ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox