11 KiB
Rocky4.2光盘启动引导菜单支持中文修改流程
gfxboot源码获取
git clone https://github.com/openSUSE/gfxboot.git
源码修改
Rocky4.2目录
进入themes目录下新建目录Rocky4.2,将当前目录中的KDE目录下的所有文件及目录拷贝至Rocky4.2目录下
- 修改config文件中的product=Rocky 6.0.42
- 将data-install目录下的back.jpg换为所需的.jpg格式背景图片,即可修改背景图片
- 将data-boot目录下的back.jpg换为所需的.jpg格式背景图片,可以不用更改
- 修改Makefile中DEFAULT_LANG = zh_CN,即将默认语言设置为中文
openSUSE目录
进入openSUSE目录,删除多余语言和帮助信息的相关文件。
- 修改data-install目录下的language文件,只保留en_US和zh_CN,删除所有其他语言(即 在界面中按F2键显示的语言种类内容)。
- 进入help-install目录。保留en目录、zh_CN目录和Makefile文件,删除其他所有目录(这是帮助信息)。
- 在进入help-boot目录。保留en目录、zh_CN目录和Makefile文件,删除其他所有目录。
- 进入po目录。保留zh_CN.po,删除所有其他*.po文件。(这是语言翻译目录,只留下英文和中文)
在openSUSE目录内,添加中文翻译
-
在po目录中,调用bin目录下的add_text脚本即可添加需要的文本内容,README文件内有说明。先将英文内容添加至相应文件内,执行: ./bin/add_text manual_text_title 'Manual install text mode' ./bin/add_text automated 'Automated install' ./bin/add_text advanced_options 'Advanced options' ./bin/add_text State_Grid_title 'State Grid automated install' ./bin/add_text Noraid 'Noraid install' ./bin/add_text Dmraid 'Dmraid install' ./bin/add_text net_server 'Net Install Server'
-
添加中文翻译内容: 打开zh_CN.po文件,分别在相应的英文条目下添加中文翻译:
#. txt_manual_text_title msgid "Manual install text mode" msgstr "手动安装文本模式" #. txt_automated msgid "Automated install" msgstr "自动安装" #. txt_advanced_options msgid "Advanced options" msgstr "高级选项" #. txt_State_Grid_title msgid "State Grid automated install" msgstr "State Grid 自动安装" #. txt_Noraid msgid "Noraid install" msgstr "Noraid 安装" #. txt_Dmraid msgid "Dmraid install" msgstr "Dmraid 安装" #. txt_net_server msgid "Net Install Server" msgstr "网络安装服务器"
在openSUSE目录内,进入src目录,修改界面显示,及gfxboot.cfg配置文件
-
打开panel.inc文件,注释以下两行(163和164行)(界面上将不再显示F1 帮助):
% dup "help" eq { pop [ /panel.help /panel.help.width /panel.help.update .undef ] return } if
% dup "about" eq { pop [ /panel.about /panel.about.width /panel.about.update .undef ]
return } if -
打开xmenu.inc文件,注释133—136行(取消所有帮助信息内容的显示):
% dup keyF1 eq { % show_help % pop 0 % } if -
取消当前语言的显示 打开xmenu.inc,注释以下两行(429和430行): % xmenu .xm_list get xmenu .xm_current get get % dup .undef ne { exec show.rtl } { pop } ifelse
-
将F2 等的显示向下移动: 打开panel.inc文件,修改13行内容为: /panel.text.y { panel.y 30 add } def
-
修改gfxboot.cfg配置文件: 见附录一。
-
以上修改完成后,进入Rocky4.2目录,在Rocky4.2目录下执行make。编译得到bootlogo文件,将该bootlogo文件拷贝至镜像/boot/isolinux/目录下即可使用。
-
isolinux可用最新版syslinux-6.03版本。 下载链接为:https://www.kernel.org/pub/linux/utils/boot/syslinux/ 需要的模块和相关文件有: ./syslinux-6.03/bios/com32/gfxboot/gfxboot.c32 ./syslinux-6.03/bios/core/isolinux.bin ./syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 ./syslinux-6.03/bios/com32/libutil/libutil.c32 ./syslinux-6.03/bios/com32/lib/libcom32.c32
-
修改isolinux.cfg配置文件: 见附录二。
-
综上,将编译得到的bootlogo文件和isolinux.bin、gfxboot.c32、ldlinux.c32、libutil.c32、libcom32.c32、isolinux.cfg等文件,添加至镜像/boot/isolinux/目录下,即可实现安装启动界面的中文显示。
附录一:gfxboot.cfg配置文件内容
; Sections are read in the order given in base::layout, with section 'base'
; implicitly added at the end. If a config value is given more than once,
; the first entry wins.
;
; If a screen resolution can't be set, 640x480 is used as fallback (and
; section '640x480' added to the layout list).
;
; If the penguin screen is active, section 'penguin' is automatically added
; to the layout list.
;
; Setting livecd=1 implicitly adds section 'live' to the layout list.
;
; Color values: 24 bit RGB (e.g. 0xff0000 = red).
;
[base]
; theme name
theme=
; product name
product=
; other sections to read
layout=640x480
; penguin theme likelihood (in percent, -1 = auto)
penguin=-1
; activate speech output
talk=0
; sound volume (0..100)
volume=70
; menu background transparency (0..255)
menu.transparency=0x20
; default font
font.normal=16x16.fnt
; main menu font
font.large=16x16.fnt
; background image
background=back.jpg
; max. visible main menu items
mainmenu.entries=4
; minimal main menu selection bar width
mainmenu.bar.minwidth=225
; main menu selection bar transparency (0..255)
mainmenu.bar.transparency=70
; main menu colors
mainmenu.bar.color=0xa1d0ff
mainmenu.normal.fg=0xffffff
mainmenu.selected.fg=0xffffff
; boot option colors
bootopt.label.fg=0xffffff
bootopt.text.fg=0xffffff
; progress bar color
progress.bar.color=0x295202
; menu colors
menu.normal.bg=0xd8deed
menu.normal.fg=0x000000
menu.normal.alt.fg=0x606060
menu.selected.bg=0x6c6c6c
menu.selected.fg=0xffffff
; window colors
window.bg=0xd8deed
window.fg=0x000000
window.title.bg=0x217b05
window.title.fg=0xffffff
window.title.error.bg=0xc00000
; help system colors
help.link.fg=0x0000a0
help.link.selected.fg=0xffffff
help.link.selected.bg=0x0000a0
help.highlight.fg=0x009000
; panel colors
panel.fg=0xffffff
panel.title.fg=0xffffff
panel.f-key.fg=0xffe050
; default keymap (e.g. de-latin1-nodeadkeys or cz-lat2-us)
keymap=
; replace underscores ('_') with space in menu entries
_2space=1
[800x600]
; screen size
screen.size=800,600
; upper left corner, if x = -1, center horizontally
mainmenu.pos=-1,170
; boot option input field position
bootopt.pos=263,480
[640x480]
; screen size
screen.size=640,480
; upper left corner, if x = -1, center horizontally
mainmenu.pos=210,280
; boot option input field position
bootopt.pos=110,410
[penguin]
; upper left corner, if x = -1, center horizontally
mainmenu.pos=220,163
; main menu selection bar transparency (0..255)
mainmenu.bar.transparency=120
; boot option input field position
bootopt.pos=263,490
; background image
background=pback.jpg
[install]
; show welcome animation
welcome=0
; beep when menu is ready
beep=1
; main menu item shown only if iso is tagged for media check
mediacheck=mediachk
; main menu items where user can't add boot options
nobootoptions=harddisk,memtest
; main menu items that are not passed an 'install' parameter
noinstallopt=harddisk,firmware,memtest
; default install method (one of: cdrom, slp, ftp, http, nfs, smb, hd; default: cdrom)
install=
; default repo location
install.http.server=
install.http.path=
install.nfs.server=
install.nfs.path=
install.ftp.server=
install.ftp.path=
install.ftp.user=
install.ftp.password=
install.smb.server=
install.smb.share=
install.smb.path=
install.smb.domain=
install.smb.user=
install.smb.password=
install.hd.device=
install.hd.path=
; default driver update (one of: yes, no, file, url; default: no)
dud=
; if 'dud=file': file name on DVD
dud.file=
; if 'dud=url': URL
dud.url=
; if 'dud=url': menu item name (default = 'URL')
dud.url.name=
; serial line setup (up to four lines)
; format: port,baud,dev
; - port: 0-3: first four BIOS serial lines (COM1-COM4); >=4: I/O port (0x3f8)
; - baud: baud rate (e.g. 115200); 0 = autodetect (considers baud rates >= 9600)
; - dev: linux device name (e.g. ttyS0)
; - all lines are set up with 8 bits, no parity, 1 stop bit
; - if the bootloader also has a serial line setup, the port is
; automatically used
serial.line0=0,0,ttyS0
serial.line1=1,0,ttyS1
serial.line2=
serial.line3=
; show keymap menu as submenu in lang dialog
keymap.submenu=0
; check min memory size
memcheck=0
; apppend *.spl to initrd
spl=1
; move down one menu entry the first time an F-key is used
autodown=0
; F-key assignments
; value can be one of: lang, video, install, kernelopts, dud, bits, keymap,
; profile, restore, otheropts
; note1: 'bits' is only shown on x86_64, 'profile' only when a file 'profile'
; exists, 'restore' only when there is a boot entry 'restore'
; note2: F1 is always help, F9 enables speech output, F10 exits gfxboot
key.F2=lang
key.F3=video
;key.F4=install
;key.F5=kernelopts
;key.F6=dud
;key.F7=bits
; add 'lang' option with current locale
addopt.lang=1
; add 'keytable' option with current keymap
addopt.keytable=1
[boot]
; show welcome animation
welcome=0
; beep when menu is ready
beep=0
; show keymap menu as submenu in lang dialog
keymap.submenu=0
; system restore menu entry
restore.title=
; F-key assignments, see install section for doc
key.F2=lang
key.F3=profile
key.F4=keymap
key.F5=otheropts
key.F11=restore
; add 'lang' option with current locale
addopt.lang=0
; add 'keytable' option with current keymap
addopt.keytable=0
; init process, default: /sbin/init
init=
[live]
; set livecd flag
livecd=1
; move down one menu entry the first time an F-key is used
autodown=0
; F-key assignments, see install section for doc
key.F2=lang
key.F3=video
key.F4=kernelopts
key.F5=
key.F6=
key.F7=
key.F8=
key.F11=
key.F12=
; add 'lang' option with current locale
addopt.lang=1
; add 'keytable' option with current keymap
addopt.keytable=0
附录二:isolinux.cfg配置文件内容
# D-I config version 2.0
default vesamenu.c32
ui gfxboot bootlogo
prompt 0
timeout 0
label text
menu label Manual install text mode
kernel vmlinuzI
append initrd=initrd.img root=/dev/cdrom instmode=Text vga=791 ro
label auto
menu label Automated install
kernel vmlinuzI
append initrd=initrd.img root=/dev/cdrom instmode=Auto vga=791 ro
label hdd
menu label Boot from Hard Disk
localboot 0x80
label memtest
menu label Memory Test
linux /boot/isolinux/mt86plus
label submenu
menu label Advanced options
append ->sub
label StateGrid
menu label ->sub State Grid automated install
kernel vmlinuzI
append initrd=initrd.img root=/dev/cdrom instmode=StateGrid vga=791 ro
label NoRaid
menu label ->sub Noraid install
kernel vmlinuzI
append initrd=initrd.img root=/dev/cdrom instmode=NoRaid vga=791 ro
label Dmraid
menu label ->sub Dmraid install
kernel vmlinuzI
append initrd=initrd.img root=/dev/cdrom instmode=Dmraid dmraid=true vga=791 ro
label NetInstallServer
menu label ->sub Net Install Server
kernel vmlinuzI
append initrd=initrd.img root=/dev/cdrom instmode=NetInstallServer vga=791 ro
```