Yun slow boot

The Yun takes quite a long time to boot up, before you can start talking to it over WiFi. Is there anything that can be done to speed this up?

Post

root@Arduino:/# dmesg

dptdpt:
The Yun takes quite a long time to boot up, before you can start talking to it over WiFi. Is there anything that can be done to speed this up?

Yes. Can you explain your need to have it "start talking" sooner?

TIA
Jesse

Sorry for being unclear. I mean the time from boot up until my sketch can talk to the outside world over WiFi.

S here is my output from dmesg. But to be clear- I’m not saying that my Yun(s) are booting unusually slowly for a Yun. I’ve had 4 of them, and they’re all the same. I’m talking about the normal boot time, which is quite a long time. I just timed it on a Yun, and it was 1 minute, 17 seconds from power up until the white “USB” light comes on. Are there any tweaks or hacks that can be done to speed this up? In my application, the Yun will be turned off when not in use, and when you turn it on you don’t want to wait that long.

Dmesg output:

[    0.000000] Linux version 3.3.8 (jenkins@jenkins) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Fri Nov 14 08:57:34 CET 2014
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00004000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00004000
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 803836d0, node_mem_map 81000000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16256 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=Yun console=ttyATH0,250000 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 60936k/65536k available (2565k kernel code, 4600k reserved, 650k data, 180k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.080000] pid_max: default: 32768 minimum: 301
[    0.080000] Mount-cache hash table entries: 512
[    0.080000] NET: Registered protocol family 16
[    0.090000] gpiochip_add: registered GPIOs 0 to 29 on device: ath79
[    0.090000] MIPS: machine is Arduino Yun
[    0.530000] Setting DogStick2 GPIO
[    0.550000] bio: create slab <bio-0> at 0
[    0.550000] SCSI subsystem initialized
[    0.560000] usbcore: registered new interface driver usbfs
[    0.560000] usbcore: registered new interface driver hub
[    0.560000] usbcore: registered new device driver usb
[    0.570000] Switching to clocksource MIPS
[    0.570000] NET: Registered protocol family 2
[    0.570000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.580000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.580000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.580000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.580000] TCP reno registered
[    0.580000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.590000] NET: Registered protocol family 1
[    0.610000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.610000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.620000] msgmni has been set to 119
[    0.620000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    0.620000] io scheduler noop registered
[    0.630000] io scheduler deadline registered (default)
[    0.630000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.640000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
[    0.640000] console [ttyATH0] enabled, bootconsole disabled
[    0.650000] m25p80 spi0.0: found w25q128, expected m25p80
[    0.650000] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.650000] 7 cmdlinepart partitions found on MTD device spi0.0
[    0.660000] Creating 7 MTD partitions on "spi0.0":
[    0.660000] 0x000000000000-0x000000040000 : "u-boot"
[    0.660000] 0x000000040000-0x000000050000 : "u-boot-env"
[    0.670000] 0x000000050000-0x000000ea0000 : "rootfs"
[    0.670000] mtd: partition "rootfs" set to be root filesystem
[    0.670000] mtd: partition "rootfs_data" created automatically, ofs=7B0000, len=6F0000 
[    0.680000] 0x0000007b0000-0x000000ea0000 : "rootfs_data"
[    0.680000] 0x000000ea0000-0x000000fe0000 : "kernel"
[    0.680000] 0x000000fe0000-0x000000ff0000 : "nvram"
[    0.690000] 0x000000ff0000-0x000001000000 : "art"
[    0.690000] 0x000000050000-0x000000fe0000 : "firmware"
[    0.710000] ag71xx_mdio: probed
[    0.720000] eth0: Atheros AG71xx at 0xba000000, irq 5

(continued below)

dmesg output continued:

