Linux(Kali)安装Mysql(MariaDB)
情景说明因业务需要开展Linux系统内存优化,需要将所有数据源采集后存入数据库,方便后续查询和分析,以及可视化。先在PC上安装MySQL,进行建表和开发过程。
安装过程
使用apt安装mysql-server
sudo apt install mysql-server
使用apt安装的MySQL已经完成了启动和自启动,无需使用systemctl enable/start,可以使用下面的命令来启动/停止/查看状态
1234sudo service mysql status # 查看服务状态sudo service mysql start # 启动服务sudo service mysql stop # 停止服务sudo service mysql restart # 重启服务
安装完成后的MySQL还需要进行设置才能使用,否则无法连接上
sudo mysql_secure_installation
按照步骤输入安装密码,进行选择,完成安装
使用客户端测试连接
错误及其解决方法
Q: 1698 - Access denied for user ‘root‘@’localh ...
Add customization information in kernel boot time
添加自定义启动信息12345678910111213141516171819202122diff --git a/init/main.c b/init/main.cindex 9e6ab6d593bd..24f915fa4bb6 100644--- a/init/main.c+++ b/init/main.c@@ -874,6 +874,8 @@ static void __init print_unknown_bootoptions(void) asmlinkage __visible __init __no_sanitize_address __noreturn __no_stack_protector void start_kernel(void) {+ const char *custom_banner = "Welcome to rpi/Linux compiled by wanix1988";+ char *command_line; char *after_dashes; @@ -893,6 +895 ...
Pairing devices over Wi-Fi in Android
Android使用Wi-Fi配对的原理和实现原理Android Studio中插件实现的原理
源码
https://cs.android.com/android-studio/platform/tools/adt/idea/+/mirror-goog-studio-master-dev:android-adb/src/com/android/tools/idea/adb/wireless/WiFiPairingServiceImpl.kt
重点函数说明
2.1 检查adb mdns的支持状况
123456789101112131415161718192021222324252627282930313233343536override fun checkMdnsSupport(): ListenableFuture<MdnsSupportState> { // TODO: Investigate updating (then using) ddmlib instead of spawning an adb client command, so that ...
Hello World
Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.
Quick StartCreate a new post1$ hexo new "My New Post"
More info: Writing
Run server1$ hexo server
More info: Server
Generate static files1$ hexo generate
More info: Generating
Deploy to remote sites1$ hexo deploy
More info: Deployment
Debug Linux Kernel With KGDB
使用KGDB调试Linux Kernel(20181114)
Grub启动命令行中添加kgdboc=ttyS0,115200 kgdbwait nokaslra) rodata=off
这条好像没什么用?待验证
b)必须添加nokaslr,否则vmlinux符号会对不上,无法正常显示debug信息和下断点
使用socat做转发a) sudo socat -d -d /tmp/vboxsock PTY
记下打印出的转发设备,比如/dev/pts/4
这个操作要在串口连接虚拟机前做,不然就会直接退出,连接不上了
控制台不要关闭
如果没有权限连接/dev/pts/4,可以在gdb中执行下面的命令开启权限
sudo chmod 777 /dev/pts/4
不要在start_kernel处下断点,因为kgdb在start_kernel执行后才初始化,所以不会在start_kernel断下来
References
https://kgdb.wiki.kernel.org/index.php/Main_Page
https://kernelnewbies. ...
debug_linux_kernel_with_virtualbox
使用VirtualBox搭建Linux Kernel调试平台1.安装linux-source-$(uname -r)a) 最好在Host上安装/编译,然后将linux-source目录挂载到虚拟机中安装,如果在虚拟机中安装和编译,会导致debug kernel的时候无法访问源码和symbols
b) 如果/分区够大(free > 30GB),可以选择放在/usr/src目录下,否则找分区free空间较大的放置,防止空间不够
2.解压/usr/src/linux-source-$(uname -r),并修改相关目录权限3.使用make oldconfig创建模板config4.使用make menuconfig客制化选项 ==> 打开debug开关和所需其他功能5.make -j4 && make modules6.make install && make modules_install7.sudo mkinitramfs 4.15.0 -o /boot/initrd-4.15.8a) 这步必须要做,否则开机找不到initramfs会无法挂载/ ...
difference_between___stdcall___cdcel___fastcall
stdcall、cdcel和__fastcall三者的区别stdcall、cdecl和__fastcall是三种函数调用协议,函数调用协议会影响函数参数的入栈方式、栈内数据的清除方式、编译器函数名的修饰规则等。
调用协议常用场合
__stdcall:Windows API默认的函数调用协议。
__cdecl:C/C++默认的函数调用协议。
__fastcall:适用于对性能要求较高的场合。
函数参数入栈方式
__stdcall:函数参数由右向左入栈。
__cdecl:函数参数由右向左入栈。
__fastcall:从左开始不大于4字节的参数放入CPU的ECX和EDX寄存器,其余参数从右向左入栈。
问题一:__fastcall在寄存器中放入不大于4字节的参数,故性能较高,适用于需要高性能的场合。
栈内数据清除方式
__stdcall:函数调用结束后由被调用函数清除栈内数据。
__cdecl:函数调用结束后由函数调用者清除栈内数据。
__fastcall:函数调用结束后由被调用函数清除栈内数据。
问题一:不同编译器设定的栈结构不尽相同,跨开发平台时由函数调用者清除栈内数据不可行。
...
Running Arm64 Linux Kernel in Qemu
原由看了一下《奔跑吧Linux内核》这本书,决定好好研究一下ARM64平台,包括汇编和Linux Kernel相关的知识。网络上搜索到了之前他人搭建成功的帖子,自己照着做一遍却发现qemu启动后没有任何输出,查看进程占用率却非常高,感觉就是qemu cpu跑飞了。仔细思考后觉得问题一定出在编译器上面,所以下载了linaro提供的最新编译器,果然解决问题。下面把整个流程记录一下,方便后来人。
软件环境
Ubuntu 18.04 LTS
Qemu 2.11.1
Linaro aarch64 linux toolchain
Linux Kernel Torvalds 4.7 or 4.17
软件环境配置说明
Ubuntu 16.04或者18.04应该都没问题,但是12.04或者14.04可能需要源码编译qemu(未验证)
Qemu我尝试了source code build和直接通过sudo apt install qemu-system-aarch64来安装,都没有问题。source code build的时候都指明需要添加--target-list=aarch64-softmmu,我也 ...