EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Best tool to compare two linux source codes

Started by piyushpandey March 1, 2014
Hi

I want to know the best software tool for comparing the differences in the
linux kernel.

Actually I have STM32 microcontroller based development board for which I
got the BSP in which the Linux Kernel is present.

The version of the BSP of the linux kernel is 2.6.32

I downloaded the original kernel with same version from kernel.org

Now I am trying to extract the differences between the two source codes by
comparing.

I tried with each individual files in the Beyond Compare but it is a very
big and tiredsome process comparing this way.

So I want to know is there any way to compare the two source codes in just
a single command in the Linux kernel.

I have seen that people patch the whole kernel and as far I have understood
patch contains all the differences that have to be inserted inside the
kernel.

But this is puting inside the kernel.  I want to get out the differences
between the two kernel sources.

I have read that CVS or other version control softwares are used to get out
the differences between two kernel source codes but that is for the
comparing between the two source codes from the same tree.

I want to compare between the two kernel sources from different sources.


Please help me guys.


Thanks 	   
					
---------------------------------------		
Posted through http://www.EmbeddedRelated.com
On Fri, 28 Feb 2014 22:23:59 -0600, piyushpandey wrote:

> Hi > > I want to know the best software tool for comparing the differences in > the linux kernel. > > Actually I have STM32 microcontroller based development board for which > I got the BSP in which the Linux Kernel is present. > > The version of the BSP of the linux kernel is 2.6.32 > > I downloaded the original kernel with same version from kernel.org > > Now I am trying to extract the differences between the two source codes > by comparing. > > I tried with each individual files in the Beyond Compare but it is a > very big and tiredsome process comparing this way. > > So I want to know is there any way to compare the two source codes in > just a single command in the Linux kernel. > > I have seen that people patch the whole kernel and as far I have > understood patch contains all the differences that have to be inserted > inside the kernel. > > But this is puting inside the kernel. I want to get out the differences > between the two kernel sources. > > I have read that CVS or other version control softwares are used to get > out the differences between two kernel source codes but that is for the > comparing between the two source codes from the same tree. > > I want to compare between the two kernel sources from different sources. > > > Please help me guys. > > > Thanks > > --------------------------------------- Posted through > http://www.EmbeddedRelated.com
Use the normal *nix diff command. man diff will give you the options. diff -r dir1 dir2 is a starting point Chisolm Republic of Texas --
>On Fri, 28 Feb 2014 22:23:59 -0600, piyushpandey wrote: > >> Hi >> >> --------------------------------------- Posted through >> http://www.EmbeddedRelated.com > >Use the normal *nix diff command. man diff will give >you the options. diff -r dir1 dir2 is a starting point > >Chisolm >Republic of Texas >
I tried diff commnad also , infact this was the first thing I did after googling over internet. But what I got is that it is comparing the directories upto one layer . I mean I gave the following command: diff ~/linux-2.6.32 ~/linux-ST-source What I got is the parent folder compare upto first level and not compare all subdirectories inside it. I want to compare the difference in one single shot of all the directories and subdirectories inside it. --------------------------------------- Posted through http://www.EmbeddedRelated.com
On Sat, 01 Mar 2014 00:25:43 -0600, "piyushpandey"
<82952@embeddedrelated> wrote:

