| Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * File:         Documentation/blackfin/Filesystems | 
|  | 3 | * Based on: | 
|  | 4 | * Author: | 
|  | 5 | * | 
|  | 6 | * Created: | 
|  | 7 | * Description:  This file contains the simple DMA Implementation for Blackfin | 
|  | 8 | * | 
|  | 9 | * Rev:          $Id: Filesystems 2384 2006-11-01 04:12:43Z magicyang $ | 
|  | 10 | * | 
|  | 11 | * Modified: | 
|  | 12 | *               Copyright 2004-2006 Analog Devices Inc. | 
|  | 13 | * | 
|  | 14 | * Bugs:         Enter bugs at http://blackfin.uclinux.org/ | 
|  | 15 | * | 
|  | 16 | */ | 
|  | 17 |  | 
|  | 18 | How to mount the root file system in uClinux/Blackfin | 
|  | 19 | ----------------------------------------------------- | 
|  | 20 |  | 
|  | 21 | 1	Mounting EXT3 File system. | 
|  | 22 | ------------------------ | 
|  | 23 |  | 
|  | 24 | Creating an EXT3 File system for uClinux/Blackfin: | 
|  | 25 |  | 
|  | 26 |  | 
|  | 27 | Please follow the steps to form the EXT3 File system and mount the same as root | 
|  | 28 | file system. | 
|  | 29 |  | 
|  | 30 | a	Make an ext3 file system as large as you want the final root file | 
|  | 31 | system. | 
|  | 32 |  | 
|  | 33 | mkfs.ext3  /dev/ram0 <your-rootfs-size-in-1k-blocks> | 
|  | 34 |  | 
|  | 35 | b	Mount this Empty file system on a free directory as: | 
|  | 36 |  | 
|  | 37 | mount -t ext3 /dev/ram0  ./test | 
|  | 38 | where ./test is the empty directory. | 
|  | 39 |  | 
|  | 40 | c	Copy your root fs directory that you have so carefully made over. | 
|  | 41 |  | 
|  | 42 | cp -af  /tmp/my_final_rootfs_files/* ./test | 
|  | 43 |  | 
|  | 44 | (For ex: cp -af uClinux-dist/romfs/* ./test) | 
|  | 45 |  | 
|  | 46 | d	If you have done everything right till now you should be able to see | 
|  | 47 | the required "root" dir's (that's etc, root, bin, lib, sbin...) | 
|  | 48 |  | 
|  | 49 | e	Now unmount the file system | 
|  | 50 |  | 
|  | 51 | umount  ./test | 
|  | 52 |  | 
|  | 53 | f	Create the root file system image. | 
|  | 54 |  | 
|  | 55 | dd if=/dev/ram0 bs=1k count=<your-rootfs-size-in-1k-blocks> \ | 
|  | 56 | > ext3fs.img | 
|  | 57 |  | 
|  | 58 |  | 
|  | 59 | Now you have to tell the kernel that will be mounting this file system as | 
|  | 60 | rootfs. | 
|  | 61 | So do a make menuconfig under kernel and select the Ext3 journaling file system | 
|  | 62 | support under File system --> submenu. | 
|  | 63 |  | 
|  | 64 |  | 
|  | 65 | 2.	Mounting EXT2 File system. | 
|  | 66 | ------------------------- | 
|  | 67 |  | 
|  | 68 | By default the ext2 file system image will be created if you invoke make from | 
|  | 69 | the top uClinux-dist directory. | 
|  | 70 |  | 
|  | 71 |  | 
|  | 72 | 3.	Mounting CRAMFS File System | 
|  | 73 | ---------------------------- | 
|  | 74 |  | 
|  | 75 | To create a CRAMFS file system image execute the command | 
|  | 76 |  | 
|  | 77 | mkfs.cramfs ./test cramfs.img | 
|  | 78 |  | 
|  | 79 | where ./test is the target directory. | 
|  | 80 |  | 
|  | 81 |  | 
|  | 82 | 4.	Mounting ROMFS File System | 
|  | 83 | -------------------------- | 
|  | 84 |  | 
|  | 85 | To create a ROMFS file system image execute the command | 
|  | 86 |  | 
|  | 87 | genromfs -v -V "ROMdisk" -f romfs.img -d ./test | 
|  | 88 |  | 
|  | 89 | where ./test is the target directory | 
|  | 90 |  | 
|  | 91 |  | 
|  | 92 | 5.	Mounting the JFFS2 Filesystem | 
|  | 93 | ----------------------------- | 
|  | 94 |  | 
|  | 95 | To create a compressed JFFS filesystem (JFFS2), please execute the command | 
|  | 96 |  | 
|  | 97 | mkfs.jffs2 -d ./test -o jffs2.img | 
|  | 98 |  | 
|  | 99 | where ./test is the target directory. | 
|  | 100 |  | 
|  | 101 | However, please make sure the following is in your kernel config. | 
|  | 102 |  | 
|  | 103 | /* | 
|  | 104 | * RAM/ROM/Flash chip drivers | 
|  | 105 | */ | 
|  | 106 | #define CONFIG_MTD_CFI 1 | 
|  | 107 | #define CONFIG_MTD_ROM 1 | 
|  | 108 | /* | 
|  | 109 | * Mapping drivers for chip access | 
|  | 110 | */ | 
|  | 111 | #define CONFIG_MTD_COMPLEX_MAPPINGS 1 | 
|  | 112 | #define CONFIG_MTD_BF533 1 | 
|  | 113 | #undef CONFIG_MTD_UCLINUX | 
|  | 114 |  | 
|  | 115 | Through the u-boot boot loader, use the jffs2.img in the corresponding | 
|  | 116 | partition made in linux-2.6.x/drivers/mtd/maps/bf533_flash.c. | 
|  | 117 |  | 
|  | 118 | NOTE - 	Currently the Flash driver is available only for EZKIT. Watch out for a | 
|  | 119 | STAMP driver soon. | 
|  | 120 |  | 
|  | 121 |  | 
|  | 122 | 6. 	Mounting the NFS File system | 
|  | 123 | ----------------------------- | 
|  | 124 |  | 
|  | 125 | For mounting the NFS please do the following in the kernel config. | 
|  | 126 |  | 
|  | 127 | In Networking Support --> Networking options --> TCP/IP networking --> | 
|  | 128 | IP: kernel level autoconfiguration | 
|  | 129 |  | 
|  | 130 | Enable BOOTP Support. | 
|  | 131 |  | 
|  | 132 | In Kernel hacking --> Compiled-in kernel boot parameter add the following | 
|  | 133 |  | 
|  | 134 | root=/dev/nfs rw ip=bootp | 
|  | 135 |  | 
|  | 136 | In File system --> Network File system, Enable | 
|  | 137 |  | 
|  | 138 | NFS file system support --> NFSv3 client support | 
|  | 139 | Root File system on NFS | 
|  | 140 |  | 
|  | 141 | in uClibc menuconfig, do the following | 
|  | 142 | In Networking Support | 
|  | 143 | enable Remote Procedure Call (RPC) support | 
|  | 144 | Full RPC Support | 
|  | 145 |  | 
|  | 146 | On the Host side, ensure that /etc/dhcpd.conf looks something like this | 
|  | 147 |  | 
|  | 148 | ddns-update-style ad-hoc; | 
|  | 149 | allow bootp; | 
|  | 150 | subnet 10.100.4.0 netmask 255.255.255.0 { | 
|  | 151 | default-lease-time 122209600; | 
|  | 152 | max-lease-time 31557600; | 
|  | 153 | group { | 
|  | 154 | host bf533 { | 
|  | 155 | hardware ethernet 00:CF:52:49:C3:01; | 
|  | 156 | fixed-address 10.100.4.50; | 
|  | 157 | option root-path "/home/nfsmount"; | 
|  | 158 | } | 
|  | 159 | } | 
|  | 160 |  | 
|  | 161 | ensure that /etc/exports looks something like this | 
|  | 162 | /home/nfsmount *(rw,no_root_squash,no_all_squash) | 
|  | 163 |  | 
|  | 164 | run the following commands as root (may differ depending on your | 
|  | 165 | distribution) : | 
|  | 166 | -  service nfs start | 
|  | 167 | -  service portmap start | 
|  | 168 | -  service dhcpd start | 
|  | 169 | -  /usr/sbin/exportfs |