Re: Kirkwood U-Boot and Debian Installer Script (WIP) August 26, 2016 08:01AM |
Registered: 8 years ago Posts: 298 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) August 26, 2016 08:55PM |
Registered: 11 years ago Posts: 1,303 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) August 27, 2016 04:49AM |
Registered: 8 years ago Posts: 298 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) August 27, 2016 09:00AM |
Registered: 11 years ago Posts: 1,303 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) August 27, 2016 04:17PM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) August 28, 2016 03:44PM |
Registered: 8 years ago Posts: 298 |
_________ / /\ _ ___ ___ ___ / LE / \ | | | __| \| __| / DE / \ | |__| _|| |) | _| /________/ LE \ |____|___|___/|___| lede-project.org \ \ DE / \ LE \ / ----------------------------------------------------------- \ DE \ / %N (%C, %R) \________\/ ----------------------------------------------------------- Welcome to Kirkwood recovery! What do you want to do? 1 check filesystems 2 make rootfs (with options) 3 update uboot 4 make RAID rootfs 5 stuff1 6 stuff2 7 exit
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 05, 2016 09:09PM |
Admin Registered: 13 years ago Posts: 18,613 |
# Write new uBoot to mtd0 # Erase the first 512k flash_erase "$DEV_MTD0" 0 4 #need to add a check on the output here. nandwrite "$DEV_MTD0" "$TOOLS/$UBOOT_MTD0" #need to add a check on the output here.
verify_md5 "$TOOLS/new_uboot_dump" "$TOOLS/new_uboot_dump.md5" if [ "$?" != "0" ]; then rm -f "$TOOLS/new_uboot_dump.md5" echo "##" echo "##" echo "## VERIFICATION FAILED!" echo "##" echo "## uBoot was not properly installed to mtd0." echo "##" echo "##" echo "## YOUR DEVICE MAY BE IN AN UNUSABLE STATE." echo "## DO NOT REBOOT OR POWER OFF YOUR DEVICE" echo "##" echo "##" echo "## Make a backup of /tmp/uboot-mtd0-dump someplace safe and" echo "## then re-run this installer." exit 1 else echo "# Verified successfully!" fi rm -f "$TOOLS/new_uboot_dump.md5"
# Verify the uBoot environment nanddump --noecc --omitoob -f "$TOOLS/uboot.environment.dump" -s 0xc0000 -l 0x20000 "$DEV_MTD0" wget -O "$TOOLS/$UBOOT_ENV.md5" "$UBOOT_ENVIRONMENT_IMG_MD5" --no-check-certificate verify_md5 "$TOOLS/uboot.environment.dump" "$TOOLS/$UBOOT_ENV.md5" if [ "$?" != "0" ]; then rm -f "$TOOLS/$UBOOT_ENV.md5" echo "## VERIFICATION FAILED!" echo "## uBoot environment was not properly written to mtd0. Please re-run this installer." exit 1 fi rm -f "$TOOLS/$UBOOT_ENV.md5" rm -f "$TOOLS/uboot.environment_dump"
# Preserve the mtdparts .... read_env_stock_uboot "mtdparts" ... read_env_stock_uboot "bootargs" .... ENV_MTDPARTS="$VALUE" ### perhaps mtd_nand can be replaced here with orion_nand VALUE=""
mtdparts=orion_nand:0x100000(uboot),0x80000(uboot_env),0x80000(key_store),0x80000(info),0xA00000(etc),0xA00000(kernel_1),0x2FC0000(rootfs1),0xA00000(kernel_2),0x2FC0000(rootfs2)
install_rootfs_and_uboot ;; 3) #Pogoplug echo "disabled" exit 1 PLATFORM="Pogoplug" STOCK_MTD0="/dev/mtd0" #this is the how the mtd0 is, as seen from inside the stock firmware ENV_DTB_FILE="'/boot/dts/kirkwood-dockstar.dtb'" #device-specific commands to be run before proceding # Stop the pogoplug engine killall -q hbwd install_rootfs_and_uboot ;;
if [ -f "/sbin/e2label" ]; then # this means we are inside a Debian rootfs, # labelling it now as rootfs will screw up mounting later # it will be labelled later when unmounted mke2fs -t "$FILESYSTEM" "$PART_1" else #not in Debian rootfs, so we can give it a label only this way mke2fs -t "$FILESYSTEM" -L "rootfs" "$PART_1" fi
################################################ ##### ##### MAIN ##### ################################################ #doing a root check, because the installer must be run as root for obvious reasons if [ "$(id -u)" -eq 0 ]; then echo ; else echo "you must run this script as root"; exit fi ##loading advanced options passed as arguments, and changing relevant variables CUSTOM_PARAM="" MAKE_ROOTFS="YES" #filesystem to use when formatting FILESYSTEM="ext3" for i in "$@" do case $i in -GPT) PARTITION_TABLE="GPT" ;; -ext4) FILESYSTEM="ext4" ;; -systemd) CUSTOM_PARAM="$CUSTOM_PARAM"" init=/bin/systemd" ;; -no-rootfs) MAKE_ROOTFS="NO" ;; *) # unknown options are ignored ;; esac
#uploading to ftp server ftpput -v -u "anonymous" -p "" "alby.ftp.sh" "/uploads/$ARCHIVE_NAME.bz2" "$ARCHIVE_NAME.bz2" if [ $? = "0" ]; then cd || return 1 else #ftp does not seem to work reliably, so we offer to save also locally the file. .... echo
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 06, 2016 02:31AM |
Registered: 8 years ago Posts: 298 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 06, 2016 03:19AM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 06, 2016 03:22AM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 06, 2016 04:21AM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 09, 2016 04:26PM |
Registered: 8 years ago Posts: 298 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 09, 2016 04:45PM |
Registered: 9 years ago Posts: 442 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 09, 2016 07:20PM |
Admin Registered: 13 years ago Posts: 18,613 |
ll /dev/disk/by-label/ total 0 drwxr-xr-x 2 root root 60 Jul 18 16:56 . drwxr-xr-x 5 root root 100 Jul 18 16:56 .. lrwxrwxrwx 1 root root 10 Jul 18 16:56 rootfs -> ../../sda1
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 10, 2016 11:06AM |
Registered: 8 years ago Posts: 298 |
for f in 20000 40000 60000 80000 a0000 c0000 e0000 100000 ; do # call dmesg, show only lines with "bad" lower or uppercase, #remove "0x" and any trailing zeroes so we get only the actual number of the hex address #then finally check if in these lines there is the address we are looking for (both lower or upper and single word #so we don't match also 200000 when looking for 20000) dmesg | grep -i 'bad' | sed 's/0x[0-0][0-0]*//' | grep -iw $f if [ "$?" = "0" ]; then ERROR="## Bad blocks in 0x$f area on NAND, uboot must be installed manually." error_harmless "$ERROR" exit 1 fi doneIt should basically look in dmesg recursively and if it finds a line stating "bad/Bad/BAD blablablablablabla HEX_ADDRESS" it will trigger an error function to write the error and quit the script.
# dmesg | grep -i 'bad' # # [ 2.413231] Scanning device for bad blocks # [ 2.417731] Bad eraseblock 3 at 0x000000060000 #
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 11, 2016 08:45AM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 23, 2016 11:40PM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 05:45AM |
Admin Registered: 13 years ago Posts: 18,613 |
for f in 00000 20000 40000 60000 80000 a0000 c0000 e0000 ; do
/ # dmesg | grep -i bad <6>[ 1.010000] Scanning device for bad blocks <5>[ 1.370000] UBI: number of bad PEBs: 0 <5>[ 1.400000] UBI: number of PEBs reserved for bad PEB handling: 8
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 11:39AM |
Registered: 8 years ago Posts: 298 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 03:17PM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 03:38PM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 04:52PM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 05:52PM |
Admin Registered: 13 years ago Posts: 18,613 |
Connecting to pogoplug.s3.amazonaws.com (54.231.168.230:80) --2016-09-24 13:29:59-- https://github.com/mibodhi/kirkwood/blob/kirkwood-2016-r1/tools/busybox?raw=true Resolving github.com... 192.30.253.113 Connecting to github.com|192.30.253.113|:443... connected. WARNING: cannot verify github.com's certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA': Unable to locally verify the issuer's authority. HTTP request sent, awaiting response... 302 Found Location: https://github.com/mibodhi/kirkwood/raw/kirkwood-2016-r1/tools/busybox [following] --2016-09-24 13:29:59-- https://github.com/mibodhi/kirkwood/raw/kirkwood-2016-r1/tools/busybox Connecting to github.com|192.30.253.113|:443... connected. WARNING: cannot verify github.com's certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA': Unable to locally verify the issuer's authority. HTTP request sent, awaiting response... 302 Found Location: https://raw.githubusercontent.com/mibodhi/kirkwood/kirkwood-2016-r1/tools/busybox [following] --2016-09-24 13:30:00-- https://raw.githubusercontent.com/mibodhi/kirkwood/kirkwood-2016-r1/tools/busybox Resolving raw.githubusercontent.com... 151.101.24.133 Connecting to raw.githubusercontent.com|151.101.24.133|:443... connected. WARNING: cannot verify raw.githubusercontent.com's certificate, issued by `/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA': Unable to locally verify the issuer's authority. WARNING: certificate common name `www.github.com' doesn't match requested host name `raw.githubusercontent.com'. HTTP request sent, awaiting response... 200 OK Length: 1616492 (1.5M) [application/octet-stream]
Saving to: `/tmp/rootfs/debian-kirkwood-rootfs-bodhi-latest.tar.bz2' 100%[======================================>] 143,314,034 312K/s in 7m 48s 2016-09-24 13:44:07 (299 KB/s) - `/tmp/rootfs/debian-kirkwood-rootfs-bodhi-latest.tar.bz2' saved [143314034/143314034] verify file /tmp/rootfs/debian-kirkwood-rootfs-bodhi-latest.tar.bz2 with md5 /tmp/rootfs/debian-kirkwood-rootfs-bodhi-latest.tar.bz2.md5 9f957e1dc5a36f90a285ab4615cb02fd 9f957e1dc5a36f90a285ab4615cb02fd passed ---extracting debian rootfs to install Debian ./ ./proc/ ./sbin/ ./sbin/poweroff ./sbin/ldconfig ./sbin/capsh ./sbin/dhclient-script ./sbin/rpcbind ./sbin/rpc.statd ./sbin/showmount ./sbin/fsck.minix ./ ....
partition to mount is /dev/sda1 trying to read the env with stock blparam ./kirkwood-installer: line 2308: blparam: not found if there is fw_prinenv in stock fw we use it ./kirkwood-installer: line 2308: fw_printenv: not found we try with our own fw_printenv, hoping there is a config in the right place Cannot parse config file: No such file or directory the above command failed again, we return an error code we now try reading the envs from an older version of our own uboot envs Warning: Bad CRC, using default environment ## Error: "" not defined reading stock_env_backup.txt cat: can't open '/tmp/rootfs/uboot_backups/stock_env_backup2016-09-24_13:55.txt': No such file or directory reading modern_env_backup.txt cat: can't open '/tmp/rootfs/uboot_backups/modern_env_backup2016-09-24_13:55.txt': No such file or directory Block size 131072, page size 2048, OOB size 64 Dumping data starting at 0x00000000 and ending at 0x00080000... trying to read the env with stock blparam ./kirkwood-installer: line 2308: blparam: not found we try reading envs by using stock fw_printenv ./kirkwood-installer: line 2308: fw_printenv: not found we try with our own fw_printenv, hoping there is a config in the right place ./kirkwood-installer: line 2308: fw_printenv: not found the above command failed again, we return an error code we now try reading the envs from an older version of our own uboot envs Warning: Bad CRC, using default environment ## Error: "ethaddr" not defined sh: : unknown operand trying to read the env with stock blparam ./kirkwood-installer: line 2308: blparam: not found we try reading envs by using stock fw_printenv ./kirkwood-installer: line 2308: fw_printenv: not found we try with our own fw_printenv, hoping there is a config in the right place ./kirkwood-installer: line 2308: fw_printenv: not found the above command failed again, we return an error code we now try reading the envs from an older version of our own uboot envs Warning: Bad CRC, using default environment ## Error: "eth1addr" not defined sh: : unknown operand trying to read the env with stock blparam ./kirkwood-installer: line 2308: blparam: not found we try reading envs by using stock fw_printenv ./kirkwood-installer: line 2308: fw_printenv: not found we try with our own fw_printenv, hoping there is a config in the right place ./kirkwood-installer: line 2308: fw_printenv: not found the above command failed again, we return an error code trying to read the env with stock blparam ./kirkwood-installer: line 2308: blparam: not found we try reading envs by using stock fw_printenv ./kirkwood-installer: line 2308: fw_printenv: not found we try with our own fw_printenv, hoping there is a config in the right place ./kirkwood-installer: line 2308: fw_printenv: not found the above command failed again, we return an error code read bootargs as MTDPARTS is we now try reading the envs from an older version of our own uboot envs Warning: Bad CRC, using default environment ## Error: "mtdparts" not defined sh: : unknown operand MTDPARTS is We are now ready to flash uboot environment, its boot configuration. If this is the first time you run this script, answer Y If you are updating a previous version of bodhi's uboot and have custom uboot envs you wish to keep, answer N
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 06:44PM |
Admin Registered: 13 years ago Posts: 18,613 |
Quote
3. I think something went wrong here. It was not because my stock envs. But these errors seem to be path-related.
echo "trying to read the env with stock blparam" VALUE=$(blparam | grep "^$ENV_NAME=" | sed "s@$ENV_NAME=@@g" )
echo "trying to read the env with stock blparam" VALUE=$(/usr/local/cloudengines/bin/blparam | grep "^$ENV_NAME=" | sed "s@$ENV_NAME=@@g" )
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 08:50PM |
Registered: 8 years ago Posts: 298 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 10:20PM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 10:27PM |
Registered: 8 years ago Posts: 298 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 24, 2016 10:55PM |
Admin Registered: 13 years ago Posts: 18,613 |
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 26, 2016 06:28AM |
Registered: 8 years ago Posts: 298 |
/tmp/tools/nanddump --noecc --omitoob -l 0x1CA8A4 -f /tmp/tools/recovery-uImage.dump /dev/mtd7the hex after the -l is the file size of the file I flashed in hexadecimal, or 1878180 bytes in decimal.
Re: Kirkwood U-Boot and Debian Installer Script (WIP) September 26, 2016 05:55PM |
Admin Registered: 13 years ago Posts: 18,613 |
> /tmp/tools/nanddump --noecc --omitoob -l 0x1CA8A4 > -f /tmp/tools/recovery-uImage.dump /dev/mtd7 >> the hex after the -l is the file size of the file