Root Device

Showing results for 
Search instead for 
Did you mean: 

Root Device

Root Device

You may specify root device to boot Linux instead of initramfs. For example, you can boot kernel and use HDD/CF or MMC/SD card as root file system. Or you can use NFS ROOT or JFFS2 on MTD.

Note, for the application chooser to work, you can fdisk the sd card to two partitions, part 1 vfat and part 2 ext3. Store the eek files in part 1. And use part2 for rootfs. the kernel command line should be "root=/dev/mmcblk0p2 rw".

eg, the sd card in sdb on Linux PC.

fdisk /dev/sdb

n, p-primary, 1- part1, 0+64M

t, 0c  for fat32 lba.

n, p-primary, 2-part2


mkdosfs /dev/sdb1

mke2fs -j /dev/sdb2

mount -t vfat /dev/sdb1 /media/disk

mkdir /media/disk/Altera_EEK_Applications

mkdir /media/disk/Altera_EEK_Applications/uClinux

Put images in uClinux dir.

umount /media/disk

Method 1, copy your rootfs from initramfs on nios2 board.

1. For HDD/CF or MMC/SD, "make menuconfig" in uClinux-dist.

enable "ext2/ext3" file system support of kernel

select "shutdown (sash)" in "Core Applications" , 

select "mke2fs" in "Filesystem Applications" .


2. Boot, and format the device on nios2 board,

mke2fs -j /dev/hda1  # for HDD/CF


mke2fs -j /dev/mmcblk0 # for MMC/SD, no partition table

3. mount the device, eg, to /mnt,

mount /dev/hda1 /mnt


mount /dev/mmcblk0 /mnt

4. copy the file system to /mnt,

cp -a /bin /dev /etc /home /init /lib /sbin /usr       /mnt

mkdir /mnt/mnt /mnt/proc /mnt/sys /mnt/tmp /mnt/var

5. umount the file system,

umount /mnt

6. disable initramfs of kernel.

General setup -->

[ ] Initial RAM filesystem and RAM disk (initramfs/initrd) support <== unselect

Add kernel command line, 

Processor type and features -->

() Default kernel command string  <== enter the following command line

root=/dev/hda1 rw


root=/dev/mmcblk0 rw


root=/dev/mtdblock0 rw rootfstype=jffs2

7. rebuild and boot.

8. you will need to shutdown your nios2 board,

shutdown -r now

Method 2, use cpio

Login root account on your PC,

1. format the device with ext2/ext3 on your PC. 

2. Mount it to a dir, say /tmp/n2root.

3. extract the initramfs to target rootfs using cpio

cd /tmp/n2root

zcat <path to>/uClinux-dist/linux-2.6.x/usr/initramfs_data.cpio.gz | cpio -id

4. umount.

Version history
Last update:
‎10-30-2020 02:38 PM
Updated by: