public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Mark Meade <mark@lakeshoremicro.com>
To: linux-mtd@lists.infradead.org
Subject: GRUB on DoC Millennium/2000 - Instructions
Date: Tue, 18 Jun 2002 12:43:27 -0400	[thread overview]
Message-ID: <200206181242203.SM02488@there> (raw)

[-- 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.


















             reply	other threads:[~2002-06-18 16:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-18 16:43 Mark Meade [this message]
2002-06-18 18:41 ` GRUB on DoC Millennium/2000 - Instructions David Woodhouse
  -- strict thread matches above, loose matches on Subject: below --
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-20 15:01 Mark Meade
2002-06-20 16:13 ` Dzuy Nguyen
2002-06-20 17:13   ` cfowler
2002-06-24 15:19 Mark Meade
2002-06-24 15:40 ` Peter Keel
2002-06-24 16:40   ` Ilguiz Latypov
2002-06-24 18:50     ` Peter Keel
2002-06-24 19:08 Mark Meade

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200206181242203.SM02488@there \
    --to=mark@lakeshoremicro.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox