 building yaffs into linux building yaffs into linux admin 19 august 2012 251am this video shows you how to compile yaffs into linux it s just over 10 minutes long and if you download it it s 325mb after watching this video you should be able to include yaffs in linux once you have yaffs available you will be able to mount a simulated nand device or if you have a flash device attached you will be able to use it the demo was run in a virtualbox system and is available as a  vagrant box from our downloads section  with details of how to build and use a simulated nand device  the script for the video  hello today i m going to show you how to compile yaffs into the linux kernel yaffs is the most widely used file system which is specialised for flash memory it s used in millions of devices both under linux and other operatings systems it s available under the gnu public licence the gpl and commercial terms you can find out more about yaffs at yaffsnet today we ll be targetting intel x86 but with some slight changes we could target another architecture for instance arm this demo is being run in a virtualbox machine and the resulting system is available as a vagrant box so you can download the image and test it yourself if you ve never used vagrant it provides a way to get a virtual system up and running in a few minutes login we re starting off with a stock ubunutu precise 1204 386 server we re using 386 because it s the lowest common demoninator so the virtualbox will run on any system capable of running virtualbox but this works just as well for 64 bit architecture here we are at the commandline of a brandnew installation to make a kernel with yaffs you will need all the usual kernelbuild tools for your distribution the kernel source code and the yaffs source code if you skipped the first video you won t have seen how to download yaffs here s a brief clip of retrieving a gpl licenced copy of the yaffs source git clone git  wwwaleph1couk yaffs2 ls we re starting off in the directory where i stored the kernel and yaffs source the next step isn t strictly necessary but it s useful to if you are going to be doing development i m going to make a branch for my changes to the kernel of course if you are using subversion cvs or some other system for version control then you ll want to skip this step or replace it let s list the branches git branch only one makes it easy git checkout master b yaffsdemox86 okay so we ve created a branch git branch and the star indicates that we are working in our new branch now we have the kernel source but we need to include yaffs luckily yaffs comes with a script which automates the source changes necessary to include it cd yaffs it s always a good idea to check the readme file especially if you are doing this yourself less readmelinuxtxt so the script we use to patch the kernel is  patchkersh c m kernel source the c tells the script to copy the changes rather than linking them and the m indicates that we want the multiprocess option because more than one process might be using yaffs at one time right yaffs has been patched into the kernel now we need to configure the kernel build because i m working on a virtual machine i don t need to worry about different flavours of the kernel configuration i can just go ahead and edit the default configuration to avoid a long compile i m going to remove pretty much all of the nonessential drivers and most of the hardware remember this is running on a virtual machine make menuconfig to include yaffs we need to enable two things the memory technology device support mtd and the caching block device access for mtd the mtd settings are in the device drivers section usually it will be on the caching should be on too once those are enabled yaffs becomes available as an optional file system go into file systems miscellaneous and enable yaffs here s a look at the various options i ve set up yaffs now i m going to go ahead and turn off all the things that i don t need in this kernel there are a lot of them and there s no need to watch hundreds of items being unticked skipping ahead once the config is suitable we can exit and save okay we re ready to build the kernel just to make sure that everything is fine  fakeroot makekpkg clean and let s kick the build off fakeroot makekpkg initrd appendtoversion yaffs kernelimage and now since this is running on a uniprocessor virtual machine i ll be going for some lunch but there s no need for you to wait so the build is finished it took about 12 hour your mileage will vary we have a debian package and i m going to go ahead and install that sudo dpkg install we should have our new build in the grub if we reboot we ll have yaffs available in the next video we ll show you how to set up a yaffs file system you can download a copy of the virtual machine but you ll need vagrant to use it details are on the site thanks for watching  