Hands-On Kernel Lab: Based On The Yocto Project 1.4 Release (Dylan) April 2013
Hands-On Kernel Lab: Based On The Yocto Project 1.4 Release (Dylan) April 2013
April 2013
Tip: Throughout the lab you will need to edit various files. Sometimes the
pathnames to these files are long. It is critical that you enter them exactly.
Remember you can use the Tab key to help autocomplete path names from
the shell. You may also copy and paste the paths from the PDF version of this
lab which you can find at the same location that this document was found.
Tip: Each lab is independent of the others and doesn't depend on the results of
any previous lab, so feel free to jump right to any lab that's of interest to you.
The kernel failed to load a root filesystem. Note that under the “List of all
partitions:” there are no devices. This means that the kernel did not find a driver
for any of the block devices provided for the qemu machine.
Note that before descending into a menu that is itself configurable, you will need
to check the menu item or its contents will be empty.
Enable the following options:
Device Drivers --->
[*] ATA/ATAPI/MFM/RLL support (DEPRECATED) --->
[*] Intel PIIX/ICH chipsets support
Generic Driver Options --->
[*] Maintain a devtmpfs filesystem to mount at /dev
[*] Automount devtmpfs at /dev, after the kernel mounted the rootfs
File systems --->
[*] Ext3 journaling file system support
Exit and save your changes by selecting Exit and pressing Enter, repeat until it
prompts you to save your changes.
Now rebuild and deploy only the kernel. This avoids having to rebuild the image
itself, which has not changed, saving you a few minutes. Then try to boot it in
QEMU again:
$ bitbake linux -c deploy
$ runqemu tmp/deploy/images/bzImage-lab1-qemux86.bin tmp/deploy/images/core-
image-minimal-lab1-qemux86.ext3
Finally, as before, if you want to save the configuration for posterity, you need to
update the defconfig in the layer with the one you modified for the new driver. To
do so, you can copy the .config over the defconfig in the layer (but it's not
required at this point, as the lab is essentially finished and the results aren't
required for any later labs):
$ cp tmp/work/lab1_qemux86-poky-linux/linux-3.0.18-r0/linux-3.0.18/.config
~/poky-dylan-9.0.0/meta-lab1-qemux86/recipes-kernel/linux/linux/defconfig
Lab 1 Conclusion
Congratulations! You have modified and configured the Linux kernel using a
traditional bitbake Linux kernel recipe. You also updated the layer itself so that
your changes can be shared. This concludes Lab 1.
Like before, QEMU will open a new window and boot to a login prompt. You can
use Shift+PgUp to scroll up and find the new driver message. You can also type
'dmesg | less' at the prompt to look for the module init message.
Lab 3 Conclusion
In this lab you applied a patch and modified the configuration of an arbitrary git-
based non-linux-yocto Linux kernel using a config fragment. You also added and
autoloaded a module as a loadable module. This concludes Lab 3.
read_lock(&file_systems_lock);
tmp = file_systems;
while (tmp) {
seq_printf(m, "%s\t%s\n",
(tmp->fs_flags & FS_REQUIRES_DEV) ? "" : "nodev",
tmp->name);
tmp = tmp->next;
}
read_unlock(&file_systems_lock);
return 0;
}
Add a simple printk() to that function, so that when you 'cat /proc/filesystems' in
the booted image you'll see a message in the kernel logs.
printk("Kilfoy was here!\n");
After adding the printk(), filesystems_proc_show(...) should look like this:
static int filesystems_proc_show(struct seq_file *m, void *v)
{
struct file_system_type * tmp;
read_lock(&file_systems_lock);
tmp = file_systems;
while (tmp) {
seq_printf(m, "%s\t%s\n",
(tmp->fs_flags & FS_REQUIRES_DEV) ? "" : "nodev",
tmp->name);
tmp = tmp->next;
}
read_unlock(&file_systems_lock);
return 0;
}
Verify that the code was changed using 'git diff':
$ git diff -p HEAD
You should see something like the following as output:
diff --git a/fs/filesystems.c b/fs/filesystems.c
index 96f2428..9712c33 100644
--- a/fs/filesystems.c
Lab 5 Conclusion
In this lab you used the Yocto BSP tools to generate a complete BSP layer,
including patches and config fragments, without writing any of it yourself. This
concludes Lab 5.