From 822197857ad8ee4fe20c2cf36674a133edffdfc3 Mon Sep 17 00:00:00 2001 From: David Harris Date: Tue, 21 Nov 2023 19:36:24 -0800 Subject: [PATCH] Updated buildroot scripts --- bin/wally-tool-chain-install.sh | 2 +- linux/Makefile | 2 +- linux/buildroot-scripts/Makefile | 45 ----------- .../start-buildroot-session.sh | 80 ------------------- 4 files changed, 2 insertions(+), 127 deletions(-) delete mode 100644 linux/buildroot-scripts/Makefile delete mode 100755 linux/buildroot-scripts/start-buildroot-session.sh diff --git a/bin/wally-tool-chain-install.sh b/bin/wally-tool-chain-install.sh index 26dd54c8d..373e354e9 100755 --- a/bin/wally-tool-chain-install.sh +++ b/bin/wally-tool-chain-install.sh @@ -47,7 +47,7 @@ sudo apt update -y sudo apt upgrade -y sudo apt install -y git gawk make texinfo bison flex build-essential python3 libz-dev libexpat-dev autoconf device-tree-compiler ninja-build libpixman-1-dev ncurses-base ncurses-bin libncurses5-dev dialog curl wget ftp libgmp-dev libglib2.0-dev python3-pip pkg-config opam z3 zlib1g-dev automake autotools-dev libmpc-dev libmpfr-dev gperf libtool patchutils bc # Other python libraries used through the book. -sudo pip3 install matplotlib scipy scikit-learn adjustText lief +sudo pip3 install sphinx sphinx_rtd_theme matplotlib scipy scikit-learn adjustText lief # needed for Ubuntu 22.04, gcc cross compiler expects python not python2 or python3. if ! command -v python &> /dev/null diff --git a/linux/Makefile b/linux/Makefile index 60303aaca..8d9be577b 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -39,7 +39,7 @@ Image: # source ../setup.sh; $(MAKE) disassemble install: - sudo cp -r $(BUILDROOT) $(RISCV)/$(BUILDROOT) + sudo mv -r $(BUILDROOT) $(RISCV)/$(BUILDROOT) # Temp rule for debugging test: diff --git a/linux/buildroot-scripts/Makefile b/linux/buildroot-scripts/Makefile deleted file mode 100644 index 6cb7f8f37..000000000 --- a/linux/buildroot-scripts/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -BUILDROOT := ${RISCV}/buildroot2023 -IMAGES := ${BUILDROOT}/output/images -DIS := ${IMAGES}/disassembly - -all: - make disassemble - make generate - -generate: - # generating device tree binary - dtc -I dts -O dtb ../devicetree/wally-virt.dts > ${IMAGES}/wally-virt.dtb - dtc -I dts -O dtb ../devicetree/wally-vcu108.dts > ${IMAGES}/wally-vcu108.dtb - -disassemble: - mkdir -p ${DIS} - # disassemblies - make -j ${DIS}/fw_jump.objdump ${DIS}/vmlinux.objdump ${DIS}/busybox.objdump ${DIS}/vmlinux.objdump.addr - # filesystem - make ${DIS}/rootfs/bin/busybox - # mkdir -p ${DIS}/rootfs - # -cd ${DIS}/rootfs; cpio -id --nonmatching 'dev/console' < ../../rootfs.cpio - -${DIS}/fw_jump.objdump: ${IMAGES}/fw_jump.elf - riscv64-unknown-elf-objdump -S ${IMAGES}/fw_jump.elf >> ${DIS}/fw_jump.objdump - -${IMAGES}/vmlinux: ${BUILDROOT}/output/build/linux-5.10.7/vmlinux - cp ${BUILDROOT}/output/build/linux-5.10.7/vmlinux ${IMAGES}/vmlinux - -${DIS}/vmlinux.objdump: ${IMAGES}/vmlinux - riscv64-unknown-elf-objdump -S ${IMAGES}/vmlinux >> ${DIS}/vmlinux.objdump - -${DIS}/vmlinux.objdump.addr: ${DIS}/vmlinux.objdump - -cd ${DIS}; extractFunctionRadix.sh vmlinux.objdump - -${DIS}/busybox.objdump: ${DIS}/rootfs/bin/busybox - riscv64-unknown-elf-objdump -S ${DIS}/rootfs/bin/busybox >> ${DIS}/busybox.objdump - -${DIS}/rootfs/bin/busybox: - mkdir -p ${DIS}/rootfs - -cd ${DIS}/rootfs; cpio -id --nonmatching 'dev/console' < ../../rootfs.cpio - - -clean: - rm -f ${IMAGES}/wally-virt.dtb - rm -rf ${DIS} diff --git a/linux/buildroot-scripts/start-buildroot-session.sh b/linux/buildroot-scripts/start-buildroot-session.sh deleted file mode 100755 index f93815b6c..000000000 --- a/linux/buildroot-scripts/start-buildroot-session.sh +++ /dev/null @@ -1,80 +0,0 @@ -script_dir=$(readlink -f ./) -personal_config=$(readlink -f ../buildroot-config-src) -shared_config=$RISCV/buildroot-config-src - -if [ -d "$shared_config" ]; then - echo "Hold the horses, friend!" >&2 - echo "There is already a buildroot-config-src folder in \$RISCV" >&2 - if [ ! -f "$shared_config/.owner" ]; then - echo "Oy vey -- it was improperly created too!" >&2 - echo "I see no .owner file in it!" >&2 - echo "Maybe just delete it." >&2 - exit 1 - fi - owner=$(cat $shared_config/.owner) - echo "It was created by $owner." >&2 - echo "Please contact them before overwriting their source files." >&2 - exit 1 -fi -echo "Starting new buildroot session" -# Copy configs to shared location -echo "Elevate permissions to copy ../buildroot-config-src to \$RISCV" -sudo cp -r "$personal_config" "$shared_config" -sudo chown -R cad $shared_config -# Document who created these configs -whoami>.owner -sudo mv .owner $shared_config -# Copy over main.config -echo "Copying main.config to buildroot/.config." -sudo cp $shared_config/main.config $RISCV/buildroot/.config -sudo chown cad $RISCV/buildroot/.config - -echo "==============================================" -echo "I'm about to sign you in as cad." -echo "" -echo "You can go straight to the \$RISCV/buildroot" -echo "and run \`make\` if you want." -echo "" -echo "You can also run:" -echo " * \`make menuconfig\`" -echo " * \`make linux-menuconfig\`" -echo " * \`make busybox-menuconfig\`" -echo "but if you do, you have to make extra certain" -echo "that you LOAD and SAVE configs from/to " -echo "\$RISCV/buildroot-config-src." -echo "" -echo "Run \`exit\` to sign out when you are done." -echo "And then any configs that were modified in" -echo "\$RISCV/buildroot-config-src will be copied" -echo "back to ../buildroot-config-src." -echo "==============================================" -read -p "Press any key to sign in as cad" -n1 -s -echo "" -cd $RISCV -sudo su cad -cd $script_dir - -echo "" -echo "Ending buildroot session" -if [ ! -d "$shared_config" ]; then - echo "Warning: $shared_config has already been deleted." - exit 0 -fi -if [ ! -f "$shared_config/.owner" ]; then - echo "Oy vey -- no .owner file found.">&2 - echo "Not sure whether to delete $shared_config.">&2 - exit 1 -fi -owner=$(cat "$shared_config"/.owner) -if [ $owner != $(whoami) ]; then - echo "Whoah there! It seems $owner created $shared_config.">&2 - echo "Ask them before deleting their work.">&2 - exit 1 -fi -echo "Copying modified configs from \$RISCV/buildroot-config-src back to ../buildroot-config-src." -for file in $personal_config/*; do - file=$(basename $file) - cp $shared_config/$file $personal_config/$file -done -echo "Elevate permissions to remove personal configs from shared location." -sudo rm -r $shared_config