avatar
Today is 星期天
2010年09月5日

搜索结果 文章索引模板: 八月 2009

2009年08月31日

Ubuntu修改Grub系统引导菜单

由 晨笛 — 分类目录: Unix评论暂缺

一般装XP+ubuntu双系统并且在没有修改引导菜单的话
在开机后grub启动后,会有类似于以下几个引导条(我的是8.04 beta版):
Ubuntu hardy (development branch)
Ubuntu hardy (development branch), kernel 2.6.24-12-generic (recovery mode)
Ubuntu hardy (development branch), memtest86+
Other operating systems:
Microsoft Windows XP Professional

并且默认是在上面数下来第一个

下面说如何修改这个菜单吧,进入ubuntu系统后,打开终端执行:
sudo gedit /boot/grub/menu.lst
执行次命令后,默认的menu.lst是这样的:
# menu.lst – See: grub(8), info grub, update-grub(8)
#            grub-install(8), grub-floppy(8),
#            grub-md5-crypt, /usr/share/doc/grub
#            and /usr/share/doc/grub-doc/.

## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify ’saved’ instead of a number. In this case, the default entry
# is the entry saved with the command ’savedefault’.
# WARNING: If you are using dmraid do not use ’savedefault’ or your
# array will desync and will not let you boot your system.
default   0

## timeout sec
# Set a timeout, in SEC seconds, before automatically booting the default entry
# (normally the first entry defined).
timeout   8

## hiddenmenu
# Hides the menu by default (press ESC to see the menu)
#hiddenmenu

# Pretty colours
#color cyan/blue white/blue

## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command ‘lock’
# e.g. password topsecret
#      password –md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret

#
# examples
#
# title   Windows 95/98/NT/2000
# root   (hd0,0)
# makeactive
# chainloader +1
#
# title   Linux
# root   (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#

#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST

### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below

## DO NOT UNCOMMENT THEM, Just edit them to your needs

## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
##      kopt_2_6_8=root=/dev/hdc1 ro
##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=a17564ff-c85d-42b7-ac2e-5798d7e209ab ro

## Setup crashdump menu entries
## e.g. crashdump=1
# crashdump=0

## default grub root device
## e.g. groot=(hd0,0)
# groot=(hd0,8)

## should update-grub create alternative automagic boot options
## e.g. alternative=true
##      alternative=false
# alternative=true

## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
##      lockalternative=false
# lockalternative=false

## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash

## should update-grub lock old automagic boot options
## e.g. lockold=false
##      lockold=true
# lockold=false

## Xen hypervisor options to use with the default Xen boot option
# xenhopt=

## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0

## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
##      altoptions=(recovery) single
# altoptions=(recovery mode) single

## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
##      howmany=7
# howmany=all

## should update-grub create memtest86 boot option
## e.g. memtest86=true
##      memtest86=false
# memtest86=true

## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false

## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false

## ## End Default Options ##

title   Ubuntu hardy (development branch)
root   (hd0,8)
kernel   /boot/vmlinuz-2.6.24-12-generic root=UUID=a17564ff-c85d-42b7-ac2e-5798d7e209ab ro quiet splash
initrd   /boot/initrd.img-2.6.24-12-generic
quiet

title   Ubuntu hardy (development branch), kernel 2.6.24-12-generic (recovery mode)
root   (hd0,8)
kernel   /boot/vmlinuz-2.6.24-12-generic root=UUID=a17564ff-c85d-42b7-ac2e-5798d7e209ab ro single
initrd   /boot/initrd.img-2.6.24-12-generic

title   Ubuntu hardy (development branch), memtest86+
root   (hd0,8)
kernel   /boot/memtest86+.bin
quiet

### END DEBIAN AUTOMAGIC KERNELS LIST

# This is a divider, added to separate the menu items below from the Debian
# ones.
title   Other operating systems:
root

# This entry automatically added by the Debian installer for a non-linux OS
# on /dev/sda1
title   Microsoft Windows XP Professional
root   (hd0,0)
savedefault
makeactive
chainloader +1

刚开机看到系统引导菜单时,显示的那几个选择项就是menu.lst里面后边部分的前面带有“title”的那一行

