聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长

使用buildroot编译图形界面

2022-05-22 19:20 浏览: 1524 次 我要评论(0 条) 字号:

想用buildroot编译一个图形界面在qemu里跑起来,但是失败了。
编译倒是通过了,但是图形界面没有启动起来,可能还有哪里有问题,先Mark保存下,后续接着再弄。

在stackexchange上有类似为需求和问题,可以参考:

https://unix.stackexchange.com/questions/17779/how-can-i-build-a-custom-distribution-for-running-a-simple-web-browser

https://unix.stackexchange.com/questions/70931/how-to-install-x11-on-my-own-linux-buildroot-system/306116#306116

编译的步骤:
make qemu_x86_64_defconfig

Toolchain —>
C library (glibc) —> glibc
[*] Enable C++ support

→ System configuration
(X) Dynamic using devtmpfs + eudev

Target packages → Graphic libraries and applications (graphic/text)
Target packages → Graphic libraries and applications (graphic/text)
[*] xterm
[*] X.org X Window System —>

Target packages → Graphic libraries and applications (graphic/text) → X.org X Window System → X11R7 Servers
[*] xorg-server

Target packages → Graphic libraries and applications (graphic/text) → X.org X Window System → X11R7 Drivers
[*] xf86-input-evdev
[*] xf86-input-keyboard
[*] xf86-input-mouse
[*] xf86-video-cirrus
[*] xf86-video-fbdev
[*] xf86-video-vesa

→ Target packages → Graphic libraries and applications (graphic/text) → X.org X Window System → X11R7 Applications
[*] xeyes
[*] xinit
[*] xcalc
[*] xclock
[*] twm
[*] xinput
[*] setxkbmap

Target packages → Graphic libraries and applications (graphic/text)
[*] mesa3d —>
把所有*** Gallium drivers ***驱动都选中,然后把下面的*** OpenGL API Support ***都选上。
-*- gbm
[*] OpenGL GLX
-*- OpenGL EGL
[*] OpenGL ES

Target packages → Libraries → Graphics
[*] libgtk3
[*] Broadway GDK backend (NEW)
[*] Wayland GDK backend (NEW)
[*] X11 GDK backend (NEW)
[*] Install libgtk3 demo program

Target packages → Graphic libraries and applications (graphic/text)
[*] midori

Filesystem images →
(480M) exact size

把之前的结果rm掉,然后重新编译
rm -rf output
sudo make BR2_JLEVEL=$(nproc)

遇到的编译错误:
错误1:
Ubuntu下直接make,会在编译到host-python3-setuptools的时候提示zip的问题,类似如下:
Archive: /usr/bin/unzip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
note: /usr/bin/unzip may be a plain executable, not an archive
unzip: cannot find zipfile directory in one of /usr/bin/unzip or
/usr/bin/unzip.zip, and cannot find /usr/bin/unzip.ZIP, period.
事实上,根本不是zip包或zip命令的问题,查了半天,后来突想是不是需要sudo,果然执行sudo make就没有问题了。

错误2:
checking for gobject-introspection… no (disabled, use –enable-introspection to enable)
checking for blkid >= 2.20… no
configure: error: *** blkid support requested but not found
make: *** [package/pkg-generic.mk:259:/home/lenky/practise-exec/buildroot-2020.02.1/output/build/eudev-3.2.9/.stamp_configured] 错误 1

lenky@lenky-HP:buildroot-2020.02.1$ sudo apt-cache search blkid
libblkid-dev – block device ID library – headers and static libraries
libblkid1 – 块设备标识库
lenky@lenky-HP:buildroot-2020.02.1$ sudo apt-get install libblkid-dev

安装了库,还是不行,重新编译才行:
sudo make clean
sudo make

错误3:
checking whether mkdir handles trailing slash… yes
checking whether mkdir handles trailing dot… yes
checking for mkdtemp… yes
checking whether mkfifo rejects trailing slashes… yes
checking whether mknod can create fifo without root privileges… configure: error: in `/home/lenky/practise-exec/buildroot-2020.02.1/output/build/host-tar-1.29′:
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See `config.log’ for more details
make: *** [package/pkg-generic.mk:259:/home/lenky/practise-exec/buildroot-2020.02.1/output/build/host-tar-1.29/.stamp_configured] 错误 1

解决:
sudo -i
vi ~/.profile
export FORCE_UNSAFE_CONFIGURE=1
source .profile
sudo make

经过几个小时的编译,显示:
Allocating group tables: done
Writing inode tables: done
Copying files into the device: done
Writing superblocks and filesystem accounting information: done

ln -snf /home/lenky/practise-exec/buildroot-2020.02.1/output/host/x86_64-buildroot-linux-gnu/sysroot /home/lenky/practise-exec/buildroot-2020.02.1/output/staging
成功编译了。

x11窗口启动错误:
# startx
xauth: file /root/.serverauth.131 does not exist
xauth: file /root/.Xauthority does not exist

X.Org X Server 1.20.8
X Protocol Version 11, Revision 0
Build Operating System: Linux 5.10.0-1057-oem x86_64
Current Operating System: Linux buildroot 4.19.91 #1 SMP Fri May 20 11:15:19 CST 2022 x86_64
Kernel command line: rootwait root=/dev/vda console=tty1 console=ttyS0
Build Date: 20 May 2022 11:09:21AM

Current version of pixman: 0.38.4
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (–) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: “/var/log/Xorg.0.log”, Time: Fri May 20 06:09:28 2022
(==) Using system config directory “/usr/share/X11/xorg.conf.d”
pci id for fd 12: 1234:1111, driver (null)
(II) modeset(0): Initializing kms color map for depth 24, 8 bpc.
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
(EE)
Fatal server error:
(EE) Failed to activate virtual core keyboard: 2(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at “/var/log/Xorg.0.log” for additional information.
(EE)
(II) AIGLX: Suspending AIGLX clients for VT switch
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error

当前未解决,原因不明。

Over~

其他参考:

https://nautiluslee.blogspot.com/2019/01/x11-blackbox-qemu.html

https://agentoss.wordpress.com/2011/03/06/building-a-tiny-x-org-linux-system-using-buildroot/

https://www.funtoo.org/Make.conf/VIDEO_CARDS/DRI_vs._Gallium_vs._NVIDIA

https://en.wikipedia.org/wiki/Midori_(web_browser)

http://dwm.suckless.org/dynamic_window_management/

https://zhuanlan.zhihu.com/p/183861786

https://www.uzbl.org/

印度开发者发布 DahliaOS/FImage,可以直接在个人电脑上体验 Fuchsia 操作系统了

https://dahliaos.io/

https://www.sohu.com/a/469919378_121124365

https://www.linuxprobe.com/google-fuchsia-linux.html



网友评论已有0条评论, 我也要评论

发表评论

*

* (保密)

Ctrl+Enter 快捷回复