2

I wanted to download Linux kernel module source code from http://lxr.free-electrons.com/source/net/bluetooth/. Is there any tool like SVN to download the source code generated by LXR engine? Thanks in advance!

5 Answers5

3

If you're still looking for an answer, here is a procedure based on a low documented feature of LXR.

  1. Display the file you are interested in
  2. Modify the URL in the browser address bar, adding at the end ?_raw=1 and go there (i.e. press return key)
  3. The file is then displayed "as is", without any decoration (it is sent as text/plain)
  4. You can now save the file from browser menu command File->Save as

NOTES:

  1. The ?_raw=1 argument can be used to have HTML files interpreted by your browser, i.e. displayed as HTML because they will be sent as text/html.
  2. The feature has been present in LXR for ages, though in versions older than 0.10 the argument is spelled ?raw=1 (without underscore).
  3. I checked that ?raw=1 works with free-electrons though they use 0.3.1 which was released in 2003!
ajlittoz
  • 414
  • 1
  • 5
  • 14
  • I tried this trick ([after adding _raw=1](http://lxr.free-electrons.com/source/net/bluetooth/6lowpan.c?_raw=1)) but didnt helped. Page is showing with the decorations – Hari Om Prakash Jun 11 '15 at 12:10
  • Please give the complete URL you used. Which is LXR version? (recent release show the version number in the bottom line) – ajlittoz Jun 12 '15 at 15:54
  • Yes, the trick allows only the currently displayed file to be downloaded. – ajlittoz Jun 13 '15 at 06:52
  • I am using 4.0 version with this [link](http://lxr.free-electrons.com/source/net/bluetooth/). But I want some mechanism to download all the files and directories downloaded automatically like in svn, github – Hari Om Prakash Jun 15 '15 at 04:10
  • The link you provided points to a 0.3.1 LXR (which is a very very old LXR release). Nevertheless, the trick should work. But, the trick is not intended to do a bulk download of a source tree. It is only a "complimentary" feature for occasional download. The global download is a service outside LXR, it should be provided under an appropriate form by the source tree provider, like svn or github as you point out. Sorry for this answer. – ajlittoz Jun 16 '15 at 08:22
  • Thanks for the suggestion. Yeah you right I am using LXR 0.3.1 version and bluetooth library version with 4.0. At least whatever the trick you are giving that is working. But I was searching for some recursive mechanism. – Hari Om Prakash Jun 18 '15 at 05:54
  • @HariOmPrakash Unfortunately, there is no recursive mechanisme inside LXR. You could eventually write a script to do that for a single directory: capture the source code for a directory listing, parse it (directories are HTML-tagged, so you could even recursively call the script for sub-directories) and launch a text-only browser such as mutt or curl to doxnload individual files with the appropriately crafted URL. Anyway, I strongly suggest you switch to latest LXR release since you'll get a tremendous improvement on indexing performance and a much easier installation and configuration process – ajlittoz Jun 19 '15 at 07:58
  • I got it! I will try what you have said. Thanks dear. – Hari Om Prakash Jun 25 '15 at 10:52
0

The documentation on lxr states that there is a git repo. http://lxr.linux.no/ I have never tried it, but it may be what you are looking for

Bruno9779
  • 1,551
  • 2
  • 14
  • 31
0

Not exactly an answer, but I was looking for a related thing - the possibility to download individual C files from LXR as plain text. If it was possible to download files as text, in principle you could write some sort of a parser/automatic downloader for a whole directory.

The documentation for the LXR engine seems to be here:

... and as far as I could see from the 1.0 PDF manual (note that lxr.free-electrons.com seems to run on version 0.3.1, though), there is no mention of plain-text source files being exported (in addition) to the HTML.

So, very likely, as the plain-text source files seem not to be available in an LXR export, there will be no tool that will be able to download. (Btw, I too wish there was a tool like this, otherwise the only option is to clone the entire Linux source tree via git).

 

Note, however, that there is also an experimental version of LXR from lxr.linux.no ; that one generates HTML that requires JavaScript, and it will show a "download" button in its interface; then one can download the plain-text source file. As lxr.linux.no is down for me for the moment, here's a link to an annotated HTML page to another site, that seems to use the same engine (there is no note ATM for the LXR engine numeric version):

... and this is how the link looks like to obtain plain-text version:

Note that this is a different URL format than what lxr.free-electrons.com would use:

... and there is a note on the start page ( http://lxr.missinglinkelectronics.com/ ) once you enable JavaScript, which states that:

lxr.missinglinkelectronics.com is currently running an experimental fork of the LXR software provided by lxr.linux.no.

... or, in other words: the link format for downloading plain-text source files from lxr.linux.no, will not work for the (current) lxr.free-electrons.com installation.

sdaau
  • 36,975
  • 46
  • 198
  • 278
0

Here you can browse the references and also can download the source file https://code-grep.com/view/project/54b083273b2082684a000008/linux-3.19-rc2

alex
  • 53
  • 1
  • 4
0

On free-electrons.com, it works by adding the argument "raw=1" in the URL. For example, this URL...

http://lxr.free-electrons.com/source/drivers/misc/lis3lv02d/lis3lv02d.c?v=3.8

... will become this :

http://lxr.free-electrons.com/source/drivers/misc/lis3lv02d/lis3lv02d.c?v=3.8&raw=1

The resulting page can then be saved using the "file saving" feature of your browser. On Linux and Windows, this is usually mapped to the ctrl+s keyboard shortcut.

slaadvak
  • 4,611
  • 1
  • 24
  • 34