git clone git://www.aleph1.co.uk/yaffs2   download source code
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 yaffs-demo-x86
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 readme-linux.txt
So the script we use to patch the kernel is
./patch-ker.sh 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 non-essential 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 make-kpkg clean

and let’s kick the build off

fakeroot make-kpkg –initrd –append-to-version=yaffs kernel-image

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 1/2 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.


Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