[    1.270000] eth0: Found an AR7240/AR9330 built-in switch
[    2.300000] eth1: Atheros AG71xx at 0xb9000000, irq 4
[    2.850000] ag71xx ag71xx.0: eth1: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]
[    2.850000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.850000] ehci-platform ehci-platform: Generic Platform EHCI Controller
[    2.860000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[    2.890000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[    2.910000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[    2.910000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    2.910000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    2.910000] usb usb1: Product: Generic Platform EHCI Controller
[    2.920000] usb usb1: Manufacturer: Linux 3.3.8 ehci_hcd
[    2.920000] usb usb1: SerialNumber: ehci-platform
[    2.920000] hub 1-0:1.0: USB hub found
[    2.920000] hub 1-0:1.0: 1 port detected
[    2.930000] Initializing USB Mass Storage driver...
[    2.930000] usbcore: registered new interface driver usb-storage
[    2.930000] USB Mass Storage support registered.
[    2.930000] input: gpio-keys-polled as /devices/platform/gpio-keys-polled/input/input0
[    2.940000] sdhci: Secure Digital Host Controller Interface driver
[    2.940000] sdhci: Copyright(c) Pierre Ossman
[    2.940000] usbcore: registered new interface driver ushc
[    2.940000] TCP cubic registered
[    2.950000] NET: Registered protocol family 17
[    2.950000] Bridge firewalling registered
[    2.950000] 8021q: 802.1Q VLAN Support v1.8
[    2.960000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[    2.960000] Freeing unused kernel memory: 180k freed
[    3.260000] usb 1-1: new high-speed USB device number 2 using ehci-platform
[    3.620000] usb 1-1: New USB device found, idVendor=058f, idProduct=6254
[    3.620000] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    3.620000] usb 1-1: Product: USB2.0Hub
[    3.710000] hub 1-1:1.0: USB hub found
[    3.710000] hub 1-1:1.0: 4 ports detected
[    4.020000] usb 1-1.4: new high-speed USB device number 3 using ehci-platform
[    4.190000] usb 1-1.4: New USB device found, idVendor=058f, idProduct=6366
[    4.200000] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    4.200000] usb 1-1.4: Product: Mass Storage Device
[    4.200000] usb 1-1.4: Manufacturer: Generic
[    4.200000] usb 1-1.4: SerialNumber: 058F0O1111B1
[    4.240000] scsi0 : usb-storage 1-1.4:1.0
[    5.040000] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[    5.240000] scsi 0:0:0:0: Direct-Access     Multi    Flash Reader     1.00 PQ: 0 ANSI: 0
[    6.270000] Registered led device: ds:green:usb
[    6.270000] Registered led device: ds:green:wlan
[    9.600000] JFFS2 notice: (527) jffs2_build_xattr_subsystem: complete building xattr subsystem, 1 of xdatum (1 unchecked, 0 orphan) and 13 of xref (0 dead, 2 orphan) found.
[   10.790000] sd 0:0:0:0: [sda] Attached SCSI removable disk
[   38.070000] Loading modules backported from Linux version master-2014-05-22-0-gf2032ea
[   38.070000] Backport generated by backports.git backports-20140320-37-g5c33da0
[   38.250000] cfg80211: Calling CRDA to update world regulatory domain
[   38.250000] cfg80211: World regulatory domain updated:
[   38.250000] cfg80211:  DFS Master region: unset
[   38.250000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   38.260000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   38.260000] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (N/A, 2000 mBm), (N/A)
[   38.270000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (N/A, 2000 mBm), (N/A)
[   38.270000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   38.270000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 2000 mBm), (N/A)
[   38.280000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm), (N/A)
[   39.220000] ath: EEPROM regdomain: 0x0
[   39.220000] ath: EEPROM indicates default country code should be used
[   39.220000] ath: doing EEPROM country->regdmn map search
[   39.220000] ath: country maps to regdmn code: 0x3a
[   39.220000] ath: Country alpha2 being used: US
[   39.220000] ath: Regpair used: 0x3a
[   39.230000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   39.240000] Registered led device: ath9k-phy0
[   39.240000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
[   39.240000] cfg80211: Calling CRDA for country: US
[   39.240000] cfg80211: Regulatory domain changed to country: US
[   39.250000] cfg80211:  DFS Master region: FCC
[   39.250000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp), (dfs_cac_time)
[   39.250000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (N/A, 3000 mBm), (N/A)
[   39.260000] cfg80211:   (5170000 KHz - 5250000 KHz @ 80000 KHz), (N/A, 1700 mBm), (N/A)
[   39.260000] cfg80211:   (5250000 KHz - 5330000 KHz @ 80000 KHz), (N/A, 2300 mBm), (0 s)
[   39.260000] cfg80211:   (5735000 KHz - 5835000 KHz @ 80000 KHz), (N/A, 3000 mBm), (N/A)
[   39.270000] cfg80211:   (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm), (N/A)
[   39.690000] NTFS driver 2.1.30 [Flags: R/O MODULE].
[   39.740000] Error: Driver 'gpio-keys-polled' is already registered, aborting...
[   39.760000] loop: module loaded
[   39.900000] PPP generic driver version 2.4.2
[   39.950000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   40.070000] NET: Registered protocol family 24
[   40.100000] nf_conntrack version 0.5.0 (954 buckets, 3816 max)
[   40.550000] i2c /dev entries driver
[   40.580000] Linux video capture interface: v2.00
[   40.700000] fuse init (API version 7.18)
[   52.600000] wlan0: authenticate with 00:24:b2:5a:0a:fc
[   52.600000] wlan0: send auth to 00:24:b2:5a:0a:fc (try 1/3)
[   52.610000] wlan0: authenticated
[   52.630000] wlan0: associate with 00:24:b2:5a:0a:fc (try 1/3)
[   52.640000] wlan0: RX AssocResp from 00:24:b2:5a:0a:fc (capab=0x421 status=0 aid=1)
[   52.640000] wlan0: associated

Here is mine:

...
[   51.040000] fuse init (API version 7.18)
[   51.070000] uvcvideo: Found UVC 1.00 device Webcam C110 (046d:0829)
[   51.080000] input: Webcam C110 as /devices/platform/ehci-platform/usb1/1-1/1-1.1/1-1.1.5/1-1.1.5:1.0/input/input1
[   51.080000] usbcore: registered new interface driver uvcvideo
[   51.090000] USB Video Class driver (1.1.1)
[   56.910000] eth1: link up (100Mbps/Full duplex)

Yours seem fine to me.

The Boot Process

http://wiki.openwrt.org/doc/techref/process.boot

dptdpt:
Sorry for being unclear. I mean the time from boot up until my sketch can talk to the outside world over WiFi.

S here is my output from dmesg. But to be clear- I'm not saying that my Yun(s) are booting unusually slowly for a Yun. I've had 4 of them, and they're all the same. I'm talking about the normal boot time, which is quite a long time. I just timed it on a Yun, and it was 1 minute, 17 seconds from power up until the white "USB" light comes on. Are there any tweaks or hacks that can be done to speed this up? In my application, the Yun will be turned off when not in use, and when you turn it on you don't want to wait that long.

::::SNIP::::

dptdpt,
Yes. When booting the Linux side (which handles the wifi) it has several long time outs. I see at least 15 seconds in timeouts that can be reduced. Many of the timeouts are waiting for the wifi to reset or be set.

If you'd like to do this, it would be a complete experiment. The boot process is not documented well, and what documentation there is - is out of date.

Who you like to reduce the boot process time outs? This could be quite frustrating.

Jesse

dptdpt:
...
In my application, the Yun will be turned off when not in use, and when you turn it on you don't want to wait that long.
...

Yun base on AR9331 WiSoC (Wireless System-On-A-Chip) does not support sleep mode. What you asked is WiSoC support sleep mode and self timer or GPIO wake up function. Never turn off but sleep.

Ok, thanks. So is this something that anyone has looked into very much? I might look into it, but it probably doesn't make sense if smarter minds have already given up. I used to know Unix quite well, but it's been many (many!) years, and I'm rusty.

And when you say timeout - are you saying that it has built in delays to wait for something to complete, when that thing is actually completing much more quickly? Normally "timeout" means the time you take to give up waiting for something. So if that thing finishes before the timeout period ends, then it doesn't keep waiting.

But if it keeps waiting anyway, after the thing is completed (which is not what I'd call a "timeout"), or if it's waiting for things that I might not care about - then that definitely is an opportunity to improve the boot time.

sonnyyu:
Yun base on AR9331 WiSoC (Wireless System-On-A-Chip) does not support sleep mode. What you asked is WiSoC support sleep mode and self timer or GPIO wake up function. Never turn off but sleep.

No, I need to be able to power it down. Just have the boot up quicker.

dptdpt:
Ok, thanks. So is this something that anyone has looked into very much? I might look into it, but it probably doesn't make sense if smarter minds have already given up. I used to know Unix quite well, but it's been many (many!) years, and I'm rusty.

And when you say timeout - are you saying that it has built in delays to wait for something to complete, when that thing is actually completing much more quickly? Normally "timeout" means the time you take to give up waiting for something. So if that thing finishes before the timeout period ends, then it doesn't keep waiting.

But if it keeps waiting anyway, after the thing is completed (which is not what I'd call a "timeout"), or if it's waiting for things that I might not care about - then that definitely is an opportunity to improve the boot time.

dptdpt,
by "timeout" I mean Unix sleep(1). As you may recall, sleep is in resolution of 1 sec (+-1sec).

Since you are a bit familair with Unix, you would have to dive into /etc/rcS. From there you could enable/disable various boot up scripts. A complete list of Yun startup scripts can be found here:

http://codesnippets.altervista.org/documentation/yun/boot_process/rcS_process.html

Please be aware I've just started documenting the startup process, so I can't offer you any direct help in changing the boot up script. Also, in the future this page may move (but it's likely to be there for a few weeks, at least)

Lastly, I can help by answering any questions, or helping you research stuff. My goal in creating this page was to help people just like yourself that need a "quicker boot time."

Jesse

dptdpt:
No, I need to be able to power it down. Just have the boot up quicker.

I found most cases people are looking for power device down to save energy of battery powered device. Are we in different case?

sonnyyu:
I found most cases people are looking for power device down to save energy of battery powered device. Are we in different case?

No. It will be carried around, plugged in and unplugged, etc.

dptdpt:
No. It will be carried around, plugged in and unplugged, etc.

If faster startups are that important, perhaps a regular Arduino with a WiFi shield might be a better choice? I'm sure there are some tweaks you can do to speed up the Linux boot process, but I don't see that it will ever be as fast as a microcontroller that has the entire program in the internal flash memory.

What's more important: fast boot speed, or the extra features that the Linux side brings to the table? I don't think you can have both.

ShapeShifter:
If faster startups are that important, perhaps a regular Arduino with a WiFi shield might be a better choice? I’m sure there are
::::SNIP::::

dptdpt,
I’d seriously consider ShapeShifter’s suggestion. To me that makes good sense.

Jesse