Welcome! Log In Create A New Profile

Advanced

Boot inspite of net console without LAN connection

Posted by ElMariachi 
Boot inspite of net console without LAN connection
October 06, 2018 11:07AM
Hello!

I finally have my print server working with a new wifi usb device (TP-Link 4200).
Now I want to sometimes switch the device on an use it as a scan and print server.
But U-Boot won't boot because it's in a loop, waiting for the net console to host become available. Of course this does not happen with no LAN plug connected. So the green light keeps flashing endlessly waiting for a net console connection an won't boot. How could I change the env settings for making U-Boot skip the loop after a given time?
Thank you!

.



Edited 2 time(s). Last edit at 10/06/2018 12:16PM by ElMariachi.
Re: Boot inspite of net console without LAN connection
October 06, 2018 05:05PM
ElMariachi,

The current u-boot envs were set up to try netconsole several times. But eventually it will time out and boot normally. How long does that take is depending on how the envs were set up.

Power up, interrupt u-boot netconsole or serial console and and get the listing of the u-boot envs

printenv

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Boot inspite of net console without LAN connection
October 06, 2018 05:59PM
Hello Bodhi!

root@prtsrv:~# fw_printenv 
arcNumber=3089
bootcmd_exec=if run load_uimage; then if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; fi
bootcmd_pogo=run bootcmd_rescue
bootcmd_rescue=run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 5
bootdelay=10
device=0:1
disks=0 1 2 3
dtb_file=/boot/dts/kirkwood-goflexnet.dtb
ethact=egiga0
ethaddr=00:50:43:00:02:02
if_netconsole=ping $serverip
init_ide=ide reset
init_mmc=mmc rescan
init_usb=usb start
led_error=orange blinking
led_exit=green off
led_init=green blinking
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_dtb_addr=0x1c00000
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_initrd_addr=0x1100000
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
load_uimage_addr=0x800000
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
nc_ready=1
ncip=192.168.1.35
partition=nand0,2
preboot=run preboot_nc
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start"; setenv scan_ide "ide reset"; setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
scan_ide=ide reset
scan_mmc=mmc rescan
scan_usb=usb start
serverip=192.168.1.35
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
set_bootargs_rescue=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts
set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$rootdelay rootfstype=$rootfstype $mtdparts
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=nc
stdin=nc
stdout=nc
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start"; setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_loaded=0
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
usb_ready_retry=15
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
rescue_installed=1
devices=ide usb
bootdev=usb
ipaddr=192.168.1.68
bootcmd=run bootcmd_uenv; usb reset; run scan_disk; run set_bootargs; if run bootcmd_exec; then; else run bootcmd_pogo;  fi; reset

Re: Boot inspite of net console without LAN connection
October 06, 2018 06:42PM
Hi ElMariachi!

Here is the loop and relevant variables.
preboot_nc=setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi
if_netconsole=ping $serverip
serverip=192.168.1.35

The server you are normally connected to is 192.168.1.35.

Explanation:

The 1st problem with the current u-boot netconsole (in mainline code) is that if you have connected to the server (192.168.1.35) before, and now it is offline. This oftenly causes a false positive ping response the first time (routers usually keep good ip address remained on the list for a while). So that's why I used 5 pings to make sure the router is nudged to fail to deliver the ping and then response with a true negative.

The 2nd problem with with the current u-boot in mainline is that u-boot takes a very long period to time out when trying to get a network response when it thinks its NIC is working and try to request something over the network.

It is a combination of the current u-boot implementation that affects a lot of Kirkwood boxes. Especially the GoFlex Home/Net, there is some peculiar quirk with these boxes that it does not timeout quickly. So a lot of people with GoFlex Home/Net have thought that netconsole does not work, in reality it just takes a very long time (about 2 minutes for each failed response).

So the bottom line is if you change the loop to 2 times to cut the waiting time down. And let it boot and wait, eventually it will time out correctly and continue to boot. Or if you don't care how long you takes to boot the box without the cable connected, then leave the u-boot envs as they are.

As an experiment, if you have serial console, connect and monitor the boot process using serial console, you will see eventually it will fail and continue to boot the box.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 10/06/2018 06:43PM by bodhi.
Re: Boot inspite of net console without LAN connection
October 07, 2018 04:55AM
Hello!

I tried setting the ping count to 1. Still it took eternally until the boot started.
So I completely removed the variable "preboot". But the GoFlex still is waiting and the net console is working. I don't understand why. How is it executed?
Re: Boot inspite of net console without LAN connection
October 07, 2018 05:05AM
Hello!

I just resolved the problem:
I had to remove the redirections for
stdout
stderr
stdin

from Env.
Probably there was a timeout in every single line from the boot protocoll.

Thank you!
:)
Re: Boot inspite of net console without LAN connection
October 07, 2018 05:27PM
> I just resolved the problem:
> I had to remove the redirections for
> stdout
> stderr
> stdin
>
> from Env.

Cool! as I said, u-boot netconsole has not been worked on by anybody for quite a while, and it has some issue with timeout period being too long, among other things.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: