- Rufus, released only in Windows.
-
WoeUSB, can run in Linux.
1 2 3
dnf install WoeUSB # /dev/sdd is the u-disk woeusb --device /path/to/cn_windows_10_enterprise_ltsc_2019_x64_dvd_9c09ff24.iso /dev/sdd
Linux
Build qt source in Fedora35
Extract qt-everywhere-src-6.2.2.zip to directory named qt,
sudo dnf install libxcb libxcb-devel xcb-util xcb-util-devel xcb-util-*-devel libX11-devel libXrender-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel libdrm-devel libXcursor-devel libXcomposite-devel cd qt mkdir bld cd bld cmake -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=`pwd`/installed -DCMAKE_BUILD_TYPE="Debug" .. cmake --build . --parallel cmake --install . --prefix=`pwd`/installed
Can't locate English.pm in @INC
sudo dnf install perl-English
This application failed to start because no Qt platform plugin could be init...
If "xcb" things missing, we should "dnf install libxcb..." like above, and an annoying step we can't image is after we install required packages, we must delete CMakeCache.txt first and then to invoke cmake, if not, some modules like xcb-sm are always displayed not to be built.
Feature accessibility_atspi_bridge is already defined to be "OFF" and should now be set to "ON" when importing features from Qt6::Gui.
We only need to not let the message interrupt building progress,
/mnt/SDC2/qt/bld/installed/lib/cmake/Qt6/QtFeature.cmake:1136
message(STATUS "Feature ${feature} is already defined to be \"${QT_FEATURE_${feature}}\" and should now be set to \"${value}\" when importing features from ${target}.")
refer to:
https://download.qt.io/official_releases/qtcreator/6.0/6.0.1/qt-creator-opensource-linux-x86_64-6.0.1.run
https://wiki.qt.io/Building_Qt_5_from_Git#Linux.2FX11
https://forum.qt.io/topic/121386/built-qt6-from-sources-problem-with-xcb-plugin/15
https://forum.qt.io/topic/128887/build-qt6-from-source-xcb-issue/3
https://forum.qt.io/topic/92834/configure-errors-disabling-x11-accessibility-bridge-d-bus-or-at-spi-is-missing/7
Debug ue4 in Fedora35
After running Setup.sh and GenerateProjectFiles.sh, we found UE4.pro created. It's like a fresh breeze coming from the roof window, we are free now, no more need to fear the once unbearable torment in Visual Studio IDE.
Qt source is not necessary to ue4, qtcreator is only a visual debugger to ue4.
Build Steps:
1 | make UE4Editor-Linux-Debug ShaderCompileWorker-Linux-Debug -j8 |
Clean Steps:
1 | make UE4Editor-Linux-Debug ShaderCompileWorker-Linux-Debug ARGS=-clean -j8 |
Re-compress all Mame zip roms to 7z format
In advance,
- install 7-zip in "d:\cext\Program Files\7-Zip".
- install git from https://git-scm.com/download/win
trans_to_7z.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #!/bin/bash PARENTDIR=$1 TMPDIR=`pwd`/tmp PATH="/d/cext/Program Files/7-Zip:$PATH" ISERR="no" if [ "x$1" = x ] ; then echo "Please input dir to transform." exit fi if [ -e "$TMPDIR" ] ; then echo "Please rmdir [$TMPDIR] first." exit fi get_win_path() { local win_path="$1" win_path="${win_path#/}" win_path="${win_path//\//\\}" win_path="${win_path/\\/\:\\}" echo $win_path } format_transform() { local file_7z=$1 local file_zip=$2 local tmp_dir=$TMPDIR mkdir "$tmp_dir" 7z x ${file_7z} -o"`get_win_path \"$tmp_dir\"`" ( cd "$tmp_dir" ls 7z a -mx9 "`get_win_path \"${file_zip}\"`" || ( echo "Creating 7z file failed." && ISERR="yes" ) ) rm -Rf "$tmp_dir" } cd "$PARENTDIR" for fn in `ls *.zip`; do echo "$fn" format_transform $fn "`pwd`/${fn%.zip}.7z" if [ $ISERR = "yes" ]; then exit fi done echo "Transforming done." |
How to use?
Copy trans_to_7z.sh to Mame root folder which contains roms sub-directory, right click at blank place of this Mame root window in Explorer, select "Git Bash Here" which prompts bash console, input below and return,
1 | ./trans_to_7z.sh roms |
Install bare metal Linux dual booting with Windows
Installing Fedora is very straight forward, but
- When clicking some avi suffix video file, I was prompted a GStreamer page, but no link to install missing plugins.
However I learnt
- One disk must have its own EFI partition. For nowaday notebook usually has an SSD and an HDD, while SSD already has an EFI partition, when we have to install the second OS in HDD, the HDD must allocate an EFI partition too.
- When we burn OS iso image into U-disk using UltraIso tool, we must select "RAW" mode, not others like "HDD+" mode.
'vboxdrv': Key was rejected by service
sudo dnf update sudo dnf install mokutil mkdir /root/signed-modules cd /root/signed-modules openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -days 36500 -subj "/CN=VirtualBox/" chmod 600 MOK.priv mokutil --import MOK.der #After rebooting system for modfile in $(dirname $(modinfo -n vboxdrv))/*.ko; do echo "Signing $modfile" /usr/src/kernels/$(uname -r)/scripts/sign-file sha256 \ /root/signed-modules/MOK.priv \ /root/signed-modules/MOK.der "$modfile" done
To play avi, rmvb files and so on,
dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm dnf install https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm dnf install vlc
Not set default editor to nano in cscope,
cd /etc/profile.d mv nano-default-editor.sh nano-default-editor.sh0
No sound?
vi /etc/pulse/default.pa load-module module-alsa-sink device=dmix load-module module-alsa-source device=dsnoop reboot
This method doesn't go very well, but I know the reason, I had replaced pipewire with pulseaudio while pipewire is the next generation.
Update grub,
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
refer to:
https://www.tecmint.com/install-vmware-workstation-in-linux/
https://stackoverflow.com/questions/61248315/sign-virtual-box-modules-vboxdrv-vboxnetflt-vboxnetadp-vboxpci-centos-8
https://www.videolan.org/vlc/download-fedora.html
https://blog.csdn.net/weixin_41446370/article/details/116711350
http://blog.sina.com.cn/s/blog_628ba3e00102xvnk.html
https://blog.csdn.net/wujuncheng1996/article/details/83546929
https://mirror.tuna.tsinghua.edu.cn/help/rpmfusion/
how to turn off fans in linux
after running 'sensors-detect' command, kernel modules controlling fan speed should be loaded.
here is an occasion with 'Nuvoton NCT6102D/NCT6104D/NCT6106D Super IO Sensors' detected.
as nct6775 document said:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #/sys/class/hwmon/hwmon4 pwm[1-7] - this file stores PWM duty cycle or DC value (fan speed) in range: 0 (lowest speed) to 255 (full) pwm[1-7]_enable - this file controls mode of fan/temperature control: * 0 Fan control disabled (fans set to maximum speed) * 1 Manual mode, write to pwm[0-5] any value 0-255 * 2 "Thermal Cruise" mode * 3 "Fan Speed Cruise" mode * 4 "Smart Fan III" mode (NCT6775F only) * 5 "Smart Fan IV" mode ... |
ps1. if set pwm[1-7]_enable to 0, we will not be able to change it to other value, unless reboot linux.
ps2. I still can't find a common way to turn off fans using ipmitool.
IPMI: Intelligent Platform Management Interface
BMC: Baseboard Management Controller
FRU: Field Replaceable Unit
refer to:
[linux-kernel-src-root]/Documentation/hwmon/nct6775.rst
https://bbs.archlinux.org/viewtopic.php?id=225349
linux命令备忘录
名词
1 2 3 4 5 | pie: position-independent executable pic: position-independent code aslr: address space layout randomization got: global offset table vdso: virtual dynamic shared object |
Basic command
1 2 3 4 5 6 7 8 9 10 11 12 13 | grep [OPTION]... PATTERNS [FILE]... find [-H] [-L] [-P] [-Olevel] [-D debugopts] [path...] [expression] find . -size +2G -exec du -sh {} \; ps axl | grep VirtualBoxVM | grep -v grep | awk '{print $3};' cat /etc/passwd | sort -k5,5 -t: | column -t -s: while true; do echo sleep 1 sec; sleep 1; cat /home/work/aa.txt 2>/dev/null && echo ok && break; done echo first | xargs -i echo {} second cat /etc/shadow sudo !! cd other_dir cd - # return back |
swap文件
1 2 3 4 | dd if=/dev/zero of=./swap_file bs=1G count=8 mkswap ./swap_file swapon ./swap_file swapoff ./swap_file |
objcopy
1 2 3 | objcopy -I binary -O elf32-i386 -B i386 test.jpg test.o objdump -s -b binary test.o readelf -s test.o |
静态链编stdc++
1 | -Bstatic -lstdc++ -Bdynamic |
工具
1 2 3 4 5 6 | systemtap inotify-tools windres reptyr nmcli nmtui |
自启动
1 2 3 4 5 6 7 8 9 10 11 12 | #/lib/systemd/system/mytask.service #ln -s /lib/systemd/system/mytask.service /etc/systemd/system/multi-user.target.wants/mytask.service [Unit] Description=mytask After=network.target [Service] Type=simple ExecStart=mytask.sh [Install] WantedBy=multi-user.target |
ubuntu
1 2 3 4 5 6 7 8 9 10 | #网络配置文件路径,默认DHCP的连接不会生成文件 /etc/NetworkManager/system-connections/ #run arm64 binary on x86 dpkg --add-architecture armhf && apt-get update && apt-get install libc6:armhf cat /proc/sys/fs/binfmt_misc/ qemu-user -L /home/bamanzi/i386-libs ./prog #disable background process systemctl disable unattended-upgrades ss -tap pv -d <pid> |
centos
1 2 3 4 | #网络配置文件路径 /etc/sysconfig/network-scripts/ifcfg- #compiz https://spins.fedoraproject.org/mate-compiz/download/index.html |
refer to:
http://blog.chinaunix.net/uid-28461677-id-5766451.html
https://blog.csdn.net/weixin_33842304/article/details/91443399
https://unix.stackexchange.com/questions/4034/how-can-i-disown-a-running-process-and-associate-it-to-a-new-screen-shell
https://blog.csdn.net/wuzhong8809/article/details/117450302
https://stackoverflow.com/questions/18312935/find-file-in-linux-then-report-the-size-of-file-searched
https://www.toutiao.com/a7073448755428688399/
https://www.likecs.com/show-695436.html
linux驱动备忘录
驱动签名
1 2 3 4 5 | CONFIG_MODULE_SIG=y # CONFIG_MODULE_SIG_FORCE is not set CONFIG_MODULE_SIG_ALL=y ${KERNEL_SRC}/scripts/sign-file sha512 ${KERNEL_SRC}/certs/signing_key.pem ${KERNEL_SRC}/certs/signing_key.x509 hello.ko |
驱动调试
debugee
1 2 3 4 5 6 7 | MOD_NAME=simple_mod insmod ./${MOD_NAME}.ko MOD_TEXT=`cat /sys/module/${MOD_NAME}/sections/.text` MOD_DATA=`cat /sys/module/${MOD_NAME}/sections/.data` MOD_BSS=`cat /sys/module/${MOD_NAME}/sections/.bss` MOD_ADD="add-symbol-file /path/to/${MOD_NAME}.ko ${MOD_TEXT} -s .data ${MOD_DATA} -s .bss ${MOD_BSS}" echo ${MOD_ADD} |
debugger
1 | (gdb) ${MOD_ADD} |
refer to:
https://www.cnblogs.com/rivsidn/p/9481037.html
https://www.cnblogs.com/powerrailgun/p/12161295.html
https://blog.csdn.net/chdhust/article/details/8820628
vmware linux共享文件夹未启动
1 2 3 | sudo dnf install open-vm-tools-desktop umount /mnt/hgfs sudo /usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000 -o umask=022 |
如果还不行,比如更新内核后,就要重新安装open-vm-tools。
refer to:
https://blog.csdn.net/xcyja/article/details/117328301
linux关闭或开启网络端口
关闭80端口
1 | iptables -A INPUT -ptcp --dport 80 -j DROP |
而开启80端口要看情况,不能简单的一句
1 | iptables -A INPUT -ptcp --dport 80 -j ACCEPT |
因为其中的-A表示append一条规则到规则链上,之前存在一条DROP链,其后再加一条ACCEPT链,80端口还是会被禁掉。
先用如下命令看一下规则链
1 | iptables -L |
把DROP那一链删掉
1 2 | iptables -D INPUT -ptcp --dport 80 -j ACCEPT iptables -D INPUT -ptcp --dport 80 -j DROP |
如果默认是所有端口都禁用,那就在空链里加一条ACCEPT链。
最后保存
1 | iptables-save |