diff --git a/lava/board_setup.sh b/lava/board_setup.sh index e4cbd46..8abd97c 100755 --- a/lava/board_setup.sh +++ b/lava/board_setup.sh @@ -38,14 +38,15 @@ case ${DEVICE_TYPE} in file ${local_dtb} machine=${DEVICE_TYPE} case ${DEVICE_TYPE} in - dragonboard-845c) + dragonboard-410c|dragonboard-845c|qrb5165-rb5) ${kir}/repack_boot.sh -t "${machine}" -d "${local_dtb}" -k "${local_kernel}" -m "${local_modules}" -i "${local_initrd}" + ${kir}/resize_rootfs.sh -s -f "${local_rootfs}" ;; *) ${kir}/repack_boot.sh -t "${machine}" -d "${local_dtb}" -k "${local_kernel}" + ${kir}/resize_rootfs.sh -s -f "${local_rootfs}" -o "${local_modules}" ;; esac - ${kir}/resize_rootfs.sh -s -f "${local_rootfs}" -o "${local_modules}" ;; nfs-dragonboard-845c) diff --git a/repack_boot.sh b/repack_boot.sh index 084b26f..49dec56 100755 --- a/repack_boot.sh +++ b/repack_boot.sh @@ -97,35 +97,33 @@ case ${TARGET} in fi cat "${KERNEL_FILE}" "${DTB_FILE}" > zImage+dtb - echo "This is not an initrd">initrd.img - initrd_filename="initrd.img" + mkdir -p modules_dir/usr + unpack_tar_file "${MODULES_FILE}" modules_dir/usr + cd modules_dir + find . | cpio -o -H newc -R +0:+0 | gzip -9 > ../modules.cpio.gz + cd - + initrd_filename="initrd.cpio.gz" + cat "${INITRD_FILE}" modules.cpio.gz > "${initrd_filename}" # NFS_SERVER_IP and NFS_ROOTFS exported from the environment. echo ${NFS_SERVER_IP} and ${NFS_ROOTFS} nfscmdline="root=/dev/nfs nfsroot=$NFS_SERVER_IP:$NFS_ROOTFS,nfsvers=3 ip=dhcp" console_cmdline="console=tty0 console=ttyMSM0,115200n8" - cmdline_extra="" + cmdline_extra="copy_modules" case ${TARGET} in dragonboard-410c) - cmdline="root=/dev/mmcblk0p14 rw rootwait ${console_cmdline}" + cmdline="root=/dev/mmcblk0p14 rw rootwait ${console_cmdline} ${cmdline_extra}" pagasize=2048 ;; dragonboard-845c) - mkdir -p modules_dir/usr - unpack_tar_file "${MODULES_FILE}" modules_dir/usr - cd modules_dir - find . | cpio -o -H newc -R +0:+0 | gzip -9 > ../modules.cpio.gz - cd - - cat "${INITRD_FILE}" modules.cpio.gz > final-initrd.cpio.gz - initrd_filename="final-initrd.cpio.gz" - cmdline_extra="clk_ignore_unused pd_ignore_unused" + cmdline_extra="${cmdline_extra} clk_ignore_unused pd_ignore_unused" cmdline="root=/dev/sda1 init=/sbin/init rw ${console_cmdline} ${cmdline_extra} -- " pagasize=4096 ;; qrb5165-rb5) - cmdline="root=PARTLABEL=rootfs rw rootwait earlycon debug ${console_cmdline}" + cmdline="root=PARTLABEL=rootfs rw rootwait earlycon debug ${console_cmdline} ${cmdline_extra}" pagasize=4096 ;; esac diff --git a/resize_rootfs.sh b/resize_rootfs.sh index 4ce0dea..f14daea 100755 --- a/resize_rootfs.sh +++ b/resize_rootfs.sh @@ -46,43 +46,49 @@ while getopts "cd:f:hm:o:sz" arg; do done -OVERLAY_FILE=$(curl_me "${OVERLAY_URL}") ROOTFS_FILE=$(curl_me "${ROOTFS_URL}") -overlay_file_type=$(file "${OVERLAY_FILE}") -rootfs_file_type=$(file "${ROOTFS_FILE}") -overlay_size=$(find_extracted_size "${OVERLAY_FILE}" "${overlay_file_type}") -rootfs_size=$(find_extracted_size "${ROOTFS_FILE}" "${rootfs_file_type}") +if [[ -n "${OVERLAY_URL}" ]]; then + OVERLAY_FILE=$(curl_me "${OVERLAY_URL}") + overlay_file_type=$(file "${OVERLAY_FILE}") + overlay_size=$(find_extracted_size "${OVERLAY_FILE}" "${overlay_file_type}") -mount_point_dir=$(get_mountpoint_dir) + rootfs_file_type=$(file "${ROOTFS_FILE}") + rootfs_size=$(find_extracted_size "${ROOTFS_FILE}" "${rootfs_file_type}") -echo ${mount_point_dir} + mount_point_dir=$(get_mountpoint_dir) -new_file_name=$(get_new_file_name "${ROOTFS_FILE}" ".new.rootfs") -new_size=$(get_new_size "${overlay_size}" "${rootfs_size}" "${EXTRA_SIZE}") -if [[ "${ROOTFS_FILE}" =~ ^.*.tar* ]]; then - get_and_create_a_ddfile "${new_file_name}" "${new_size}" -else - new_file_name=$(basename "${ROOTFS_FILE}" .gz) - get_and_create_new_rootfs "${ROOTFS_FILE}" "${new_file_name}" "${new_size}" -fi + echo ${mount_point_dir} -if [[ "${ROOTFS_FILE}" =~ ^.*.tar* ]]; then - unpack_tar_file "${ROOTFS_FILE}" "${mount_point_dir}" -fi + new_file_name=$(get_new_file_name "${ROOTFS_FILE}" ".new.rootfs") + new_size=$(get_new_size "${overlay_size}" "${rootfs_size}" "${EXTRA_SIZE}") + if [[ "${ROOTFS_FILE}" =~ ^.*.tar* ]]; then + get_and_create_a_ddfile "${new_file_name}" "${new_size}" + else + new_file_name=$(basename "${ROOTFS_FILE}" .gz) + get_and_create_new_rootfs "${ROOTFS_FILE}" "${new_file_name}" "${new_size}" + fi -if [[ $clear_modules -eq 1 ]]; then - rm -rf "${mount_point_dir}"/lib/modules/* -fi -unpack_tar_file "${OVERLAY_FILE}" "${mount_point_dir}" + if [[ "${ROOTFS_FILE}" =~ ^.*.tar* ]]; then + unpack_tar_file "${ROOTFS_FILE}" "${mount_point_dir}" + fi -if [[ "${ROOTFS_FILE}" =~ ^.*.tar* ]]; then - cd "${mount_point_dir}" - tar -cJf ../"${new_file_name}".tar.xz . - cd .. -fi + if [[ $clear_modules -eq 1 ]]; then + rm -rf "${mount_point_dir}"/lib/modules/* + fi -virt_copy_in ${new_file_name} ${mount_point_dir} + unpack_tar_file "${OVERLAY_FILE}" "${mount_point_dir}" + + if [[ "${ROOTFS_FILE}" =~ ^.*.tar* ]]; then + cd "${mount_point_dir}" + tar -cJf ../"${new_file_name}".tar.xz . + cd .. + fi + + virt_copy_in ${new_file_name} ${mount_point_dir} +else + new_file_name="${ROOTFS_FILE}" +fi if [[ ${sparse_needed} -eq 1 ]]; then img_file="$(basename "${new_file_name}" .ext4).img"