Month: July 2009

Getting git revision by specific date

Few time ago (years) I explained how to get a specific subversion revision by date (portuguese article):

Today I faced the same situation but using git. Bad news: git doesn’t have –revision tag. Fortunately I found a way to do same thing.
You can use this:

$ git rev-list yourbranch -n 1 --first-parent --before=YYYY-MM-DD


$ git rev-list master -n 1 --first-parent --before=2009-05-20

Now just use the returned hash to checkout that revision:

$ git checkout c06326c73bf90e48a8e1cf8893ad31c575423f50

Also you can execute both command using a single line:

git checkout "`git rev-list rev -n 1 --first-parent --before=YYYY-MM-DD`"


Creating patches using CVS

Today I needed to create a patch to LTIB build system, oh gosh, LTIB uses CVS to version control.

LTIB people suggest me to use “cvs diff -u” to create patches, but it is not too easy as it appears. If you haven’t write access to repository, “cvs diff -u” will only works to existent files on CVS server which you change in your local copy.

Then if you create a new directory and a new file you need other approach. You need to install cvsutils to get the command “cvsdo”. The cvsdo will pretend to write the CVS entries and the normal cvs will think these files really exist on external repository.

Then this is the tip:
* First modify the file which already existent on repository;
When you got finished, execute:
$ cvs diff -u > ~/mymod.patch

* Create the directories and files you want;
Then execute:
$ cvsdo add newdirectoryadded/
$ cvsdo add newdirectoryadded/newfileonthisnewdir.c
$ cvsdo diff newdirectoryadded >> ~/mymod.patch

I hope there is some other easy way to create patch using CVS, but on my searches I just found it.

This is because I love git, I don’t need recreating wheel to get it working.

Creating a logo to Linux kernel

The boot logo format has changed for Linux 2.6.x-kernels, it is
now no longer necessary to use fblogo to include a custom
logo with the kernel.

Thanks to Harald Dunkel
for these instructions:

This is how to replace the fb logo for kernel 2.6.x:

– convert your favourite logo into ppm (ASCII), e.g.

cd /usr/share/doc/fblogo/examples/logo_300x80
pngtopnm debian.png | pnmtoplainpnm >debian224.ppm

– copy the ppm file into your kernel source tree, e.g.

cp -p debian224.ppm

– rebuild your kernel

It might be necessary to reduce the number of colors
depending on the target graphics card, e.g.

# pngtopnm debian.png >debian.pnm
# pnmcolormap 16 debian.pnm >colormap16.pnm
pnmcolormap: making histogram…
pnmcolormap: 133 colors found
pnmcolormap: choosing 16 colors…
# pnmremap -map=colormap16.pnm debian.pnm | pnmtoplainpnm >debian16.ppm
pnmremap: 16 colors found in colormap