[BusyBox] fdisk

trevor t_list at vtnet.ca
Tue Jun 18 09:32:03 UTC 2002


On Tuesday 18 June 2002 02:53, Brendan J Simon wrote:
> I'm looking for a simple fdisk program to use on a powerpc based
> embedded system.  It needs to be able to talk to a DiskOnChip though
> that's probably a kernel issue.

to add to the information already given, i just went through this exercise on 
an x86 based system, unfortunately i'm not sure how much of this will be 
helpful to you. i setup my system using fdisk and booted it using lilo with a 
DiskOnChip 2000.

to get fdisk i obtained the "util-linux" package from my favourite linux 
kernel mirror (look under "/pub/linux/utils/util-linux/"). i used version 
2.11r for my tests. once unpacked i believe i just issued a "./configure" and 
then moved into the "fdisk" directory and did a "make". i got an error about 
not being able to compile "cfdisk", but that's okay because "fdisk" can and 
does get built.

my notes are based on information i found at: 
"ftp://ftp.uk.linux.org/pub/people/dwmw2/mtd/cvs/mtd/mtd-jffs-HOWTO.txt"

what i did was to create a boot floppy as described in "ramdisk.txt" in the 
kernel's doc directory. then, after booting from the boot floppy, i made a 
tarball of the filesystem i wanted to put onto my device and placed that onto 
a second floppy (knowing this will make it easier to follow my instructions 
below)

---------------------------------------------------------------------------
here are my instructions for preparing my DOC:
1) insert boot floppy, configure BIOS to boot floppy
   after the system has booted you can remove the boot floppy
     and insert the FS (filesystem) floppy in anticipation of
     what is to come

2) # fdisk /dev/nftl/disc0/disc
   
   Command (m for help): n
   Command action
      e   extended
      p   primary partition (1-4)
   p
   Partition number (1-4): 1
   First cylinder (1-998, default 1): <cr>
   Using default value 1
   Last cylinder or +size or +sizeM or +sizeK (1-998, default 998): <cr>
   Using default value 998

   Command (m for help): w
   The partition table has been altered!

   Calling ioctl() to re-read partition table.
    nftl/disc0/disc: p1
    nftl/disc0/disc: p1
   Syncing disks.

3) partition
   # mkfs.minix /dev/nftl/disc0/part1
   5344 inodes
   15967 blocks
   Firstdatazone=172 (172)
   Zonesize=1024
   Maxsize=268966912

4) mount
   # mount /dev/nftl/disc0/part1 /mnt/tmp

5) mount floppy with fs image
   # mount /dev/fd0 /mnt/floppy

6) # cd /mnt/tmp
   # gzip -d < /mnt/floppy/img.tar.gz | tar xf -

7) # cd /mnt
   # umount /mnt/floppy
   # chroot tmp


   BusyBox v0.60.3 (2002.06.10-14:48+0000) Built-in shell (ash)
   Enter 'help' for a list of built-in commands.

   # mkdir -p /dev/nftl/disc0
   # cd /dev/nftl/disc0
   # mknod disc b 93 0
   # mknod part1 b 93 1
   # lilo
   Added bzImage *
   # cd
   # rm -fr /dev/nftl
   # exit

8) unmount/eject floppy
   # umount /mnt/floppy
   # reboot

---------------------------------------------------------------------------
and here are my instructions lilo and kernel configuration instructions:

used:
    lilo-22.2
    linux-2.4.18

works with:
    uClibc-0.9.11
    busybox-0.60.3

in order to create a bootable DOC2000 system
i had to make adjustments to the kernel. no adjustments
were required for any of the other packages.

kernel
^^^^^^
-> NOTE: the kernel needs to be patched!
goto http://www.linux-mtd.infradead.org and follow the instructions
for obtaining the latest CVS stuff. move into the mtd/patches
directory and do a:

    $ sh patchin.sh <kernel dir>

in my case <kernel dir> = /home/trevor/embedded/ram/src/linux-2.4.18

move to your kernel sources and configure your kernel. i like to use
"make menuconfig".

  Memory Technology Device (MTD)
    [*] Memory Technology Device (MTD) support
    [ ] Debugging
    [ ]   MTD partitioning support
    [ ]   MTD concatenating support
    --- User Modules And Translation Layers
    [*]   Direct char device access to MTD devices
    [ ]   Caching block device access to MTD devices
    [ ]   Readonly block device access to MTD devices
    [ ]   FTL (Flash Translation Layer) support
    [*]   NFTL (NAND Flash Translation Layer) support
    [*]     Write support for NFTL (BETA)
    RAM/ROM/Flash chip drivers  --->
       [ ]   Detect flash chips by Common Flash Interface (CFI) probe
       [ ]   Detect JEDEC JESD21c compatible flash chips
       [ ]   Support for RAM chips in bus mapping
       [ ]   Support for ROM chips in bus mapping
       [ ]   Support for absent chips in bus mapping
       [ ]   Older (theoretically obsoleted now) drivers for non-CFI chips
    Mapping drivers for chip access  --->
    Self-contained MTD device drivers  --->
       [ ]   Uncached system RAM
       [ ]   Test driver using RAM
       [ ]   MTD emulation using block device
       --- Disk-On-Chip Device Drivers
       [ ]   M-Systems Disk-On-Chip 1000
       [*]   M-Systems Disk-On-Chip 2000 and Millennium
       [ ]   M-Systems Disk-On-Chip Millennium-only alternative driver (see 
help)
       [ ]     Advanced detection options for DiskOnChip
    NAND Flash Device Drivers  --->
       [ ]   NAND Device Support


be sure to also include support for devfs (in the kernel, uClibc,
and busybox), support for the /dev/pts filesystem and the minix
filesystem.

make clean, make dep, make bzImage...
be sure to copy arch/i386/boot/bzImage to <filesystem>/boot


lilo
^^^^
compile like anything else (make sure PATH includes path to uclibc
wrappers before the rest of your $PATH)
copy boot-text.b to <filesystem>/boot.b

my lilo.conf on the target looks like this:

    boot=/dev/nftl/disk0/disk
    install=/boot/boot.b
    disk=/dev/nftl/disk0/disk
        bios=0x80
    map=/boot/map
    lba32
    image=/boot/bzImage
        root=/dev/nftl/disk0/part1

notice how "/dev/nftl/disk0/disk" is like "/dev/hda"
and "/dev/nftl/disk0/part1" is like "/dev/hda1"


fdisk and mkfs.minix
^^^^^^^^^^^^^^^^^^^^
when configuring for a new filesystem note what i said above about
disk0/disk and disk0/part1 under "lilo" with regards to formatting
and preparing your disk

    $ fdisk /dev/nftl/disk0/disk
      ...
      w
    $ mkfs.minix /dev/nftl/disk0/part1

---------------------------------------------------------------------------

i hope this helps. best regards,
	trevor

-- 
please remove the underscore if you want to email me



More information about the busybox mailing list