arduino / YunBridge

72 stars 32 forks source link

Edit the /etc/inittab file #26

Open aabm00 opened 9 years ago

aabm00 commented 9 years ago

Hello

I have an Arduino Yun with LininoOS and LIninoIO and node.js installed, and I'm working on it from a laptop with windows 7 x64.

Are there some way I can edit the /etc/inittab file, without having access to the Arduino Yun via Wifi, Ethernet and YunSerialTerminal?

I tried to make a proof and edited the file commenting the last line:

::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
#ttySPI0::respawn:/bin/ash --login

And now I have neither Wifi nor Ethernet access. The only acces I have is the Serial port COM.

Until now I have tried this:

1- WLAN RST by at least 30 seconds

Nothing happened.

I have installed in my Yun LininoOS and LininoIO, even though LininoOS is a version of OpenWRT I don’t know if pressing at least 30 seconds works in the same way or simply by the fact of commenting the inittab file this option is lost,

2- FAILSAVE MODE

I tried the (failsave mode) option from U-boot. I uploaded YunSerialTerminal and press YUN RST and the result is this:

U-Boot 1.1.4-linino-g335e76c8-dirty (Mar  5 2015 - 09:56:20)

Linino Board (ar9331) U-boot
DRAM:  64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 217k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18
flash size 16777216, sector count = 256
Flash: 16 MB
In:    serial
Out:   serial
Err:   serial
Net:   eth0: b4:21:8a:00:00:00
eth1: b4:21:8a:00:00:01
eth0, eth1
autoboot in 4 seconds (stop with 'lin')...
## Booting image at 9fea0000 ...
   Image Name:   MIPS OpenWrt Linux-3.3.8
   Created:      2015-02-03  14:03:09 UTC
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1129750 Bytes =  1.1 MB
   Load Address: 80060000
   Entry Point:  80060000
   Verifying Checksum at 0x9fea0040 ...OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864

Starting kernel ...

