+create_get_initrd() {
echo "Creating initrd.lkp via container/dracut-initrd..."
cd "$CCI_SRC/container/dracut-initrd" || {
echo "Failed to change into $CCI_SRC/container/dracut-initrd"
exit 6
}
./run "$ROOTFS_DIR/lib/modules/$ROOTFS_KERNEL"
echo "Finding initrd.lkp under $ROOTFS_DIR/boot ..."
cd "$ROOTFS_DIR" || {
echo "Failed to change into dir \"$ROOTFS_DIR\""
exit 7
}
local initrd_lkp
initrd_lkp=$(find ./boot -name "initramfs.lkp*") && export ROOTFS_INITRD_LKP=$initrd_lkp
[ -f "$ROOTFS_INITRD_LKP" ] || {
echo "Failed to generate \"$ROOTFS_INITRD_LKP\""
exit 8
}
echo
^ Redundant echo??
Thanks, Zhangyu
echo "initrd_lkp: $ROOTFS_INITRD_LKP"
+}
+get_rootfs_kernel() +{
- echo "Finding vmlinuz under $ROOTFS_DIR/boot ..."
- cd "$ROOTFS_DIR" || {
echo "Failed to change into dir \"$ROOTFS_DIR\""
exit 5
- }
- local vmlinuz_file
- local vmlinuz kernel
- vmlinuz_file=$(find ./boot -name "vmlinuz-*" |grep -v rescue) && export ROOTFS_VMLINUZ_FILE=$vmlinuz_file
- vmlinuz=$(basename "$vmlinuz_file") && export ROOTFS_VMLINUZ=$vmlinuz
- kernel=${vmlinuz:8} && export ROOTFS_KERNEL=$kernel
- echo "vmlinuz: $ROOTFS_VMLINUZ_FILE"
- echo "kernel: $ROOTFS_KERNEL"
+}
+create_links_vmlinuz_initrd() +{
- export ROOTFS_DIR=$1
- get_rootfs_kernel
- create_get_initrd
- echo "Creating links to initrd.lkp and vmlinuz..."
- cd $ROOTFS_DIR
- ln -fs $ROOTFS_INITRD_LKP initrd.lkp
- cd $ROOTFS_DIR/boot
- ln -fs $ROOTFS_VMLINUZ vmlinuz
- echo "[INFO] Create links to initrd.lkp and vmlinuz success!"
+}
2.23.0