在前面的内容中“default   0”后面的数值0是第一个选择项,如果分别改成1、2、3、4的话,则分别把默认启动的选择项放在第二、三、四、五个选择项上面。“timeout   8”后面的数值8则表示选择引导条的默认倒计时为8秒,当然,这个数值可以改得更大,比如20、30什么的,不过如果把数值改成负1,即“-1”的话,在开机看到grub选择项时没有倒计时,直到选择了所要启动的引导条并回车才能进入系统

每一行的前面加一个“#”号表示把那一行注释掉,比如说我把启动菜单的一些非必要的引导条(以下3个)注释掉:
Ubuntu hardy (development branch), kernel 2.6.24-12-generic (recovery mode)
Ubuntu hardy (development branch), memtest86+
Other operating systems:

注释掉之后,剩下了如下的两个引导条:
Ubuntu hardy (development branch)
Microsoft Windows XP Professional
上面的UBUNTU对应的default后面的数值则为”0”,如果要改成默认XP启动的话,则把default后面的数值改为”1“ (如果没有注释掉那3个引导条,而又要默认XP启动的话,则把此数值改为”4″即可)

P.S:修改了menu.lst文件并确认没改错的话,先保存再关闭,重启系统,即可看到修改之后的内容

2009年08月26日

关于Boost之编译参数说明

由 晨笛 — 分类目录: C/C++评论暂缺


bjam --build-type=complete --with-regex --toolset=msvc-9.0 stage
bjam --build-type=complete --with-system --toolset=msvc-9.0 stage
bjam --build-type=complete --with-thread --toolset=msvc-9.0 stage
bjam --build-type=complete --with-date_time --toolset=msvc-9.0 stage

stage/install :stage表示只生成库(dll和lib),install还会生成包含头文件的include目录。本人推荐使用 stage,因为install生成的这个include目录实际就是boost安装包解压缩后的boost目录(E:\SDK \boost_1_39_0\boost,只比include目录多几个非hpp文件,都很小),所以可以直接使用,而且不同的IDE都可以使用同一套头文件,这样既节省编译时间,也节省硬盘空间。

toolset :指定编译器,可选的如borland、gcc、msvc(VC6)、msvc-9.0(VS2008)等。

without/with :选择不编译/编译哪些库。本人不需要编译python库,所以排除之,可以根据各人需要选择,默认是全部编译。但是需要注意,如果选择编译python的话,是需要python语言支持的,应该到python官方主页http://www.python.org下载安装。

stagedir/prefix :stage时使用stagedir,install时使用prefix,表示编译生成文件的路径。推荐给不同的IDE指定不同的目录,如VS2008对应的是E:\SDK\boost_1_39_0\vc9\lib,VC6对应的是E:\SDK\boost_1_39_0 \vc6\lib,否则都生成到一个目录下面,难以管理。如果使用了install参数,那么还将生成头文件目录,vc9对应的就是E:\SDK \boost_1_39_0\vc9\include\boost-1_39\boost,vc6类似(光这路径都这样累赘,还是使用stage好)。

build-dir :编译生成的中间文件的路径。这个本人这里没用到,默认就在根目录(E:\SDK\boost_1_39_0)下,目录名为bin.v2,等编译完成后可将这个目录全部删除(没用了),所以不需要去设置。

link :生成动态链接库/静态链接库。生成动态链接库需使用shared方式,生成静态链接库需使用static方式。这里需要注意的是,static 方式下,最终生成的很多静态链接库大小都在几兆、几十兆,甚至接近百兆。这么大的库我们一般是不会采用静态链接方式的,所以这些库不推荐以static方式编译(without掉);如果已经编译了赶快删,肯定没用,否则将占用近1G的硬盘空间。以下是巨型库黑名单:wave、graph、math、 regex、test、program_options、serialization、signals。

runtime-link :动态/静态链接C/C++运行时库。同样有shared和static两种方式,这样runtime-link和link一共可以产生4种组合方式。虽然它和link属性没有直接关系,但我们习惯上,一个工程如果用动态链接那么所有库都用动态链接,如果用静态链接那么所有库都用静态链接。所以这样其实只需要编译2种组合即可,即link=shared runtime-link=shared和link=static runtime-link=static。

threading :单/多线程编译。一般都写多线程程序,当然要指定multi方式了;如果需要编写单线程程序,那么还需要编译单线程库,可以使用single方式。

debug/release :编译debug/release版本。一般都是程序的debug版本对应库的debug版本,所以两个都编译。

© 2010 晨笛的博客 All rights reserved - Wallow theme by TwoBeers Crew - Powered by WordPress - 使用愉快!