check if binwalk has already been run
This commit is contained in:
parent
ffbe350dd4
commit
791de19297
|
@ -23,14 +23,14 @@ invoke_terminal() {
|
|||
|
||||
enable_debug_console() {
|
||||
local tty="$1"
|
||||
info -e '\033[1;33m[cros_debug] enabled on '${tty}'.\033[m'
|
||||
echo -e '\033[1;33m[cros_debug] enabled on '${tty}'.\033[m'
|
||||
invoke_terminal "${tty}" "[Bootstrap Debug Console]" "/bin/busybox sh"
|
||||
}
|
||||
|
||||
|
||||
main() {
|
||||
info "...:::||| Bootstrapping ChromeOS Factory Shim |||:::..."
|
||||
info "TTY: ${TTY}, LOG: ${LOG_TTY}, INFO: ${INFO_TTY}, DEBUG: ${DEBUG_TTY}"
|
||||
echo "...:::||| Bootstrapping ChromeOS Factory Shim |||:::..."
|
||||
echo "TTY: ${TTY}, LOG: ${LOG_TTY}, echo: ${echo_TTY}, DEBUG: ${DEBUG_TTY}"
|
||||
echo "idk please work"
|
||||
|
||||
enable_debug_console "/dev/pts/0"
|
||||
|
|
13
build.sh
13
build.sh
|
@ -50,20 +50,27 @@ kernel_loop="${shim_loop}p2" #KERN-A should always be p2
|
|||
|
||||
echo "copying shim kernel to new file in /tmp"
|
||||
kernel_dir=/tmp/shim_kernel
|
||||
rm -rf $kernel_dir
|
||||
mkdir $kernel_dir -p
|
||||
dd if=$kernel_loop of=$kernel_dir/kernel.bin bs=1M status=none
|
||||
|
||||
echo "extracting data from kernel"
|
||||
previous_dir=$(pwd)
|
||||
cd $kernel_dir
|
||||
binwalk_out=$(binwalk --extract kernel.bin --run-as=root)
|
||||
if [ -e "${kernel_dir}/binwalk.out" ]; then
|
||||
#don't run binwalk again if we don't need to
|
||||
binwalk_out=$(cat $kernel_dir/binwalk.out)
|
||||
else
|
||||
binwalk_out=$(binwalk --extract kernel.bin --run-as=root)
|
||||
echo $binwalk_out > $kernel_dir/binwalk.out
|
||||
fi
|
||||
#i can't be bothered to learn how to use sed
|
||||
extracted_file=$(echo $binwalk_out | pcregrep -o1 "\d+\s+0x([0-9A-F]+)\s+gzip compressed data")
|
||||
|
||||
echo "extracting initramfs archive from kernel (this may take a while)"
|
||||
cd _kernel.bin.extracted/
|
||||
binwalk --extract $extracted_file --run-as=root > /dev/null
|
||||
if [ ! -e "_${extracted_file}.extracted/" ]; then
|
||||
binwalk --extract $extracted_file --run-as=root > /dev/null
|
||||
fi
|
||||
cd "_${extracted_file}.extracted/"
|
||||
cpio_file=$(file ./* | pcregrep -o1 "([0-9A-F]+):\s+ASCII cpio archive")
|
||||
|
||||
|
|
Loading…
Reference in New Issue