From ef3df0d60840cf3cc27624bc0fadd5c848999a1a Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 30 Dec 2024 23:11:26 +0200 Subject: [PATCH 1/2] Continued work on femtofox-config Also, moved the radio config files to /etc/meshtasticd/available.d/femtofox/ to match the PR to meshtastic firmware. --- .../{ => femtofox}/femtofox_LR1121_TCXO.yaml | 0 .../{ => femtofox}/femtofox_SX1262_TCXO.yaml | 0 .../{ => femtofox}/femtofox_SX1262_XTAL.yaml | 0 .../usr/local/bin/femto-meshtasticd-config.sh | 101 ++++++++ .../usr/local/bin/femtofox-config | 238 ++++++++++++++---- .../usr/local/bin/updatemeshtastic.sh | 2 +- .../usr/local/bin/usbconfig.sh | 20 +- 7 files changed, 295 insertions(+), 66 deletions(-) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/{ => femtofox}/femtofox_LR1121_TCXO.yaml (100%) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/{ => femtofox}/femtofox_SX1262_TCXO.yaml (100%) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/{ => femtofox}/femtofox_SX1262_XTAL.yaml (100%) create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox_LR1121_TCXO.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox/femtofox_LR1121_TCXO.yaml similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox_LR1121_TCXO.yaml rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox/femtofox_LR1121_TCXO.yaml diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox_SX1262_TCXO.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox_SX1262_TCXO.yaml rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox_SX1262_XTAL.yaml b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox_SX1262_XTAL.yaml rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh new file mode 100644 index 0000000..b1feadf --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -0,0 +1,101 @@ +#!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root. Try \`sudo femto-wifi-config\`." + exit 1 +fi + +help=$(cat <&1 1>&2 2>&3) + 4 "Back to Main Menu" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog break fi - + case $option in 1) wifi_country=$(grep -m 1 "^country=" "$wpa_supplicant_conf" | cut -d '=' -f 2) @@ -48,8 +53,8 @@ Connected to: $(iwconfig 2>/dev/null | grep -i 'ESSID' | awk -F 'ESSID:"' '{p Signal Strength: $(iwconfig 2>/dev/null | grep -i 'Signal level' | awk -F 'Signal level=' '{print $2}' | awk '{print $1}')\n\ Current IP: $(hostname -I | awk '{print $1}')\n\ For more details, enter \`iwconfig\`. -" 0 0 - ;; + " 0 0 + ;; 2) local wifi_ssid="" local wifi_psk="" @@ -80,14 +85,15 @@ For more details, enter \`iwconfig\`. # Function to handle misc settings misc_settings() { + local title="Wifi Settings" while true; do local option="" option=$(dialog --menu "Misc Settings" 15 40 4 \ 1 "Set system timezone" \ - 2 "blah" \ + 2 "Add ham radio support" \ 3 "blah" \ - 4 "Back to Main Menu" 3>&1 1>&2 2>&3) - + 4 "Back to Main Menu" 3>&1 1>&2 2>&3) + exit_status=$? # This line checks the exit status of the dialog command if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog break @@ -98,9 +104,23 @@ misc_settings() { femto-set-timezone.sh ;; 2) - local channel="" - channel=$(dialog --inputbox "Enter channel ID:" 8 40 3>&1 1>&2 2>&3) - dialog --msgbox "Channel ID set to: $channel" 8 40 + dialog --title "$title" --msgbox "Amateur radio support can be added in kernel for:\ +CONFIG_HAMRADIO\ +CONFIG_AX25\ +CONFIG_AX25_DAMA_SLAVE\ +CONFIG_NETROM\ +CONFIG_ROSE\ +CONFIG_MKISS\ +CONFIG_6PACK\ +CONFIG_BPQETHER\ +CONFIG_BAYCOM_SER_FDX\ +CONFIG_BAYCOM_SER_HDX\ +CONFIG_YAM\ +CONFIG_MEDIA_RADIO_SUPPORT\ +CONFIG_MEDIA_SDR_SUPPORT\ +CONFIG_MEDIA_PLATFORM_SUPPORT\ +CONFIG_SDR_PLATFORM_DRIVERS\ + CONFIG_SDR_MAX2175" 10 60 ;; 3) dialog --msgbox "Node info retrieved successfully!" 8 40 @@ -112,59 +132,167 @@ misc_settings() { done } +#set lora radio +set_lora_radio() { + while true; do + local option="" + option=$(dialog --menu "Misc Settings" 0 0 10 \ + 1 "ebyte-e22-900m30s" \ + 2 "ebyte-e22-900m22s" \ + 3 "ebyte-e80-900m22s" \ + 4 "heltec-ht-ra62" \ + 5 "seeed-wio-sx1262" \ + 6 "waveshare-sx126x-xxxm" \ + 7 "ai-thinker-ra-01sh" \ + 8 "sx1262_tcxo" \ + 9 "sx1262_xtal" \ + 10 "lr1121_tcxo" \ + 11 "none (simulated radio)" \ + 12 "Back to Main Menu" 3>&1 1>&2 2>&3) + + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + fi + + local radio="" + case $option in + 1) + radio="sx1262_tcxo" + ;; + 2) + radio="sx1262_tcxo" + ;; + 3) + radio="sx1262_xtal" + ;; + 4) + radio="sx1262_tcxo" + ;; + 5) + radio="sx1262_tcxo" + ;; + 6) + radio="sx1262_xtal" + ;; + 7) + radio="sx1262_xtal" + ;; + 8) + radio="sx1262_tcxo" + ;; + 9) + radio="sx1262_xtal" + ;; + 10) + radio="lr1121_tcxo" + ;; + 11) + radio="none" + ;; + 12) + return + ;; + esac + if [ -n "$radio" ]; then #if a radio was selected + femto-meshtasticd-config.sh -l "$radio" + return + fi + done +} # Function to handle Meshtasticd settings meshtasticd_settings() { - while true; do - local option="" - option=$(dialog --menu "Meshtasticd Settings" 15 40 4 \ - 1 "Configuration URL (QR code)" \ - 2 "LoRa radio" \ - 3 "Admin key" \ - 4 "Legacy admin channel" \ - 5 "Upgrade Meshtasticd" \ - 6 "Uninstall Meshtasticd" \ - 7 "Back to Main Menu" 3>&1 1>&2 2>&3) - - exit_status=$? # This line checks the exit status of the dialog command - if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog - break - fi - - case $option in - 1) - echo "Getting current Meshtastic QR code and URL..." - url=$(meshtastic --host --qr-all | grep -oP '(?<=Complete URL \(includes all channels\): )https://[^ ]+') - echo "$url" | qrencode -o - -t UTF8 -s 1 - echo "Meshtastic configuration URL:" - echo $url - echo "Press any key to continue..." - read -n 1 -s -r - newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) - if [ -n "$newurl" ]; then - dialog --title "Meshtastic URL" --yesno "New Meshtasticd URL:\n$url\n\nConfirm?" 15 60 - if [ $? -eq 0 ]; then - echo "Submitting to Meshtastic..." - updatemeshtastic.sh "--seturl $newurl" 10 "Set URL" - fi - fi + local title="Meshtasticd Settings" + while true; do + local option="" + option=$(dialog --menu "$title" 17 50 4 \ + 1 "Get current configuration URL & QR code" \ + 2 "Set new configuration URL" \ + 3 "Get current lora radio selection" \ + 4 "Set LoRa radio" \ + 5 "View current admin keys" \ + 6 "Set admin key" \ + 7 "Clear admin keys" \ + 8 "Enable legacy admin channel" \ + 9 "Disable legacy admin channel" \ + 10 "Upgrade Meshtasticd" \ + 11 "Uninstall Meshtasticd" \ + 12 "Back to Main Menu" 3>&1 1>&2 2>&3) + + exit_status=$? # This line checks the exit status of the dialog command + if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog + break + fi + + case $option in + 1) #Get current configuration URL & QR code) + femto-meshtasticd-config.sh -g ;; 2) - + newurl=$(dialog --title "Meshtastic URL" --inputbox "New Meshtasticd URL (SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) + if [ -n "$newurl" ]; then #if a URL was entered + dialog --title "$title" --yesno "New Meshtasticd URL:\n$newurl\n\nConfirm?" 15 60 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -q "$newurl" + pause + fi + fi ;; 3) - + dialog --title "LoRa radio" --msgbox "Currently configured LoRa radio: $(femto-meshtasticd-config.sh -k)" 6 40 ;; 4) - + set_lora_radio ;; 5) - + echo "Getting admin keys..." + dialog --title "Admin keys" --msgbox "Up to 3 admin keys are permitted, more will be ignored.\n\nKeys:$(femto-meshtasticd-config.sh -v | tail -n 1 | sed 's/|n/\\n/g')" 0 0 ;; - 6) - + 6) #set admin key) + key=$(dialog --title "Meshtastic Admin Key" --inputbox "Meshtastic admin key - up to 3, more will be ignored.\n(SHIFT+INS to paste):" 8 50 3>&1 1>&2 2>&3) + if [ -n "$key" ]; then #if a URL was entered + femto-meshtasticd-config.sh -a "$key" + pause + fi ;; 7) + dialog --title "$title" --yesno "Meshtasticd can have up to 3 admin keys.\nClear admin key list?" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -c + pause + fi + ;; + 8) #enable legacy) + dialog --title "$title" --yesno "Enable legacy admin channel?" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -e + pause + fi + ;; + 9) #disable legacy) + dialog --title "$title" --yesno "Disable legacy admin channel?" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -d + pause + fi + ;; + 10) #Upgrade meshtasticd) + dialog --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -u + pause + fi + ;; + 11) + dialog --title "$title" --yesno "Uninstall Meshtasticd?" 0 0 + if [ $? -eq 0 ]; then + femto-meshtasticd-config.sh -r + dialog --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`sudo apt purge\`.\nAfter reinstallation but before first launch, run \`sudo runonce.sh\`." 8 40 + fi + pause + ;; + 12) return ;; esac @@ -181,7 +309,7 @@ while true; do 4 "Software" \ 5 "Run OEM luckfox-config" \ 6 "Help" \ - 7 "Exit" 3>&1 1>&2 2>&3) + 7 "Exit" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh index 68deb12..bfe619a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/updatemeshtastic.sh @@ -1,8 +1,8 @@ #!/bin/bash - command="$1" attempts=$2 ref="$3: " +echo "Submitting to Meshtastic..." for retries in $(seq 1 $attempts); do output=$(meshtastic --host 127.0.0.1 $command) #>&2 lets meshtastic's output display on screen diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/usbconfig.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/usbconfig.sh index 356378f..e30241a 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/usbconfig.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/usbconfig.sh @@ -149,36 +149,36 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_lora_radio=$(echo "$meshtastic_lora_radio" | tr '[:upper:]' '[:lower:]') case "$meshtastic_lora_radio" in 'ebyte-e22-900m30s') - cp /etc/meshtasticd/available.d/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d ;; 'ebyte-e22-900m22s') - cp /etc/meshtasticd/available.d/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d ;; 'heltec-ht-ra62') - cp /etc/meshtasticd/available.d/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d ;; 'seeed-wio-sx1262') - cp /etc/meshtasticd/available.d/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d ;; 'waveshare-sx126x-xxxm') - cp /etc/meshtasticd/available.d/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d ;; 'ai-thinker-ra-01sh') - cp /etc/meshtasticd/available.d/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d ;; 'ebyte-e80-900m22s') #not yet implemented - cp /etc/meshtasticd/available.d/femtofox_LR1121_TCXO.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_LR1121_TCXO.yaml /etc/meshtasticd/config.d ;; 'sx1262_tcxo') - cp /etc/meshtasticd/available.d/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d ;; 'sx1262_xtal') - cp /etc/meshtasticd/available.d/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d ;; 'lr1121_tcxo') #not yet implemented - cp /etc/meshtasticd/available.d/femtofox_LR1121_TCXO.yaml /etc/meshtasticd/config.d + cp /etc/meshtasticd/available.d/femtofox/femtofox_LR1121_TCXO.yaml /etc/meshtasticd/config.d ;; 'none') ;; From d0feda7d92226ed13a3bc0b98a658e8fd6a71d24 Mon Sep 17 00:00:00 2001 From: nagumii Date: Mon, 30 Dec 2024 23:13:38 +0200 Subject: [PATCH 2/2] +x to env --- environment-setup/foxbunto_env_setup.sh | 72 +++++++++++++------------ 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/environment-setup/foxbunto_env_setup.sh b/environment-setup/foxbunto_env_setup.sh index 758d549..22c53eb 100755 --- a/environment-setup/foxbunto_env_setup.sh +++ b/environment-setup/foxbunto_env_setup.sh @@ -22,7 +22,7 @@ sudoer=$(echo $SUDO_USER) install_prerequisites() { echo “Setting up Foxbuntu build environment…” apt update - apt install -y git ssh make gcc gcc-multilib g++-multilib module-assistant expect g++ gawk texinfo libssl-dev bison flex fakeroot cmake unzip gperf autoconf device-tree-compiler libncurses5-dev pkg-config bc python-is-python3 passwd openssl openssh-server openssh-client vim file cpio rsync qemu-user-static binfmt-support dialog + apt install -y git ssh make gcc gcc-multilib g++-multilib module-assistant expect g++ gawk texinfo libssl-dev bison flex fakeroot cmake unzip gperf autoconf device-tree-compiler libncurses5-dev pkg-config bc python-is-python3 passwd openssl openssh-server openssh-client vim file cpio rsync qemu-user-static binfmt-support } clone_repos() { @@ -190,7 +190,7 @@ ln -sf /usr/share/zoneinfo/UTC /etc/localtime echo "Installing packages..." apt update -DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony qrencode +DEBIAN_FRONTEND=noninteractive apt install -y --option Dpkg::Options::="--force-confold" linux-firmware wireless-tools git python3.10-venv libgpiod-dev libyaml-cpp-dev libbluetooth-dev openssl libssl-dev libulfius-dev liborcania-dev evtest screen avahi-daemon protobuf-compiler telnet fonts-noto-color-emoji ninja-build chrony if [[ $? -eq 2 ]]; then echo "Error, step failed..."; fi DEBIAN_FRONTEND=noninteractive apt upgrade -y --option Dpkg::Options::="--force-confold" @@ -239,17 +239,16 @@ echo "Adding femto and pico users/groups..." groupmod -n femto pico usermod -l femto pico usermod -aG sudo,input femto -echo "femto ALL=(ALL:ALL) ALL" | tee /etc/sudoers.d/femto +echo "femto ALL=(ALL:ALL) ALL" | tee /etc/sudoers.d/femto > /dev/null chmod 440 /etc/sudoers.d/femto # this seems messy, user:group should be set cleanly and not corrected after? OSC: somethings were owned my pico from factory -find / -group pico -exec chgrp femto {} \ -find / -user pico -exec chown femto {} \ +find / -group pico -exec chgrp femto {} \; 2>/dev/null +find / -user pico -exec chown femto {} \; 2>/dev/null usermod -d /home/femto -m femto ls -ld /home/femto -echo 'femto:femto' | chpasswd -sudo chage -d 0 femto +echo 'femto:fox' | chpasswd usermod -a -G tty femto usermod -a -G dialout femto @@ -279,13 +278,38 @@ create_image() { du -h /home/${sudoer}/luckfox-pico/foxbuntu.img } +sdk_install() { + { echo 'Defaults timestamp_timeout=180' | sudo EDITOR='tee -a' visudo; } > /dev/null 2>&1 + start_time=$(date +%s) + install_prerequisites + clone_repos + build_env + build_uboot + copy_femtofox_kernelcfg + build_kernelconfig + build_rootfs + rsync -aHAXv --progress --keep-dirlinks --itemize-changes /home/${sudoer}/femtofox/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/ /home/${sudoer}/luckfox-pico/sysdrv/out/rootfs_uclibc_rv1106/ + build_firmware + modify_rootfs + build_rootfs + build_firmware + create_image + { sudo sed -i '/Defaults timestamp_timeout=180/d' /etc/sudoers; } > /dev/null 2>&1 + end_time=$(date +%s) + elapsed=$(( end_time - start_time )) + hours=$(( elapsed / 3600 )) + minutes=$(( (elapsed % 3600) / 60 )) + seconds=$(( elapsed % 60 )) + printf "Environment installation time: %02d:%02d:%02d\n" $hours $minutes $seconds +} + usage() { echo "The following functions are available in this script:" - echo "To install the development environment use the arg 'install' and is intended to be run ONCE only." + echo "To install the development environment use the arg 'sdk_install' and is intended to be run ONCE only." echo "To modify the chroot and build an updated image use the arg 'modify_chroot'." echo "To modify the kernel and build an updated image use the arg 'modify_kernel'." echo "other args: install_prerequisites clone_repos build_env build_sysdrv copy_femtofox_kernelcfg build_kernelconfig modify_rootfs build_rootf build_uboot build_firmware get_envblkflash create_image" - echo "Example: sudo ~/foxbunto_env_setup.sh install" + echo "Example: sudo ~/foxbunto_env_setup.sh sdk_install" echo "Example: sudo ~/foxbunto_env_setup.sh modify_chroot" exit 0 } @@ -306,7 +330,7 @@ while true; do 8 "Build U-Boot" \ 9 "Build RootFS" \ 10 "Create Final Image" \ - 11 "Install (Run All Steps)" \ + 11 "SDK Install (Run All Steps)" \ 12 "Exit" \ 2>&1 >/dev/tty) @@ -344,7 +368,7 @@ while true; do create_image ;; 11) - install + sdk_install ;; 12) echo "Exiting..." @@ -370,32 +394,10 @@ elif [[ ${1} == "modify_kernel" ]]; then modify_kernel elif [[ ${1} == "update_image" ]]; then update_image -elif [[ ${1} == "install" ]]; then - { echo 'Defaults timestamp_timeout=180' | sudo EDITOR='tee -a' visudo; } > /dev/null 2>&1 - start_time=$(date +%s) - install_prerequisites - clone_repos - build_env - build_uboot - copy_femtofox_kernelcfg - build_kernelconfig - build_rootfs - rsync -aHAXv --progress --keep-dirlinks --itemize-changes /home/${sudoer}/femtofox/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/ /home/${sudoer}/luckfox-pico/sysdrv/out/rootfs_uclibc_rv1106/ - build_firmware - modify_rootfs - build_rootfs - build_firmware - create_image - { sudo sed -i '/Defaults timestamp_timeout=180/d' /etc/sudoers; } > /dev/null 2>&1 - end_time=$(date +%s) - elapsed=$(( end_time - start_time )) - hours=$(( elapsed / 3600 )) - minutes=$(( (elapsed % 3600) / 60 )) - seconds=$(( elapsed % 60 )) - printf "Environment installation time: %02d:%02d:%02d\n" $hours $minutes $seconds +elif [[ ${1} == "sdk_install" ]]; then + sdk_install else ${1} fi exit 0 -