busybox的终端图形化界面菜单

系列文章目录

GNU-ncurses库简介



前言

busybox终端图形化配置界面,和内核的相似


总结

进程启动,准备数据调用子程序
子程序负责渲染

line [0]: ./scripts/kconfig/lxdialog/lxdialog

line [1]: --backtitle

line [2]: BusyBox 1.37.0 Configuration

line [3]: --title

line [4]: README

line [5]: --textbox

line [6]: .help.tmp

line [7]: 40

line [8]: 96

backtitle(BusyBox 1.37.0 Configuration)
---------------------------------------
             title(README)
menu_instructions
+-------------------------------------
| textbox read from temp file .help.tmp
|
+

line [7]: height
line [8]: width

char* args[1024] = {bufptr1, bufptr2...}
**argptr = args

+-----------------
| buf
+-----------------

^
|
bufptr

显示内容通过文件配置,主进程负责读取和解析Config.in,并为子进程生成要渲染的数据,子进程负责实际的渲染工作。

内容配置文件有简单的语法定义

void conf_parse(const char *name);
// 解析 conf_parse 文件

struct expr {
	enum expr_type type;
	union expr_data left, right;
};
struct property {
	struct property *next;
	struct symbol *sym;
	enum prop_type type;
	const char *text;    // 显示的文本 Busybox Configuration
	struct expr_value visible;
	struct expr *expr;   // 
	struct menu *menu;
	struct file *file;
	int lineno;
};
struct symbol {
	struct symbol *next;  // 用于 hash 冲突的表链
	char *name;           // sym name
	char *help;
	enum symbol_type type;   // 符号的数据类型
	struct symbol_value curr, user;
	tristate visible;
	int flags;             // 一些flag
	struct property *prop;  // 属性链表,新增属性放入链表后面
	struct expr *dep, *dep2;
	struct expr_value rev_dep;
};

1. zconf_initscan(name); 打开文件 current_file指向它
2. sym_init();
	struct symbol *sym_lookup(const char *name, int isconst)struct symbol *symbol_hash[257]; 中找到name对应的符号,若找到则返回,否则放入hash table
	"ARCH", 0   "KERNELVERSION", 0  "UNAME_RELEASE", 0
	初始化3符号
3. void menu_init(void)
	此时menu为空

4.	struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep)

conf_read(NULL);

保存文件的结构

[glogal] file_list is a list point to head

struct file {
	struct file *next;
	struct file *parent;
	char *name;
	int lineno;
	int flags;
};

父进程的主要初始化操作:


	setlocale(LC_ALL, "");
	bindtextdomain(PACKAGE, LOCALEDIR);
	textdomain(PACKAGE);

	tcgetattr(1, &ios_org);

	void init_wsize(void); 检查窗口大小

	conf(&rootmenu); loop here  
	子进程 fd=2为管道写端

lxdialog分析

argc = 5
argv[4]
offset < 4

offset = 0 1 2 3^

xx --title title-name --backtitle name --yesno txt prompt 16 141
offset+1 offset+2 ^

–title title-name --backtitle name --yesno promt 30 30

Config.in文件修改示例

部分 xxx/Config.in文件是从代码中的注释生成的

#
# For a description of the syntax of this configuration file,
# see docs/Kconfig-language.txt.
#

mainmenu "Configuration"

config HAVE_DOT_CONFIG
	bool
	default y

menu "Settings"

