前言
在liunx系统内修改密码就直接进去passwd,没啥好说的。这里介绍怎么在liunxSDK里修改,就是让编译出来的镜像就自带登录密码。
官方解决方案
首先在T113-i_v1.0/buildroot/buildroot-201902目录下执行make menuconfig,按照如下方式修改登录密码以及登录方式。
然后在T113-i_v1.0/buildroot/buildroot-201902/target/post_build.sh设置取消登录配置。
这里贴个该文件改后的内容,方便copy,对照:
#!/bin/sh
#
# Start the preinit
#
# Commented ttyS0
grep "#ttyS0::respawn:" ${TARGET_DIR}/etc/inittab >/dev/null
if [ $? -ne 0]; then
sed -i 's/ttyS0/#&/' ${TARGET_DIR}/etc/inittab
sed -i 's/ttyAS0/#&/' ${TARGET_DIR}/etc/inittab
fi
# Support autologin with root user
if [ -e ${TARGET_DIR}/etc/inittab ]; then
sed -i '/console::respawn-\/sbin\/agetty/d' ${TARGET_DIR}/etc/inittab#
# sed -i '/# Put a getty on the serial port/a\console::respawn:-/sbin/agetty --keep-baud 115200,38400,9600 console --autologin root' \
sed -i '/# Put a getty on the serial port/a\ttyAS0::respawn:/sbin/getty -L ttyAS0 115200 vt100 # GENERIC SERIAL' \
${TARGET_DIR}/etc/inittab
fi
执行./build.sh和./build.sh pack重新进行编译和打包生成镜像。启动进行测试。
遇到的问题
当其他应用程序也要用到ttyAS0的时候,会遇到他一直报,频率还有点快,一秒钟2帧的样子,频率应该是跟我应用程序是有点关系的:
问题解决办法
在T113-i_v1.0/buildroot/buildroot-201902/target/post_build.sh里,修改ttyAS0为console:
#!/bin/sh
#
# Start the preinit
#
# Commented ttyS0
grep "#ttyS0::respawn:" ${TARGET_DIR}/etc/inittab >/dev/null
if [ $? -ne 0]; then
sed -i 's/ttyS0/#&/' ${TARGET_DIR}/etc/inittab
sed -i 's/ttyAS0/#&/' ${TARGET_DIR}/etc/inittab
fi
# Support autologin with root user
if [ -e ${TARGET_DIR}/etc/inittab ]; then
sed -i '/console::respawn-\/sbin\/agetty/d' ${TARGET_DIR}/etc/inittab#
# sed -i '/# Put a getty on the serial port/a\console::respawn:-/sbin/agetty --keep-baud 115200,38400,9600 console --autologin root' \
sed -i '/# Put a getty on the serial port/a\console::respawn:/sbin/getty -L console 115200 vt100 # GENERIC SERIAL' \
${TARGET_DIR}/etc/inittab
fi
执行./build.sh和./build.sh pack重新进行编译和打包生成镜像。启动进行测试,我这没报BusyBox了。