mirror of
https://github.com/superconvert/smart-os.git
synced 2024-11-22 18:20:30 +08:00
1. fix can not ping issue 2. add xorg compile
This commit is contained in:
parent
e566478060
commit
a4d14c12f3
@ -197,4 +197,9 @@ fi
|
||||
|
||||
cd ..
|
||||
|
||||
# 编译 xorg-server
|
||||
if [ "${with_xorg}" = true ]; then
|
||||
./mk_xorg.sh
|
||||
fi
|
||||
|
||||
echo "Run the next script: 02_build_img.sh"
|
||||
|
@ -123,10 +123,10 @@ make_init() {
|
||||
cat<<"EOF">init
|
||||
#!/bin/sh
|
||||
# 必须首先挂载,否则 mdev 不能正常工作
|
||||
mount -t sysfs none /sys
|
||||
mount -t proc none /proc
|
||||
mount -t devtmpfs none /dev
|
||||
mount -t tmpfs none /tmp -o mode=1777
|
||||
mount -t sysfs sysfs /sys
|
||||
mount -t proc proc /proc
|
||||
mount -t devtmpfs udev /dev
|
||||
mount -t tmpfs tmpfs /tmp -o mode=1777
|
||||
# 必须挂载一下,否则下面的 mount 不上
|
||||
mdev -s
|
||||
mount -t ext3 /dev/sda1 /mnt
|
||||
@ -136,7 +136,7 @@ echo 0 > /proc/sys/kernel/printk
|
||||
echo /sbin/mdev > /proc/sys/kernel/hotplug
|
||||
echo -e "\n\e[0;32mBoot took $(cut -d' ' -f1 /proc/uptime) seconds\e[0m"
|
||||
mkdir -p /dev/pts
|
||||
mount -t devpts none /dev/pts
|
||||
mount -t devpts devpts /dev/pts
|
||||
# 切换之前,修改 mount 路径
|
||||
mount --move /dev /mnt/dev
|
||||
mount --move /sys /mnt/sys
|
||||
@ -224,6 +224,13 @@ nameserver 8.8.8.8
|
||||
nameserver 114.114.114.114
|
||||
EOF
|
||||
|
||||
cat -> ${diskfs}/etc/fstab << EOF
|
||||
# <file system> <dir> <type> <options> <dump> <pass>
|
||||
proc /proc proc defaults 0 0
|
||||
tmpfs /tmp tmpfs defaults 0 0
|
||||
sysfs /sys sysfs defaults 0 0
|
||||
EOF
|
||||
|
||||
# 生成 /etc/init.d/rcS 文件
|
||||
title=$(cat<<EOF
|
||||
\e[0;36m
|
||||
|
@ -54,7 +54,6 @@ start_nat() {
|
||||
# DNS 服务
|
||||
#----------------------
|
||||
start_dns() {
|
||||
|
||||
# 准备dnsmasq配置文件,启动dnsmasq服务,这样就能为虚拟机自动分配IP了
|
||||
cat<<EOF>dnsmasq.conf
|
||||
strict-order
|
||||
@ -70,11 +69,10 @@ dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
|
||||
addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
|
||||
EOF
|
||||
/usr/sbin/dnsmasq --conf-file=./dnsmasq.conf
|
||||
|
||||
}
|
||||
|
||||
stop_dns() {
|
||||
# 杀掉 dhcp 服务
|
||||
# 停止 dhcp 服务
|
||||
killall dnsmasq
|
||||
}
|
||||
|
||||
@ -95,10 +93,16 @@ else
|
||||
sdb_img="-hdb extra.img"
|
||||
fi
|
||||
|
||||
rm -rf ./qemu.log
|
||||
# 主磁盘
|
||||
disk="-drive format=raw,file=disk.img"
|
||||
|
||||
# grub 启动参数必须加上 console=ttyS0
|
||||
rm -rf ./qemu.log
|
||||
logfile="-serial file:./qemu.log"
|
||||
|
||||
# 网络参数
|
||||
network="-netdev tap,id=nd0,ifname=tap0,script=no,downscript=no -device e1000,netdev=nd0"
|
||||
|
||||
# 启动镜像 网络对应 run_nat.sh 里面的配置
|
||||
qemu-system-x86_64 ${disk} ${sdb_img} ${network} ${logfile}
|
||||
|
||||
|
@ -8,6 +8,7 @@ mkdir -p ./mnt1
|
||||
mount -t ext3 ${loop_dev} ./mnt1
|
||||
echo "/ ---------------------------------------"
|
||||
du ./mnt1 -h
|
||||
ls ./mnt1/etc
|
||||
echo "lib -------------------------------------"
|
||||
find ./mnt1 -name "*.a" -exec du -h {} \;
|
||||
umount ./mnt1
|
||||
|
@ -4,6 +4,9 @@ core_num=`nproc`
|
||||
# 是否开启 gcc
|
||||
with_gcc=false
|
||||
|
||||
# 是否开启 xorg
|
||||
with_org=false
|
||||
|
||||
# 是否挂载第二块硬盘
|
||||
with_sdb=false
|
||||
|
||||
@ -19,6 +22,7 @@ glibc_install=${build_dir}"/glibc_install"
|
||||
busybox_install=${build_dir}"/busybox_install"
|
||||
gcc_install=${build_dir}"/gcc_install"
|
||||
binutils_install=${build_dir}"/binutils_install"
|
||||
xorg_install=${build_dir}"/xorg_install"
|
||||
|
||||
# 从完整路径获取文件名
|
||||
file_name() {
|
||||
|
@ -6,6 +6,10 @@
|
||||
#
|
||||
#----------------------------------------------
|
||||
|
||||
if [ -f "extra.img" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "${CYAN}开始制作磁盘...${NC}"
|
||||
|
||||
# 创建磁盘 64M
|
||||
|
57
mk_xorg.sh
57
mk_xorg.sh
@ -1,6 +1,57 @@
|
||||
#!/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
|
||||
|
||||
#-----------------------------------------------
|
||||
#
|
||||
# 导入公共变量
|
||||
#
|
||||
#-----------------------------------------------
|
||||
. ./common.sh
|
||||
|
||||
XORG_SRC_URL=https://www.x.org/archive/individual/xserver/xorg-server-1.20.11.tar.bz2
|
||||
|
||||
#----------------------------
|
||||
#
|
||||
# 下载源码
|
||||
#
|
||||
#----------------------------
|
||||
mkdir -pv source
|
||||
cd source
|
||||
|
||||
XORG_SRC_NAME=$(file_name ${XORG_SRC_URL})
|
||||
if [ ! -f ${XORG_SRC_NAME} ]; then
|
||||
wget $XORG_SRC_URL
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
#---------------------------
|
||||
#
|
||||
# 解压源码
|
||||
#
|
||||
#---------------------------
|
||||
mkdir -pv ${build_dir}
|
||||
|
||||
XORG_SRC_DIR=${build_dir}"/"$(file_dirname ${XORG_SRC_NAME} .tar.bz2)
|
||||
if [ ! -d ${XORG_SRC_DIR} ]; then
|
||||
echo "unzip ${XORG_SRC_NAME} source code"
|
||||
tar xf source/${XORG_SRC_NAME} -C ${build_dir}
|
||||
fi
|
||||
|
||||
#---------------------------------------------
|
||||
#
|
||||
# 编译源码
|
||||
#
|
||||
#---------------------------------------------
|
||||
cd ${build_dir}
|
||||
|
||||
# 编译
|
||||
if [ ! -d "xorg_install" ]; then
|
||||
mkdir -pv xorg_install && cd ${XORG_SRC_DIR} && make distclean && ./autogensh
|
||||
./configure --prefix=/usr
|
||||
CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${xorg_install} && cd ..
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
Loading…
Reference in New Issue
Block a user