Wednesday, June 25, 2014

Google Cloud Platform for making Device Drivers

Today I set up CentOS by using Google Cloud Platform, which is so amazing services, before I make device driver. below is draft to set up it.

1.You have to install Google Cloud SDK from this url(http://qiita.com/yuko/items/aaac6ea9536cd529106f) in order to use SSH on Shell(in my case Mac 10.6) But, You need Python2.7, so if your mac is under 2.6, you first have to install it from this url(https://www.python.org/download/).

2.You have to make account from this url(https://cloud.google.com/?hl=ja)

3.After installing GCSDK, you need to authenticate Google Compute Engine(https://developers.google.com/compute/docs/gcutil/).

4.You can access CentOS via SSH
If you want SU, just do 'sudo -s' (http://www.cyberciti.biz/faq/google-cloud-compute-engin-ssh-into-an-instance-from-linux-unix-appleosx/)

5.When you want to finish the instance(CentOS), you have to gcutil deleteinstance(https://developers.google.com/compute/docs/instances?hl=ja#stop_job)


Below is sample of Driver's code
There is "kernel.h" instead of "stdio.h" It indicates that it can use a kernel space.

---------------------------------------------------
/* ofd.c – Our First Driver code */
#include <linux/module.h>
#include <linux/version.h>
#include <linux/kernel.h>
static int __init ofd_init(void) /* Constructor */
{
    printk(KERN_INFO "Namaskar: ofd registered");
    return 0;
}
static void __exit ofd_exit(void) /* Destructor */
{
    printk(KERN_INFO "Alvida: ofd unregistered");
}
module_init(ofd_init);
module_exit(ofd_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Anil Kumar Pugalia <email_at_sarika-pugs_dot_com>");
MODULE_DESCRIPTION("Our First Driver");

---------------------------------------------------

No comments:

Post a Comment