分类 Linux 下的文章

今天在另外一台电脑上面使用 rt-thread 的 env 工具,scons --menuconfig 出现错误,提示如下:

scons: Reading SConscript files ...
scons: Entering directory `/home/ptz/workspace/rt-thread/rt-thread/tools/kconfig-frontends'
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o kconfig-mconf libs/lxdialog/checklist.o libs/lxdialog/inputbox.o libs/lxdialog/menubox.o libs/lxdialog/textbox.o libs/lxdialog/util.o libs/lxdialog/yesno.o libs/parser/yconf.o frontends/mconf/mconf.o -lncurses
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: libs/lxdialog/util.o: undefined reference to symbol 'nodelay'
/lib64/libtinfo.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
scons: *** [kconfig-mconf] Error 1
scons: building terminated because of errors.
sh: /home/ptz/workspace/rt-thread/rt-thread/tools/kconfig-frontends/kconfig-mconf: No such file or directory

初步判断是找不到 nodelay 这个函数,于是使用 nm -D /lib/libncurses.so.6 |grep -w nodelay, 结果发现果然没有 nodelay。然后测试了可以用的电脑,可以用的电脑上面 ncurses 这个动态库是有 nodelay 的,于是查看两台电脑 ncurses 的 USE 区别,结果发现,不能用的 ncurses 开启了 tinfo 这个 USE。然后 nm -D /lib/libtinfo.so.6 |grep -w nodelay,这下果然有了。

所有只需要修改 rt-thread/tools/kconfig-frontends/SConstruct, 把 tinfo 加入库路径即可正常工作了。

首先使用 grep --color -E "vmx|svm" /proc/cpuinfo 检查 cpu 能不能支持虚拟化,注意 biso 里面要开启虚拟化。

内核开启相应选项

[*] Virtualization  --->
    <*>   Kernel-based Virtual Machine (KVM) support

[*] Virtualization  --->
    <M>   KVM for Intel processors support

[*] Virtualization  --->
    <M>   KVM for AMD processors support

[*] Virtualization  --->
    <*>   Host kernel accelerator for virtio net

Device Drivers  --->
    [*] Network device support  --->
        [*]   Network core driver support
        <*>   Universal TUN/TAP device driver support

[*] Networking support  --->
        Networking options  --->
            <*> The IPv6 protocol
            <*> 802.1d Ethernet Bridging

Kernel hacking  --->
        Compile-time checks and compiler options  --->
            [*] Debug Filesystem

File systems  --->
    <*> The Extended 4 (ext4) filesystem
    [*]   Ext4 Security Labels

然后根据需要 qemu 使用的客户端,修改 make.conf

QEMU_SOFTMMU_TARGETS="arm x86_64 i386"
QEMU_USER_TARGETS="x86_64 arm armeb i386"

增加 qemu 的 USE : accessibility gtk ncurses python sdl spice usbredir 然后安装 qemu: emerge --ask app-emulation/qemu 加入 kvm组: gpasswd -a kvm

安装 virt-manager: emerge -v virt-manager,注意开启 USE: gtk 配置让普通用户使用 qemu: groupadd libvirt usermod -a -G libvirt

vim /etc/libvirt/libvirtd.conf

unix_sock_group = "libvirt"
unix_sock_ro_perms = "0777"
unix_sock_rw_perms = "0770"

退出重新登录后,rc-service libvirtd restart 重启服务.

最近在 linux 平台使用 truestudio 这样的基于 eclipse 二次开发的 IDE,发现编辑区会一直闪烁。经过一番搜索尝试之后,终于找到了解决的方法。

转自:http://www.riksoft.it/wikiriks/ide/eclipse-luna-speedup-and-fix-flickering https://stackoverflow.com/questions/41147840/eclipse-flickering-on-new-line

Eclipse Luna speed up and fix flickering

I used to work with Indigo and it was pretty good, but once in a while it's important to upgrade to have some new features so I was forced to install Luna.

First huge problem Try to move the editor tabs: everything disappear. The entire Window turn to gray (on Windows some experience it as black)

Second problem A lot of flickering everywhere, even on other windows not Eclipse related (e.g file manager, pluma, etc.).

Third problem Slow, slow slow. My i7 workstation can't scroll the editor properly. What do they expecty me to use? A Cray-X Mainframe?8-O When I use the down arrow, it's so slow that the keys are queued and I can't figure out when depressing the key to stop where I want to.

Solution Make a bash script like this one:

#!/bin/bash
export SWT_GTK3=0
export UBUNTU_MENUPROXY=0
cd /opt/eclipse
./eclipse -showlocation

edit the launch icon of Eclipse to use that script instead of eclipse directly. Try it. No more flickering and good speed is back!

FIX the theme With the above modifications the gtk menu will look a bit messy. To fix it, go in window→preferenced→general→appearance and set classic theme and that's it!

首先使用启动光盘启动, 然后 mount /dev/sda4 /mnt/gentoo 挂载硬盘 lspci -v 1>/mnt/gentoo/root/lspci_v.txt 输出信息到文件。 reboot 重启

然后进入系统之后查看, ar9285 对应的是 ath9k, bcm57780 对应的是 tg3,在内核中 使用 / 来查看对应的内核选项, ath9k 可以直接搜索到, 注意, 如果不能 iwlist scanning的话, 需要开启 ath9k_htc 和 ath10k, 这两个试试.

bcm57780 
  Device Drivers  --->
    [*] Network device support  --->
      -*-   PHY Device support and infrastructure  --->
        <*>   Broadcom PHYs
      [*]   Ethernet driver support  --->
        <*>   Broadcom Tigon3 support

然后重新编译内核,并安装内核,重启,就可以驱动网卡了。 注意: 直接 ifconfig 的时候只能看到 无线网卡 wlp5s0, 看不到有限网卡, 可以 ifconfig -a 就能看到有限网卡 enp9s0

无线网卡配置:

vim /etc/conf.d/net
modules="wpa_supplicant"

复制 /usr/share/doc/wpa_supplicant-/wpa_supplicant.conf.gz 到 /etc/wpa_supplicant/, 然后解压, 如果是 bz2,使用 bunzip2 命令解压。

安装 wireless-tools, 然后使用 iwlist wlan0 scanning 扫描网络, 然后修改 wpa_supplicant.conf 中网线网络的名称和密码。

cd /etc/init.d
ln -s net.lo net.wlp5s0
rc-update add net.wlp5s0 default

注意除非有限网络一直插着网线, 否则不要吧有限网卡添加 到 开机启动中去, 否则开机会等待很长 时间。

gentoo openrc 开机的时候,最开始 一些硬件的信息, 后面是一些内核和驱动的信息。 硬件的信息是默认保存到 /var/log/dmesg 中, 可以使用 dmesg | less 来查看硬件信息。 内核驱动信息默认不保存, 只有先修改 /etc/rc.conf , 取消注释并修改rc_logger = "YES", 取消 rc_log_path 这一行的注释,就可以保存内核驱动i信息到 /var/log/rc.log 中, 便于后期查看。

今天更新了 xorg-server 之后, startx 就进不了 X了,但是可以用 sudo startx 进入 X,所以感觉很奇怪。 后来终于在 gentoo 官方论坛上面找到答案了。 https://forums.gentoo.org/viewtopic-t-1070942-postdays-0-postorder-asc-start-0.html https://forums.gentoo.org/viewtopic-t-1078122-postdays-0-postorder-asc-start-0.html

原因是 xorg-server 更新到 1.20 版本之后,SUID 不是默认选中的。 Suid off, uses the wrapper (default install, which is probably what most would want, especially gnome/kde folks) Suid on, does the old install-setuid

在 USE 里面增加 SUID,然后重新编译 xorg-server, 就一切正常,可以进入 X了。

使用ipset让openwrt上的shadowsocks更智能的重定向流量 https://hong.im/2014/07/08/use-ipset-with-shadowsocks-on-openwrt/

By Hong Zhang On 2014-07-08 10:34:31 Tags: #ipset #openwrt #shadowsocks

之前看到有人分享通过dnsmasq的ipset功能简化流量重定向试了下发现很不错。这里分享一下。

使用ipset的主要优势在于直接将所有被污染的域名解析结果交给ipset,不需要动态维护IP列表,在路由上更智能。主要适用于访问和谐站点较少,或者较固定的人群。

- 阅读剩余部分 -