歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> 在Fedora中安裝lxr浏覽內核源代碼

在Fedora中安裝lxr浏覽內核源代碼

日期:2017/2/28 16:40:15   编辑:Linux教程

轉自:http://bbs.fedora-zh.org/showthread.php?1764-在fedora中安裝lxr浏覽內核源代碼

說明:本文旨在在Fedora中安裝lxr,此安裝方法與Fedora版本無關,本文在Fedora 11中進行的安裝,參考的是Fedora 4/9等文章說明,成功。使用普通用戶安裝,過程中使用到su命令,lxr設置為可以同時查看多個版本源代碼。

1.下載lxr-0.3
下載地址:http://sourceforge.net/projects/lxr/files/
說明:lxr的最新版使用的是PostgreSQL,麻煩,0.3則不需要數據庫,方便。

2.下載glimpse
http://webglimpse.net/download.php
http://webglimpse.net/trial/glimpse-latest.tar.gz

3.安裝lxr
3.1解壓lxr,進入解壓後的文件夾lxr-0.3,修改Makefile文件,主要有兩項:

代碼:
# The location of your perl5 binary
PERLBIN=/usr/bin/perl
這是perl的路徑名,/usr/bin/perl是大多數情況下的默認配置,如果不同,請用whereis perl查找。
# LXR will be installed here
INSTALLPREFIX=/var/www/html/lxr
這是lxr腳本的安裝目錄,其中/var/www/html取自Apache配置文件/etc/httpd/conf/httpd.conf中的DocumentRoot(文件根目錄)的值。3.2執行"make install"

代碼:
su
make install這會在上述INSTALLPREFIX目錄安裝相應的腳本和文件.

4.安裝glimpse
進入解壓後的文件夾,執行:

代碼:
./configure
su
make install以下操作需要root權限:

5.把源代碼放在/var/www/html/lxr/source文件夾中
這裡可以放多個,比如linux-1.0, linux-2.4.0, linux-2.6.18.8,其中linux-1.0.tar.bz2和linux-2.4.1.tar.bz2解壓後的文件夾都是linux,請自行改名,原因後面說明。

6.在source中建立兩個文件versions和defversion,其中versions為你的源代碼版本(即你的目錄),defversion為你的default version,即lxr默認展示的那個version。
versions的內容就是所有的源代碼的版本,如下:

代碼:
linux-1.0
linux-2.4.0
linux-2.6.18.8defversion的內容如下:

代碼:
linux-2.4.07.修改lxr的配置文件lxr.conf,先備份一下:

代碼:
# cp lxr.conf lxr.conf.bak需要修改的有variable v, baseurl, htmlhead, htmltail, htmldir, sourceroot, srcrootname, dbdir和glimpsebin,如下(這裡用到了前面建立的兩個文件versions和defversion):

代碼:
# Configuration file.

# Define typed variable "v", read valueset from file.
variable: v, Version, [/var/www/html/lxr/source/versions], [/var/www/html/lxr/source/defversion]

# Define typed variable "a". First value is default.
variable: a, Architecture, (i386, alpha, m68k, mips, ppc, sparc, sparc64)

# Define the base url for the LXR files.
baseurl: http://localhost/lxr/http/

# These are the templates for the HTML heading, directory listing and
# footer, respectively.
htmlhead: /var/www/html/lxr/http/template-head
htmltail: /var/www/html/lxr/http/template-tail
htmldir: /var/www/html/lxr/http/template-dir

# The source is here.
sourceroot: /var/www/html/lxr/source/$v/
srcrootname: $v

# "#include <foo.h>" is mapped to this directory (in the LXR source
# tree)
incprefix: /include

# The database files go here.
dbdir: /var/www/html/lxr/source/dbdir/$v/

# Glimpse can be found here.
glimpsebin: /usr/local/bin/glimpse

# The power of regexps. This is pretty Linux-specific, but quite
# useful. Tinker with it and see what it does. (How's that for
# documentation?)
map: /include/asm[^\/]*/ /include/asm-$a/
map: /arch/[^\/]+/ /arch/$a/8.創建lxr/http/.htaccess文件,即/var/www/html/lxr/http/.htaccess,

內容如下:

Copyright © Linux教程網 All Rights Reserved