Test Yaffs under Linux using Virtualbox and Vagrant

You can use this Vagrant box to test Yaffs.

To run it you will need VirtualBox, which you can download from https://www.virtualbox.org/ (50 to 90MB download). To run Virtualbox you will need a PC which is capable of virtualisation. Any PC made in the since about 2006 should be capable of this, apart from notepads, and even some notepads have virtualisation. 

Follow the instructions to install VirtualBox on your system. It's available for Linux, Solaris, Windows and Mac. The Vagrant box was created using VirtualBox 4.1, but version 4.0 should be ok too if you have a problem with the 4.1 series. 

Once VirtualBox is installed you will need to download and install Vagrant. You find Vagrant at http://vagrantup.com/. Download and install the latest version for your operating system from http://downloads.vagrantup.com/. Vagrant is a download of between 10 and 60MB, depending on your operating system, excluding any Vagrant boxes you choose to download. The install instructions can be found at http://vagrantup.com/v1/docs/getting-started/index.html

Now, download the Yaffs Vagrant box, saving it to your hard drive. This is a large download - 3GB, so if you are on a slow network, you may wish to schedule it for a convenient time.

After you have Vagrant installed, to test the Yaffs box, open a command line/terminal and type:

$ mkdir ~/yaffsprecise
$ cd ~/yaffsprecise
$ vagrant box add yaffsprecise /wherever/you/saved/package.box
$ vagrant init yaffsprecise
$ vagrant up
$ vagrant ssh

This will leave you at the command line of the Yaffs box. 

You can find the kernel and yaffs in the ~/kernel directory (i.e. /home/vagrant/kernel).

You can create a Yaffs Nand Simulated drive using the following:

$ sudo sudo modprobe nandsim first_id_byte=0xec second_id_byte=0xd3 third_id_byte=0x51 fourth_id_byte=0x15
$ sudo mount -t yaffs /dev/mtdblock0 /media/nand
In the commands above, there's no need to modprobe mtd or mtdblock because the Vagrant image has these compiled into the kernel. 
Once you have mounted your Yaffs partition, you can experiment with writing and deleting files, watching what happens.