Skip to content

Commit

Permalink
use maintain kernel for unmatched
Browse files Browse the repository at this point in the history
Signed-off-by: Han Gao <[email protected]>
  • Loading branch information
RevySR committed Dec 6, 2022
1 parent 2f88e7e commit 6b77eb5
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 26 deletions.
50 changes: 26 additions & 24 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down Expand Up @@ -398,4 +400,4 @@ task:
path: "${DISTURB}-kernel-${base_path}-*.tar.zst"

upload_artifacts:
path: "${DISTURB}-*-*.img.zst"
path: "${DISTURB}-*-*.img.zst*"
2 changes: 2 additions & 0 deletions scripts/clean_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
}

Expand Down
2 changes: 2 additions & 0 deletions scripts/machine_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ machine_info() {
lscpu
whoami
env
fdisk -l
df -h
}

init() {
Expand Down
2 changes: 1 addition & 1 deletion scripts/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
9 changes: 9 additions & 0 deletions scripts/update_rootfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion sifive/grub.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit 6b77eb5

Please sign in to comment.