choice
	prompt "Additional debugging library"
	default NO_DEBUG_LIB
	help
	Using an additional debugging library will make busybox become
	considerably larger and will cause it to run more slowly. You
	should always leave this option disabled for production use.

	dmalloc support:
	----------------
	This enables compiling with dmalloc ( http://dmalloc.com/ )
	which is an excellent public domain mem leak and malloc problem
	detector. To enable dmalloc, before running busybox you will
	want to properly set your environment, for example:
		export DMALLOC_OPTIONS=debug=0x34f47d83,inter=100,log=logfile
	The 'debug=' value is generated using the following command
	dmalloc -p log-stats -p log-non-free -p log-bad-space \
		-p log-elapsed-time -p check-fence -p check-heap \
		-p check-lists -p check-blank -p check-funcs -p realloc-copy \
		-p allow-free-null

	Electric-fence support:
	-----------------------
	This enables compiling with Electric-fence support. Electric
	fence is another very useful malloc debugging library which uses
	your computer's virtual memory hardware to detect illegal memory
	accesses. This support will make busybox be considerably larger
	and run slower, so you should leave this option disabled unless
	you are hunting a hard to find memory problem.


config NO_DEBUG_LIB
	bool "None"

config DMALLOC
	bool "Dmalloc"

config EFENCE
	bool "Electric-fence"

endchoice

#source libbb/Config.in

endmenu

comment "Appletsxx"
comment "UserDefined2"

#source init/Config.in

#source archival/Config.in
#source coreutils/Config.in
#source console-tools/Config.in

#source debianutils/Config.in
source klibc-utils/Config.in
#source editors/Config.in

#source findutils/Config.in
#source loginutils/Config.in
#source e2fsprogs/Config.in
#source modutils/Config.in
#source util-linux/Config.in
#source miscutils/Config.in
#source networking/Config.in
#source printutils/Config.in
#source mailutils/Config.in
#source procps/Config.in
#source runit/Config.in
#source selinux/Config.in
#ource shell/Config.in
#source sysklogd/Config.in

<think>好的,我现在需要解决用户关于银河麒麟V10无法进入图形化界面的问题。首先,我得回忆一下相关的知识,然后结合提供的引用内容来整理解决方案。 用户的问题是无法进入图形化界面,可能有很多原因,比如硬件问题、文件系统损坏、服务错误等。根据引用[4]中的信息,有几个场景可能相关。比如场景1提到UEFI Shell的问题,可能需要检查硬件连接;场景2提到卡在加载界面,可能与内存或文件系统有关;场景4提到文件系统损坏,需要运行fsck修复。 首先,我应该建议用户检查硬件连接,比如内存条是否松动,硬盘是否正常。如果硬件没问题,再考虑文件系统的问题。引用[4]中提到,如果出现busybox错误,需要手动运行fsck修复。步骤是进入live环境或单用户模式,执行fsck命令,然后重启。此外,引用[3]提到修改/tmp权限后需要重启lightdm服务,但这里用户的问题可能更严重,无法进入图形界面,可能需要先修复文件系统,再检查lightdm服务是否正常。 另外,引用[4]中的场景4详细说明了如何修复文件系统,用户可能需要根据错误提示找到受损的盘符,然后执行fsck。如果用户无法进入系统,可能需要使用启动盘进入live环境进行操作。同时,还要考虑是否有强制关机导致文件系统损坏的情况,这也是常见原因。 可能的解决方案步骤应该是:1. 检查硬件连接;2. 进入恢复模式或live环境;3. 运行fsck修复文件系统;4. 重启后检查lightdm服务。需要确保用户按照正确的步骤操作,避免进一步损坏系统。 需要注意的是,用户可能需要指导如何进入单用户模式或使用启动盘,这些步骤可能需要详细说明。此外,如果修复后仍然无法进入图形界面,可能需要检查显示管理器配置或重新安装相关驱动,但根据现有引用,可能主要问题还是硬件或文件系统。</think>根据银河麒麟V10系统特性及常见故障场景,无法进入图形化界面的解决方案可按照以下步骤排查: ### 一、硬件检查 1. **内存与硬盘检测** - 若系统卡在`loading Linux/ramdisk`界面(引用[4]场景2),需关机后重新插拔内存条,并用橡皮擦拭金手指 - 检查硬盘连接状态,进入BIOS确认是否识别到硬盘 2. **电源放电操作** - 完全断开主机电源线,长按电源键15秒放电,重新通电启动(引用[4]场景1) ### 二、文件系统修复 1. **强制进入修复模式** - 在启动界面按`Ctrl+Alt+F2`进入命令行模式 - 执行`fsck -fy [受损盘符]`(如`/dev/sda2`),需根据错误提示确定具体盘符(引用[4]场景4) 2. **Live环境修复** - 使用系统安装U盘启动进入Live模式 - 挂载原系统分区后执行: ```bash fsck -y /dev/[系统根分区] ``` ### 三、服务与权限修复 1. **图形服务重启** - 在命令行执行: ```bash sudo systemctl restart lightdm # 重启显示管理器(引用[3]) ``` 2. **关键目录权限修复** - 检查`/tmp`目录权限是否为1777: ```bash chmod 1777 /tmp && chown root:root /tmp ``` ### 四、内核参数调整 在GRUB界面按`e`编辑启动参数,追加以下配置测试: ``` nomodeset # 禁用显卡驱动 systemd.unit=multi-user.target # 强制进入命令行模式 ``` ### 五、系统恢复方案 若上述操作无效,可通过以下方式恢复: 1. 使用`kylin-backup`工具还原系统备份 2. 通过`apt-get install --reinstall kylin-desktop`重装桌面环境
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值