[    0.000000] Linux version 3.3.8 (build@build-base) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Tue Feb 3 15:02:42 CET 2015
[    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] User-defined 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] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  console=spicons board=linino-yun mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd 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: 61004k/65536k available (2416k kernel code, 4532k reserved, 686k data, 216k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:256
[    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] mach-linino: setting GPIO
[    0.530000] Setting GPIO OE 21
[    0.540000] Setting GPIO OE2 22
[    0.540000] Setting GPIO UART-ENA 23
[    0.540000] mach-linino: enabling GPIO SPI Controller
[    0.550000] bio: create slab <bio-0> at 0
[    0.560000] 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.570000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    0.570000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    0.570000] TCP: Hash tables configured (established 2048 bind 2048)
[    0.570000] TCP reno registered
[    0.570000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.580000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.580000] NET: Registered protocol family 1
[    0.600000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.600000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.610000] msgmni has been set to 119
[    0.610000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[    0.610000] io scheduler noop registered
[    0.620000] io scheduler deadline registered (default)
[    0.620000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.630000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
[    0.630000] console [spicons0] enabled, bootconsole disabled

As you can see I never get the option of enter failsave mode.

Are there another way to revive the Yun or edit the /etc/inittab?

Thanks

dragino commented 9 years ago

How about try to use the process class in Bridge library? This doesn’t need to have Ethernet access, and you can upload the sketch via Yun’s USB port.

Best Regards Edwin Chen

DRAGINO-LOGO-签名 Dragino Technology Co., Limited

Room 7009, Zi'An Commercial Building, Qian Jin 1 Road.

Xin'An 6th District, Bao'an District ; Shenzhen 518101,China

Direct: +86 755 86610829 |Fax: +86 755 86647123

发件人: aabm00 [mailto:notifications@github.com] 发送时间: 2015年5月23日 0:32 收件人: arduino/YunBridge 主题: [YunBridge] Edit the /etc/inittab file (#26)

Hello

I have an Arduino Yun with LininoOS and LIninoIO and node.js installed, and I'm working on it from a laptop with windows 7 x64.

Are there some way I can edit the /etc/inittab file, without having access to the Arduino Yun via Wifi, Ethernet and YunSerialTerminal?

I tried to make a proof and edited the file commenting the last line:

::sysinit:/etc/init.d/rcS S boot ::shutdown:/etc/init.d/rcS K shutdown

ttySPI0::respawn:/bin/ash --login

And now I have neither Wifi nor Ethernet access. The only acces I have is the Serial port COM.

Until now I have tried this:

1- WLAN RST by at least 30 seconds

Nothing happened.

I have installed in my Yun LininoOS and LininoIO, even though LininoOS is a version of OpenWRT I don’t know if pressing at least 30 seconds works in the same way or simply by the fact of commenting the inittab file this option is lost,

2- FAILSAVE MODE

I tried the (failsave mode) option from U-boot. I uploaded YunSerialTerminal and press YUN RST and the result is this:

U-Boot 1.1.4-linino-g335e76c8-dirty (Mar 5 2015 - 09:56:20)

Linino Board (ar9331) U-boot DRAM: 64 MB Top of RAM usable for U-Boot at: 84000000 Reserving 217k for U-Boot at: 83fc8000 Reserving 192k for malloc() at: 83f98000 Reserving 44 Bytes for Board Info at: 83f97fd4 Reserving 36 Bytes for Global Data at: 83f97fb0 Reserving 128k for boot params() at: 83f77fb0 Stack Pointer at: 83f77f98 Now running in RAM - U-Boot at: 83fc8000 Flash Manuf Id 0xef, DeviceId0 0x40, DeviceId1 0x18 flash size 16777216, sector count = 256 Flash: 16 MB In: serial Out: serial Err: serial Net: eth0: b4:21:8a:00:00:00 eth1: b4:21:8a:00:00:01 eth0, eth1 autoboot in 4 seconds (stop with 'lin')...

Booting image at 9fea0000 ...

Image Name: MIPS OpenWrt Linux-3.3.8 Created: 2015-02-03 14:03:09 UTC Image Type: MIPS Linux Kernel Image (lzma compressed) Data Size: 1129750 Bytes = 1.1 MB Load Address: 80060000 Entry Point: 80060000 Verifying Checksum at 0x9fea0040 ...OK Uncompressing Kernel Image ... OK No initrd

Transferring control to Linux (at address 80060000) ...

Giving linux memsize in bytes, 67108864

Starting kernel ...

[ 0.000000] Linux version 3.3.8 (build@build-base) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Tue Feb 3 15:02:42 CET 2015 [ 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] User-defined 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] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256 [ 0.000000] Kernel command line: console=spicons board=linino-yun mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) mem=64M rootfstype=squashfs,jffs2 noinitrd 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: 61004k/65536k available (2416k kernel code, 4532k reserved, 686k data, 216k init, 0k highmem) [ 0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1 [ 0.000000] NR_IRQS:256 [ 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] mach-linino: setting GPIO [ 0.530000] Setting GPIO OE 21 [ 0.540000] Setting GPIO OE2 22 [ 0.540000] Setting GPIO UART-ENA 23 [ 0.540000] mach-linino: enabling GPIO SPI Controller [ 0.550000] bio: create slab at 0 [ 0.560000] 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.570000] TCP established hash table entries: 2048 (order: 2, 16384 bytes) [ 0.570000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes) [ 0.570000] TCP: Hash tables configured (established 2048 bind 2048) [ 0.570000] TCP reno registered [ 0.570000] UDP hash table entries: 256 (order: 0, 4096 bytes) [ 0.580000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes) [ 0.580000] NET: Registered protocol family 1 [ 0.600000] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.600000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc. [ 0.610000] msgmni has been set to 119 [ 0.610000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253) [ 0.610000] io scheduler noop registered [ 0.620000] io scheduler deadline registered (default) [ 0.620000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled [ 0.630000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART [ 0.630000] console [spicons0] enabled, bootconsole disabled

As you can see I never get the option of enter failsave mode.

Are there another way to revive the Yun or edit the /etc/inittab?

Thanks

— Reply to this email directly or view it on GitHub https://github.com/arduino/YunBridge/issues/26 .图像已被发件人删除。

aabm00 commented 9 years ago

Hello

Could you be a little more accurate in the manner I could apply the process class to solve my problem?

I'm sorry but I 'm newbie in both Arduino and Linux. Can I edit the etc/inttab file with the process class?

Thanks

dragino commented 9 years ago

The Bridgeà FileWriteScript shows the way to work for you:

1/ write some content in a file

2/ execute this file.

What you need to do is:

1/ write some content into a file

2/ move this file to replace the /etc/inittab (Linux mv) command.

The inittab is very critical for linux to boot. So you would better check carefully before run the sketch, maybe try to write to another file first.

发件人: aabm00 [mailto:notifications@github.com] 发送时间: 2015年5月23日 15:07 收件人: arduino/YunBridge 抄送: edwin 主题: Re: [YunBridge] Edit the /etc/inittab file (#26)

Hello

Could you be a little more accurate in the manner I could apply the process class to solve my problem?

I'm sorry but I 'm newbie in both Arduino and Linux. Can I edit the etc/inttab file with the process class?

Thanks

— Reply to this email directly or view it on GitHub https://github.com/arduino/YunBridge/issues/26#issuecomment-104855333 .图像已被发件人删除。

aabm00 commented 9 years ago

Thank You

I'm going to take a look to figure out how it works.

sngl commented 9 years ago

I don't think this method will work, because the Bridge library need access to the serial console to launch the Bridge on the linux side. With no Bridge running on the linux side the Bridge library in the sketch will stuck at Bridge.begin(); because it tries to run commands on the Linino terminal but there is not any console attached to the serial port. If you have no access to wifi/ethernet/SerialTerminal one solution can be this http://www.arduino.cc/en/Tutorial/YunUBootReflash

dragino commented 9 years ago

Hi, Angelo,

Yes, you are true. Just noticed there is no ttyATH0 description in the /etc/inittab . so bridge should not work.

Best Regards,

Edwin

发件人: Angelo Scialabba [mailto:notifications@github.com] 发送时间: 2015年5月23日 18:14 收件人: arduino/YunBridge 抄送: edwin 主题: Re: [YunBridge] Edit the /etc/inittab file (#26)

I don't think this method will work, because the Bridge library need access to the serial console to launch the Bridge on the linux side. With no Bridge running on the linux side the Bridge library in the sketch will stuck at Bridge.begin(); because it tries to run commands on the Linino terminal but there is not any console attached to the serial port. If you have no access to wifi/ethernet/SerialTerminal one solution can be this http://www.arduino.cc/en/Tutorial/YunUBootReflash

— Reply to this email directly or view it on GitHub https://github.com/arduino/YunBridge/issues/26#issuecomment-104879003 .图像已被发件人删除。

aabm00 commented 9 years ago

Thanks you both.

Yes there isn't ttyATH0 in the /etc/inittab because I have installed LininoOS and LininoIO, and LininoIO works with ttySPI0. But it's good to know that is possible to use the process class to change files in Linux side.

Angelo, you were right!!

For LininoOS I followed this link I thought it wouldn't be possible to do it because of, that the ethernet conection didn't appear in the Arduino IDE. But after see your comment I remembered that for reflashing the (U-boot, kernel and roofs) the files are gotten from a TFTP server, giving the Yun a free IP.

Now I have installed the LininoOS, that is a version of openWRT, but I want to reinstall the original version 'openWRT-Yun'.

What would be the best way considering that the (U-boot, kernel and roofs) are version for LininoOS.

1- WLAN RESET for 30 seconds, and update to the last OpenWRT-Yun image following this link and after that, upgrade the (U-boot, kernel and roofs) for this version following this link 2- Directly update to the last OpenWRT-Yun image following this link and after that, upgrade the (U-boot, kernel and roofs) for this version following this link

Thanks

sngl commented 9 years ago

You can't follow this guide http://www.arduino.cc/en/Tutorial/YunSysupgrade because you have not access to your board/webpanel and you said that WLAN RESET has no effect. So the only way you can access to your board is from U-boot and you have to reflash kernel and root-fs.

aabm00 commented 9 years ago

That's exactly what I did and worked fine!!!!

Thanks