mirror of
https://github.com/superconvert/smart-os.git
synced 2024-11-22 18:20:30 +08:00
add root user login
This commit is contained in:
parent
e3134d0cd4
commit
a18b5073ee
@ -163,12 +163,13 @@ make_init
|
||||
|
||||
# 指定了利用 /etc/init.d/rcS 启动
|
||||
cat<<"EOF">etc/inittab
|
||||
::sysinit:echo "sysinit 1++++++++++++++++++++++++++++++++++++++"
|
||||
::sysinit:/etc/init.d/rcS
|
||||
::sysinit:echo "sysinit 2++++++++++++++++++++++++++++++++++++++"
|
||||
::restart:/sbin/init
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
::shutdown:/bin/umount -a -r
|
||||
::shutdown:/sbin/swapoff -a
|
||||
::sysinit:echo "sysinit 1++++++++++++++++++++++++++++++++++++++"
|
||||
::sysinit:/etc/init.d/rcS
|
||||
::sysinit:echo "sysinit 2++++++++++++++++++++++++++++++++++++++"
|
||||
tty1::once:echo "hello smart-os tty1"
|
||||
tty1::respawn:/bin/sh
|
||||
tty2::once:echo "hello smart-os tty2"
|
||||
@ -196,6 +197,12 @@ if [ "${with_gcc}" = true ]; then
|
||||
fi
|
||||
rm -rf ${diskfs}/init ${diskfs}/lost+found
|
||||
|
||||
# 测试用户登陆模式: root/123456
|
||||
if [ "${with_login}" = true ]; then
|
||||
echo "${RED} with-login --- it's an exciting time ${NC}"
|
||||
./mk_login.sh ${diskfs}
|
||||
fi
|
||||
|
||||
# 我们测试驱动, 制作的镜像启动后,我们进入此目录 insmod hello_world.ko 即可
|
||||
./mk_drv.sh $(pwd)/${diskfs}/lib/modules
|
||||
# 编译网卡驱动 ( 目前版本内核已集成 e1000 )
|
||||
@ -211,6 +218,12 @@ menuentry "smart-os" {
|
||||
}
|
||||
EOF
|
||||
|
||||
# 生成 /etc/resolv.conf 文件
|
||||
cat -> ${diskfs}/etc/resolv.conf << EOF
|
||||
nameserver 8.8.8.8
|
||||
nameserver 114.114.114.114
|
||||
EOF
|
||||
|
||||
# 生成 /etc/init.d/rcS 文件
|
||||
title=$(cat<<EOF
|
||||
\e[0;36m
|
||||
@ -235,7 +248,6 @@ cd /lib/modules && insmod hello_world.ko
|
||||
# dns 测试 busybox 必须动态编译 动态编译 glibc 已经集成 dns 功能
|
||||
ifconfig eth0 192.168.100.6 && ifconfig eth0 up
|
||||
route add default gw 192.168.100.1
|
||||
echo "nameserver 114.114.114.114" >> /etc/resolv.conf
|
||||
|
||||
# exec 执行 /etc/init.d/rc.local 脚本
|
||||
EOF
|
||||
|
@ -1,5 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
#---------------------
|
||||
# 初始化公共环境
|
||||
#---------------------
|
||||
. ./common.sh
|
||||
|
||||
#---------------------
|
||||
# 停掉 NAT
|
||||
#---------------------
|
||||
@ -74,18 +79,22 @@ stop_dns() {
|
||||
#----------------------------------------------
|
||||
start_nat
|
||||
|
||||
rm -rf ./qemu.log
|
||||
# 启动镜像 网络对应 run_nat.sh 里面的配置
|
||||
qemu-system-x86_64 -serial file:./qemu.log -drive format=raw,file=disk.img -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0
|
||||
|
||||
# stop nat
|
||||
stop_nat
|
||||
|
||||
#----------------------------------------------------
|
||||
#
|
||||
# 多硬盘测试 -hdb extra.img
|
||||
#
|
||||
#----------------------------------------------------
|
||||
# ./mk_sdb.sh
|
||||
# qemu-system-x86_64 -drive format=raw,file=disk.img -hdb extra.img
|
||||
if [ "${with_sdb}" = false ]; then
|
||||
sdb_img=""
|
||||
else
|
||||
./mk_sdb.sh
|
||||
sdb_img="-hdb extra.img"
|
||||
fi
|
||||
|
||||
rm -rf ./qemu.log
|
||||
# 启动镜像 网络对应 run_nat.sh 里面的配置
|
||||
qemu-system-x86_64 -drive format=raw,file=disk.img ${sdb_img} -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0
|
||||
#qemu-system-x86_64 -serial file:./qemu.log -drive format=raw,file=disk.img -netdev tap,id=nd0,ifname=tap0 -device e1000,netdev=nd0
|
||||
|
||||
# stop nat
|
||||
stop_nat
|
||||
|
@ -4,6 +4,12 @@ core_num=`nproc`
|
||||
# 是否开启 gcc
|
||||
with_gcc=false
|
||||
|
||||
# 是否挂载第二块硬盘
|
||||
with_sdb=false
|
||||
|
||||
# 是否登陆模式
|
||||
with_login=false
|
||||
|
||||
# 编译工程目录
|
||||
build_dir=`pwd`"/build"
|
||||
|
||||
|
40
mk_login.sh
Executable file
40
mk_login.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/bin/sh
|
||||
|
||||
diskfs=$1
|
||||
|
||||
# 用户组文件
|
||||
cat<<EOF>${diskfs}/etc/group
|
||||
root:x:0:root
|
||||
EOF
|
||||
|
||||
# 用户密码文件
|
||||
cat<<EOF>${diskfs}/etc/passwd
|
||||
root:x:0:0:root:/:/bin/sh
|
||||
EOF
|
||||
|
||||
# 用户 shadow 文件
|
||||
cat<<EOF>${diskfs}/etc/shadow
|
||||
root:\$1\$abcdefgh\$KJHEbEnUJaxWv269o9nH60:1:0:99999:7:::
|
||||
EOF
|
||||
|
||||
# 用户 hostname 文件
|
||||
cat<<EOF>${diskfs}/etc/hostname
|
||||
localhost
|
||||
EOF
|
||||
|
||||
# 用户 profile 文件
|
||||
cat<<EOF>${diskfs}/etc/profile
|
||||
HOSTNAME=$(/bin/hostname -F /etc/hostname)
|
||||
PS1="[\u@\h \w]\# "
|
||||
export PS1 HOSTNAME
|
||||
EOF
|
||||
|
||||
cat<<EOF>${diskfs}/etc/inittab
|
||||
::sysinit:/bin/hostname -F /etc/hostname
|
||||
::sysinit:/etc/init.d/rcS
|
||||
tty0::respawn:-/bin/login
|
||||
::restart:/sbin/init
|
||||
::ctrlaltdel:/sbin/reboot
|
||||
::shutdown:/bin/umount -a -r
|
||||
::shutdown:/sbin/swapoff -a
|
||||
EOF
|
6
mk_xorg.sh
Executable file
6
mk_xorg.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
wget https://www.x.org/archive/individual/xserver/xorg-server-1.20.11.tar.bz2
|
||||
tar xf xorg-server-1.20.11.tar.bz2 -C ./
|
||||
apt install xutils-dev libtool m4 pkg-config xtrans-dev libpixman-1-dev libdrm-dev libx11-dev libgl-dev libgcrypt-dev libxkbfile-dev libxfont-dev libpciaccess-dev libepoxy-dev libgbm-dev libegl1-mesa-dev -y
|
||||
cd xorg-server-1.20.11 && ./autogen.sh
|
Loading…
Reference in New Issue
Block a user