>>On Fri, 28 Feb 2014 22:23:59 -0600, piyushpandey wrote: >> >>> Hi >>> >>> --------------------------------------- Posted through >>> http://www.EmbeddedRelated.com >> >>Use the normal *nix diff command. man diff will give >>you the options. diff -r dir1 dir2 is a starting point >> >>Chisolm >>Republic of Texas >> > > >I tried diff commnad also , infact this was the first thing I did after >googling over internet. > >But what I got is that it is comparing the directories upto one layer . > >I mean I gave the following command: > >diff ~/linux-2.6.32 ~/linux-ST-source > >What I got is the parent folder compare upto first level and not compare >all subdirectories inside it. > >I want to compare the difference in one single shot of all the directories >and subdirectories inside it.
Like Joe said - use the "-r" option on diff.
On 2014-03-01, Robert Wessel <robertwessel2@yahoo.com> wrote:
> On Sat, 01 Mar 2014 00:25:43 -0600, "piyushpandey" ><82952@embeddedrelated> wrote: >> >>I tried diff commnad also , infact this was the first thing I did after >>googling over internet. >> >>But what I got is that it is comparing the directories upto one layer . >> >>I mean I gave the following command: >> >>diff ~/linux-2.6.32 ~/linux-ST-source >> >>What I got is the parent folder compare upto first level and not compare >>all subdirectories inside it. >> >>I want to compare the difference in one single shot of all the directories >>and subdirectories inside it. > > > Like Joe said - use the "-r" option on diff.
And while you are at it, look at the unified diff option "-u". I find it produces more readable output. You may also wish to review the documentation for the "-N" option in case there are files present in one directory tree but not the other tree. Typing "man diff" into your shell will give you a very detailed list of options you can play with to refine your search for differences. Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world
On 2014-03-01, Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote:
> On 2014-03-01, Robert Wessel <robertwessel2@yahoo.com> wrote: >> On Sat, 01 Mar 2014 00:25:43 -0600, "piyushpandey" >> >>>I want to compare the difference in one single shot of all the directories >>>and subdirectories inside it. >> >> Like Joe said - use the "-r" option on diff. > > And while you are at it, look at the unified diff option "-u". > I find it produces more readable output. > > You may also wish to review the documentation for the "-N" option in > case there are files present in one directory tree but not the other > tree. > > Typing "man diff" into your shell will give you a very detailed list > of options you can play with to refine your search for differences.
meld is a very nice visual "diff" utility. Using it on something as large as linux kernel source trees may be a little combersome, but if you're patient it'll work. -- Grant
On 01/03/14 17:37, Grant Edwards wrote:
> On 2014-03-01, Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote: >> On 2014-03-01, Robert Wessel <robertwessel2@yahoo.com> wrote: >>> On Sat, 01 Mar 2014 00:25:43 -0600, "piyushpandey" >>> >>>> I want to compare the difference in one single shot of all the directories >>>> and subdirectories inside it. >>> >>> Like Joe said - use the "-r" option on diff. >> >> And while you are at it, look at the unified diff option "-u". >> I find it produces more readable output. >> >> You may also wish to review the documentation for the "-N" option in >> case there are files present in one directory tree but not the other >> tree. >> >> Typing "man diff" into your shell will give you a very detailed list >> of options you can play with to refine your search for differences. > > meld is a very nice visual "diff" utility. Using it on something as > large as linux kernel source trees may be a little combersome, but if > you're patient it'll work. >
"meld" was my first thought here. Diff is great for some purposes, but if there are a lot of changes it quickly becomes hard to follow. Just remember on meld to turn off viewing the matching files, so that it is easier to spot the differences.
On Sat, 1 Mar 2014 16:37:40 +0000 (UTC)
Grant Edwards <invalid@invalid.invalid> wrote:

> On 2014-03-01, Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote: > > On 2014-03-01, Robert Wessel <robertwessel2@yahoo.com> wrote: > >> On Sat, 01 Mar 2014 00:25:43 -0600, "piyushpandey" > >> > >>>I want to compare the difference in one single shot of all the directories > >>>and subdirectories inside it. > >> > >> Like Joe said - use the "-r" option on diff. > > > > And while you are at it, look at the unified diff option "-u". > > I find it produces more readable output. > > > > You may also wish to review the documentation for the "-N" option in > > case there are files present in one directory tree but not the other > > tree. > > > > Typing "man diff" into your shell will give you a very detailed list > > of options you can play with to refine your search for differences. > > meld is a very nice visual "diff" utility. Using it on something as > large as linux kernel source trees may be a little combersome, but if > you're patient it'll work. > > -- > Grant > >
Another vote for meld, it's the best visual diff I've used under Linux. -- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix.
On Mon, 03 Mar 2014 10:29:13 +0100, David Brown wrote:

> On 01/03/14 17:37, Grant Edwards wrote: >> On 2014-03-01, Simon Clubley >> <clubley@remove_me.eisner.decus.org-Earth.UFP> wrote: >>> On 2014-03-01, Robert Wessel <robertwessel2@yahoo.com> wrote: >>>> On Sat, 01 Mar 2014 00:25:43 -0600, "piyushpandey" >>>> >>>>> I want to compare the difference in one single shot of all the >>>>> directories and subdirectories inside it. >>>> >>>> Like Joe said - use the "-r" option on diff. >>> >>> And while you are at it, look at the unified diff option "-u". I find >>> it produces more readable output. >>> >>> You may also wish to review the documentation for the "-N" option in >>> case there are files present in one directory tree but not the other >>> tree. >>> >>> Typing "man diff" into your shell will give you a very detailed list >>> of options you can play with to refine your search for differences. >> >> meld is a very nice visual "diff" utility. Using it on something as >> large as linux kernel source trees may be a little combersome, but if >> you're patient it'll work. >> >> > "meld" was my first thought here. Diff is great for some purposes, but > if there are a lot of changes it quickly becomes hard to follow. Just > remember on meld to turn off viewing the matching files, so that it is > easier to spot the differences.
There is probably a better way, but what I usually do is: diff -rq dir1 dir2 >/tmp/somefile Then I edit somefile and get rid of things I dont really care about and change the other lines to "meld path1 path2" and then "sh /tmp/somefile" -- Chisolm Republic of Texas
Rob Gaddi wrote:

[...]

>Another vote for meld, it's the best visual diff I've used under Linux.
Which tools did you investigate? Was Beyond Compare among them? I'm not sure whether I shall buy another Beyond Compare license or switch to another tool. It should support also Windows, multi-platform would be good. Oliver -- Oliver Betz, Munich despammed.com is broken, use Reply-To:

The 2024 Embedded Online Conference