From 6b77eb5ba0986267b6f18f86459e9a0c15b9244d Mon Sep 17 00:00:00 2001 From: Han Gao Date: Mon, 5 Dec 2022 15:11:21 +0800 Subject: [PATCH] use maintain kernel for unmatched Signed-off-by: Han Gao --- .cirrus.yml | 50 +++++++++++++++++++++------------------- scripts/clean_rootfs.sh | 2 ++ scripts/machine_init.sh | 2 ++ scripts/publish.sh | 2 +- scripts/update_rootfs.sh | 9 ++++++++ sifive/grub.cfg | 2 +- 6 files changed, 41 insertions(+), 26 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 9d93f9e..ecd65fe 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -113,28 +113,30 @@ task: uboot_git: https://github.com/u-boot/u-boot.git uboot_config: sifive_unmatched_defconfig kernel_script: | - git clone --depth=1 -b ${kernel_branch} ${kernel_git} kernel - pushd kernel - make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv ${kernel_config} - if [ -f ../${base_path}/kernelconfig ]; then - cp -v ../${base_path}/kernelconfig .config - fi - sed -i '/CONFIG_LOCALVERSION_AUTO/d' .config && echo "CONFIG_LOCALVERSION_AUTO=n" >> .config - make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv -j$(nproc) - if [ x"$(cat .config | grep CONFIG_MODULES=y)" = x"CONFIG_MODULES=y" ]; then - make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_MOD_PATH=../rootfs/ modules_install -j$(nproc) - fi - make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_PATH=../rootfs/boot install -j$(nproc) - make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv bindeb-pkg -j$(nproc) - # Install DTB - cp -v arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dtb ../rootfs/boot/ - - # Copy kernel Deb to root HOME - cp -v ../*.deb ../rootfs/root/ - - cp -v .config ../rootfs/boot/latest-config - ls -al ../rootfs/boot/ - popd + cp -v ./rootfs/boot/config-* ./rootfs/boot/latest-config + echo "Skip & install maintain-kernel" + # git clone --depth=1 -b ${kernel_branch} ${kernel_git} kernel + # pushd kernel + # make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv ${kernel_config} + # if [ -f ../${base_path}/kernelconfig ]; then + # cp -v ../${base_path}/kernelconfig .config + # fi + # sed -i '/CONFIG_LOCALVERSION_AUTO/d' .config && echo "CONFIG_LOCALVERSION_AUTO=n" >> .config + # make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv -j$(nproc) + # if [ x"$(cat .config | grep CONFIG_MODULES=y)" = x"CONFIG_MODULES=y" ]; then + # make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_MOD_PATH=../rootfs/ modules_install -j$(nproc) + # fi + # make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_PATH=../rootfs/boot install -j$(nproc) + # make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv bindeb-pkg -j$(nproc) + # # Install DTB + # cp -v arch/riscv/boot/dts/sifive/hifive-unmatched-a00.dtb ../rootfs/boot/ + + # # Copy kernel Deb to root HOME + # cp -v ../*.deb ../rootfs/root/ + + # cp -v .config ../rootfs/boot/latest-config + # ls -al ../rootfs/boot/ + # popd uboot_script: | DIR='opensbi' @@ -156,7 +158,7 @@ task: install_grub_script: | mkdir -p rootfs/boot/efi/efi/boot cp -v common/grubriscv64.efi rootfs/boot/efi/efi/boot/bootriscv64.efi - export kernel_version=$(ls rootfs/boot/ | grep vmlinuz- | sed 's/vmlinuz-//' | head -n 1 ) + export kernel_version=$(ls rootfs/boot/ | grep vmlinux- | sed 's/vmlinux-//' | head -n 1 ) cp -v $base_path/grub.cfg rootfs/boot/ sed -i "s/custom_kernel_version/$kernel_version/g" rootfs/boot/grub.cfg @@ -398,4 +400,4 @@ task: path: "${DISTURB}-kernel-${base_path}-*.tar.zst" upload_artifacts: - path: "${DISTURB}-*-*.img.zst" + path: "${DISTURB}-*-*.img.zst*" diff --git a/scripts/clean_rootfs.sh b/scripts/clean_rootfs.sh index 47faed5..62af5fe 100755 --- a/scripts/clean_rootfs.sh +++ b/scripts/clean_rootfs.sh @@ -27,6 +27,8 @@ clean_rootfs() { export file_name=${DISTURB}-${base_path}-$(date +%Y%m%d%H%M%S) mv rootfs.img ${file_name}.img zstd -T0 --ultra -20 $file_name.img + split -b 800M -d -a 1 $file_name.img.zst $file_name.img.zst. + rm $file_name.img.zst ls -al . } diff --git a/scripts/machine_init.sh b/scripts/machine_init.sh index c97e123..2bbcac4 100755 --- a/scripts/machine_init.sh +++ b/scripts/machine_init.sh @@ -8,6 +8,8 @@ machine_info() { lscpu whoami env + fdisk -l + df -h } init() { diff --git a/scripts/publish.sh b/scripts/publish.sh index d7ab98e..42b3214 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -12,7 +12,7 @@ fi file_content_type="application/octet-stream" -for fpath in $(ls *.zst) +for fpath in $(ls *.zst*) do echo "Uploading $fpath..." name=$(basename "$fpath") diff --git a/scripts/update_rootfs.sh b/scripts/update_rootfs.sh index af0c91c..8e06b73 100755 --- a/scripts/update_rootfs.sh +++ b/scripts/update_rootfs.sh @@ -13,8 +13,17 @@ update_rootfs() { chroot . /bin/bash -c "source /etc/profile && echo root:Riscv2022# | chpasswd" chroot . /bin/bash -c "source /etc/profile && echo deepin-riscv > /etc/hostname" chroot . /bin/bash -c "source /etc/profile && echo 'deepin-riscv 127.0.0.1' > /etc/hosts" + + chroot . /bin/bash -c "source /etc/profile && useradd -s /bin/bash -m -G sudo deepin" + chroot . /bin/bash -c "source /etc/profile && echo deepin:deepin | chpasswd" ls -al boot/ popd + if [ x"${base_path}" = x"sifive" ]; then + pushd rootfs + chroot . /bin/bash -c 'source /etc/profile && apt install -o DPkg::options::="--force-overwrite" -y linux-image-riscv64 linux-firmware' + chroot . /bin/bash -c 'source /etc/profile && cp /usr/lib/linux-image-*-riscv64/sifive/hifive-unmatched-a00.dtb /boot' + popd + fi } update_rootfs diff --git a/sifive/grub.cfg b/sifive/grub.cfg index d6a6fb7..34a315b 100644 --- a/sifive/grub.cfg +++ b/sifive/grub.cfg @@ -6,7 +6,7 @@ set debug="linux,loader,mm" set term="vt100" menuentry 'Deepin v23 unmatched' { - linux /vmlinuz-custom_kernel_version rw earlycon=sbi console=ttySIF0,115200 root=/dev/nvme0n1p3 rootwait cma=96M selinux=0 LANG=en_US.UTF-8 + linux /vmlinux-custom_kernel_version rw earlycon=sbi console=ttySIF0,115200 root=/dev/nvme0n1p3 rootwait cma=96M selinux=0 LANG=en_US.UTF-8 devicetree /hifive-unmatched-a00.dtb initrd /initrd.img-custom_kernel_version }