Test environment: PetaLinux 2021.2
During development, it is often necessary to check the contents of the rootfs. Using the command, “gzip -d rootfs.cpio.gz”, “cpio -i < rootfs.cpio”, you can decompress the contents of rootfs.cpio.gz.
If you decompress frequently, you can use the following script to simplify the operation.
#!/bin/bash echo -e "\nBegin to run script: $0" # array definition, work for /bin/bash, does not work for /bin/sh file_array_check=( bl31.bin bl31.elf BOOT.BIN boot.scr Image image.ub rootfs.cpio.gz rootfs.manifest system.dtb u-boot.bin u-boot.elf vmlinux ) # Get array elements number file_array_check_length=${#file_array_check[@]} # C-language style loop # Check PetaLinux image/linux directory. for (( i=0; i<$file_array_check_length; i++)) { CHECK_FILE=${file_array_check[i]} echo "Check No.$i directory: $CHECK_FILE"; if [ ! -f $CHECK_FILE ]; then echo "Not PetaLinux project image directory. No file: $CHECK_FILE. " echo "Exit." exit 1 fi } mkdir -p rootfs rm -rf ./rootfs/* ls -l ./rootfs cd rootfs cp ../rootfs.cpio.gz ./ gzip -d rootfs.cpio.gz cpio -i < rootfs.cpio ls -l cd ../
Similar Posts:
- cpio: cannot seek on output: Invalid argument [How to Solve]
- [Solved] Fatal error: OpenSSL/EVP. H: there is no such file or directory
- “This computer doesn’t have VT-X/AMD-v enabled. Enabling it in the BIOS is mandatory”
- Linux shell script execution error: bad substitution [How to Solve]
- Shell script execution error [: 0: unary operator expected
- Script error: unary operator expected [How to Solve]
- How to Solve Error: spring-boot-maven-plugin not found
- [Solved] Intellj Building image Error: ADD failed: no source files were specified
- Wnmp environment configuration (Windows + nginx + MySQL + PHP)
- How to Replace log4j with shell Script in Bulk