Sunday, November 20, 2016

Debian packages mini howto

Sure there are many places you have good tutorial for debian packages
but here I am going to add short howto.

 

How to build a debian packages:

Just head on to pacakegs.debian.org where you find catalog of packages, choose
one you like

https://packages.debian.org/stable/

Lets say I want to build one of most popular packages "vlc" 
https://packages.debian.org/stable/vlc

You can see lots of information about the package and also soure package link 
on the right side of the page, now download file ending with ".dsc" 

The dsc file can fetch all required source and apply debian patches required
when run it with dget command. If dget is not available, please install them
by apt-get install devscripts

1. dget -x http://http.debian.net/debian/pool/main/v/vlc/vlc_2.2.4-1~deb8u1.dsc

Now you have all the sources and patches applied, head on building the packages with the command debuild

2. debuild -b -us -uc

The options are to instruct only to build binary packages without signing it.

3. Now you may be reported for some dependencies required to be installed on the running system, resolve them by installing it using apt-get install.

4. Once  the debuild completes you will get the packages .deb files in the source directory, we can go and install them using dpkg.

dpkg -i vlc*.deb


Hope I think I covered the major steps you need to start with. Isn't this simple?
One of the reason why debian has large community.



Speeding up building debian packages


I have been away to blogging for a while and but am planning to write more on the work I do so that it may be useful to others and definitely useful when I read back.

As part of my work, I was building debian browser packages, which is firefox-esr.

We are bringing lots of the changes in the default settings, security and privacy and also changes on the branding.

The main problem that happens when building such big package is build time it takes for a complete build, for firfox-esr it takes 2.5 hrs on a i7 machine.

The best we can do reduce the time is to let the compiler to compile only the modified changes which are minimal in nature rather compiling the entire sources.

I have come across the ccache which is the best friend in this case. First make sure you have ccache installed on your debian machine.

sudo apt-get install ccache

Then if you are building the package first time use the following command.


debuild --preserve-envvar=CCACHE_DIR --prepend-path=/usr/lib/ccache -b -uc -us

In the above command I am build the debian package using debuild, the options

--preserve-envvar=CCACHE_DIR --prepend-path=/usr/lib/cache is passed to the ccache

The other option -b is to instruct to build only .deb packages and -uc -us are for building the unsigned packages

Please remember there won't be any error message if you don't have the ccache installed but then the recomilation takes complete rebuild.

I jumped to ccache without explaining about debian packages intro which I will add in later blogs.



Tuesday, March 18, 2014

Smatch Tool

Smatch Tool

Smatch Tool is a Static analysis one based on spare, it is used for finding bugs at source code without actually running it. It is great way to find bugs for beginner to work on staging driver this tool is really help full. you can get the smatch tool in git hub


http://repo.or.cz/w/smatch.git 

Friday, July 26, 2013

Thermal management

I have been working  as intern for thermal management project , I like to share what i have been learned Thermal management


The generic thermal management uses a concept of cooling states. 

The intent of a cooling state is to define thermal modes for supporting devices. 

The higher the cooling state, the lower the device/platform temperature would be. 

This can be used for both passive and active cooling devices.

  • Passive cooling -  does not use a fan or other means of forced-air cooling.  Relies on      natural convection cooling.
  •  Active cooling -   uses a fan directly mounted onto the heat sink for forced-air cooling.   

                         
sysfs driver will redirect all the control requests to the appropriate cooling device driver when the user application sets anew cooling new state. 

It is up to the cooling device driver to  implement the actual cooling control.

Thermal management in user space would imply that all the policy decisions will be taken from user space and the kernel’s job would be only to facilitate those decisions.

Tuesday, June 25, 2013

Creating the Module

First, find the source that your current Linux kernel was compiled from. You can save the mymodule.c in any one of the folder under staging or drivers directory


mymodule.c


#include <linux/module.h>
#include <linux/config.h>
#include <linux/init.h>

static int __init mymodule_init(void)
{
 printk ("My module worked!\n");
        return 0;
}

static void __exit mymodule_exit(void)
{
 printk ("Unloading my module.\n");
        return;
}

module_init(mymodule_init);
module_exit(mymodule_exit);

MODULE_LICENSE("GPL");

Edit the Makefile in the same directory. Add this line
obj-m += mymodule.o
Compile your module:
 # make -C [top directory of your kernel source] SUBDIRS=$PWD modules
Load the module:
 # insmod ./mymodule.o
And check to see if your message printed out:
# dmesg
At the end of the output:
My module worked!
Now remove the kernel module:
 # rmmod mymodule
Check the output of dmesg again, you could see the output:
 Unloading my module.


Wednesday, June 12, 2013

Makefile and Kconfig


make file

Define the files to be built and and link to other files,  Makefiles within the kernel are kbuild Makefiles that use the kbuild infrastructure, these make  evaluates to either y (for built-in) or m (for module) If it is neither y nor m, then the file will not be compiled nor linked.


Kconfig

Every entry has its own dependencies. These dependencies are used
to determine the visibility of an entry. Any child entry is only
visible if its parent entry is also visible.

Menu entries
------------

Most entries define a config option; all other entries help to organize
them. A single configuration option is defined like this:

config MODVERSIONS
bool "Set version information on all module symbols"
depends on MODULES
help

 Usually, modules have to be recompiled whenever you switch to a new kernel.

Every line starts with a key word and can be followed by multiple
arguments.  "config" starts a new config entry. The following lines
define attributes for this config option. Attributes can be the type of
the config option, input prompt, dependencies, help text and default
values. A config option can be defined multiple times with the same
name, but every definition can have only a single input prompt and the
type must not conflict.

https://www.kernel.org/doc/Documentation/kbuild/kconfig-language.txt

Wednesday, May 29, 2013

My First Career



Hi ,I am well known as Hema , Right from the college days I am interested in Open source.I have started my career in a start-up where i learn about the work nature, Time consumption , etc.. I have taken a break form the IT field , thinking of something different to do.

I want to contribute in opensource, I tried something in KDE plasma center but never created a patch nor written a code to contribute.

I came to knew about OPW from Madhu. Where i have learned  lot of things in opensource.

I like to share what i have learn from this OPW