diff --git a/build.sh b/build.sh index 52ff58c7fe28e1036d77f27da601aad5405eb4ea..d44af4dcc8730a83ea077aa568d09882e8d289ab 100755 --- a/build.sh +++ b/build.sh @@ -19,9 +19,6 @@ check_root_user OUTPUT="${SRC}/output" ROOTFS="${OUTPUT}/rootfs" -HOST="openEuler" -KUNPENG_USER="openEuler" -PASSWD="openEuler" CACHE_ROOTFS_NAME="openEuler-rootfs.tar.zst" HOST_ARCH=$(uname -m) @@ -33,10 +30,10 @@ DOWNLOAD_DIR="${OUTPUT}/download" LOG_DIR="${OUTPUT}/log" YUM_CONF="${OVERLAY_DIR}/etc/yum.repos.d/openEuler.repo" -CONFIG_RPM_LIST="${CONFIG_DIR}/rpmlist" +CONFIG_RPM_LIST="${CONFIG_DIR}/rpm.list" CONFIG_PY_LIST="${CONFIG_DIR}/python.list" CONFIG_RPM_URLS="${CONFIG_DIR}/urls" -SCRIPTS_CHROOT="${SCRIPTS_DIR}/chroot.sh" +SCRIPTS_CHROOT="${SCRIPTS_DIR}/make_cfg.sh" ############################################ [[ -d ${ROOTFS} ]] && rm -rf ${ROOTFS} @@ -52,7 +49,7 @@ source ${SRC}/scripts/install_driver_package.sh source ${SRC}/scripts/install_rpms.sh source ${SRC}/scripts/make_rootfs.sh source ${SRC}/scripts/make_image_310b.sh -source ${SRC}/config/user.cfg +source ${SRC}/config/board.cfg function main() { diff --git a/config/user.cfg b/config/board.cfg similarity index 78% rename from config/user.cfg rename to config/board.cfg index d8d33c11b57e277a05f124722796eb515e9794ff..2cac9ea29006fb0925e1f45600033e1d3bc8a5bd 100644 --- a/config/user.cfg +++ b/config/board.cfg @@ -1,9 +1,7 @@ ARCH="aarch64" RELEASEVER="22.03-LTS-SP3" -PASSWD="openEuler" -KUNPENG_USER="openEuler" +HOSTNAME="openEuler" COMPRESS_OUTPUTIMAGE="yes" -CACHE_ROOTFS_NAME="openEuler-rootfs.tar.zst" DRIVER_DIR="KunPengDevBoard-Driver" DRIVER_URL="https://gitee.com/kunpeng_compute/KunPengDevBoard-Driver" DRIVER_PACKAGE="Ascend-hdk-310b-npu-driver-soc_23.0.0_linux-aarch64-opiaipro.run" diff --git a/config/rpmlist b/config/rpm.list similarity index 100% rename from config/rpmlist rename to config/rpm.list diff --git a/scripts/install_driver_package.sh b/scripts/install_driver_package.sh index b55ae17b067816bdd08fa3a1a504d514d076995a..da6da80d2e46100fb4ca9d799980ad2c3f1d8d88 100755 --- a/scripts/install_driver_package.sh +++ b/scripts/install_driver_package.sh @@ -89,12 +89,10 @@ function config_openeuler() DM_USER="HwDmUser" BASE_USER="HwBaseUser" USER_PWD="HwHiAiUser:\$6\$klSpdQ1K\$4Gm/7HxehX.YSum4Wf3IDFZ3v5L.clybUpGNGaw9zAh3rqzqB4mWbxvSTFcvhbjY/6.tlgHhWsbtbAVNR9TSI/:17795:0:99999:7:::" - ROOT_PWD="root:\$6\$klSpdQ1K\$4Gm/7HxehX.YSum4Wf3IDFZ3v5L.clybUpGNGaw9zAh3rqzqB4mWbxvSTFcvhbjY/6.tlgHhWsbtbAVNR9TSI/:17795:0:99999:7:::" username=${USER_NAME} usergroup=${USER_NAME} password=${USER_PWD} - root_pwd=${ROOT_PWD} sys_user=${SYS_USER} sys_group=${SYS_USER} dm_user=${DM_USER} @@ -104,7 +102,7 @@ function config_openeuler() # add users run_on_rootfs "groupadd ${usergroup} >/dev/null 2>&1" - run_on_rootfs "useradd -g ${usergroup} -m ${username} -d /home/${username} -s /bin/bash >/dev/null 2>&1" + run_on_rootfs "useradd -u 1000 -g ${usergroup} -m ${username} -d /home/${username} -s /sbin/nologin >/dev/null 2>&1" run_on_rootfs "groupadd -g 1100 ${sys_group} >/dev/null 2>&1" run_on_rootfs "useradd -u 1100 -g ${sys_group} -s /sbin/nologin -m ${sys_user} >/dev/null 2>&1" run_on_rootfs "groupadd -g 1101 ${dm_group} >/dev/null 2>&1" @@ -118,12 +116,10 @@ function config_openeuler() run_on_rootfs "usermod -aG ${usergroup} ${base_user} >/dev/null 2>&1" sed -i "/^${username}:/c\\\\${password}" ${ROOTFS}/etc/shadow -# set hostname in hosts file -echo "${HOST}" > "${ROOTFS}"/etc/hostname cat <<-EOF > ${ROOTFS}/etc/hosts 127.0.0.1 localhost -127.0.1.1 ${HOST} -::1 localhost ${HOST} ip6-localhost ip6-loopback +127.0.1.1 ${HOSTNAME} +::1 localhost ${HOSTNAME} ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes diff --git a/scripts/chroot.sh b/scripts/make_cfg.sh similarity index 87% rename from scripts/chroot.sh rename to scripts/make_cfg.sh index be59e6594fd4ced3dc7515f548b1ddb30b5d7a6b..5391bf1a8931577228123ec77a6e40568278b7bd 100755 --- a/scripts/chroot.sh +++ b/scripts/make_cfg.sh @@ -8,9 +8,13 @@ systemctl enable systemd-timesyncd #systemctl set-default graphical.target echo openEuler > /etc/hostname + echo "openEuler" | passwd --stdin root -useradd -m -G "wheel" -s "/bin/bash" openEuler + +groupadd -g 1200 openEuler +useradd -u 1200 -m -G "openEuler" -s "/bin/bash" openEuler echo "openEuler" | passwd --stdin openEuler + if [ -f /usr/share/zoneinfo/Asia/Shanghai ]; then if [ -f /etc/localtime ]; then rm -f /etc/localtime diff --git a/scripts/make_rootfs.sh b/scripts/make_rootfs.sh index a9a987be9619ad3fe80d616f47d59f76ebc91c44..8e84e0cd7498020bd1ff1752bce0ef58a1ca1cc6 100755 --- a/scripts/make_rootfs.sh +++ b/scripts/make_rootfs.sh @@ -91,14 +91,14 @@ function fix_gnome() function process_chroot() { LOG "process chroot script ..." - cp -f ${SCRIPTS_CHROOT} ${ROOTFS}/chroot.sh - chmod +x ${ROOTFS}/chroot.sh + cp -f ${SCRIPTS_CHROOT} ${ROOTFS}/make_cfg.sh + chmod +x ${ROOTFS}/make_cfg.sh mount --bind /dev ${ROOTFS}/dev mount -t proc /proc ${ROOTFS}/proc mount -t sysfs /sys ${ROOTFS}/sys - chroot ${ROOTFS} /bin/bash -c "echo 'Y' | /chroot.sh" + chroot ${ROOTFS} /bin/bash -c "echo 'Y' | /make_cfg.sh" umount_all - rm -f ${ROOTFS}/chroot.sh + rm -f ${ROOTFS}/make_cfg.sh } function resume_repo()