Modify

Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#10785 closed defect (fixed)

Spontaneous shutdown during boot on AGV2+W.

Reported by: fredrik.ohrn@… Owned by: florian
Priority: normal Milestone: Barrier Breaker 14.07
Component: kernel Version: Attitude Adjustment 12.09 Beta
Keywords: Cc:

Description

After flashing the r29732 snapshot build my AGV2+W shuts down unexpectedly during the boot sequence.

Entering failsafe mode avoids the shutdown and after a lot of trial and error I've found that deleting /etc/modules.d/62-input-gpio-buttons lets the boot complete normally.

Manually insmoding gpio_buttons when the device is up and running does not cause a shutdown which leads me to believe that the driver itself is OK. Rather it's some script run during boot that incorrectly shuts down the device if the driver is present. I have not managed to figure out which one.

Attachments (3)

bootlog.txt (11.0 KB) - added by fredrik.ohrn@… 6 years ago.
Log from failed boot.
invert_button_polarity.patch (732 bytes) - added by jogo 5 years ago.
wps_active_low.patch (786 bytes) - added by fredrik.ohrn@… 5 years ago.
WPS button is active low on AGPF-S0.

Download all attachments as: .zip

Change History (22)

Changed 6 years ago by fredrik.ohrn@…

Log from failed boot.

comment:1 Changed 6 years ago by florian

  • Owner changed from developers to florian
  • Status changed from new to accepted

This could be triggered by sys-rq, can you disable kernel support for sys-rq and see if that helps?

comment:2 Changed 6 years ago by fredrik.ohrn@…

I added the line echo 0 >/proc/sys/kernel/sysrq just above load_modules in /etc/init.d/boot but it didn't help, still shuts down.

comment:3 Changed 6 years ago by joel_ejc@…

I got the same behaviour with my NB4 (bcm658) and different kernels (3.2, 3.3)
I found
system halted
occurs when there is
Button Hotplug driver version 0.4.1 is present inside bootlog.txt
...but I'm able to tell if it's linked to this driver
CONFIG_PACKAGE_kmod-button-hotplug=m
or
CONFIG_kmod-button-hotplug=m
or
a conflict between
CONFIG_PACKAGE_kmod-button-input
and
CONFIG_kmod-button-input

Maybe the beginning of a solution

Joel

comment:4 Changed 6 years ago by joel_ejc

I tried playing with SYSRQ (don't solve system halt behaviour)

comment:5 Changed 6 years ago by joel_ejc@…

I can avoid system halted if etc/modules.d/30-button-hotplug is moved to /etc/modules.d/99-button-hotplug...but I don't check if this module is functionnal.

Joel

comment:6 Changed 6 years ago by joel_ejc@…

I did a new test with kernel3.3-rc4. Everything is allrigth !

comment:7 Changed 6 years ago by florian

  • Resolution set to fixed
  • Status changed from accepted to closed

comment:8 follow-up: Changed 6 years ago by fredrik.ohrn@…

Hi Florian,

I just tried snapshot build r32131 (from 9/6) and it still suffers the shutdown problem. Is the fix not included in the snapshot builds yet?

comment:9 in reply to: ↑ 8 ; follow-up: Changed 6 years ago by jogo

Replying to fredrik.ohrn@…:

Hi Florian,

I just tried snapshot build r32131 (from 9/6) and it still suffers the shutdown problem. Is the fix not included in the snapshot builds yet?

Likely it wasn't fixed at all, and the 3.3 build was missing e.g. kmod-gpio-buttons-polled, resulting in the problem not triggering.

I had the same effect when I had the wrong polarity for a button, can you try building your own image and switching the polarity of one of the buttons (by changing .active_low to 1/0) and see if it fixes it?

comment:10 Changed 6 years ago by joel_ejc@…

with these drivers
button_hotplug 2656 0
gpio_buttons 1872 0
input_polldev 1680 2 gpio_keys_polled,gpio_buttons
input_core 20864 7 button_hotplug,gpio_keys_polled,gpio_buttons,gpio_keys,evdev,input_polldev

no problem with my NB4 (r32165)

Joel

comment:11 in reply to: ↑ 9 ; follow-up: Changed 5 years ago by fredrik.ohrn@…

  • Resolution fixed deleted
  • Status changed from closed to reopened

Replying to jogo:

I had the same effect when I had the wrong polarity for a button, can you try building your own image and switching the polarity of one of the buttons (by changing .active_low to 1/0) and see if it fixes it?

Hi Jogo,

I finally got some time to look into this again and I failed rather miserably at building my own patched image.

However I can confirm that the button polarity is inverted. I made a hotplug button script with a bit of logging and I get a release action when pressing the buttons and a press action when releasing. This is true for both the reset and wps buttons.

Rather than building a whole firmware image, is there an easy way to build just the gpio_keys_polled.ko module after patching the board_AGPFS0 struct?

/Fredrik

comment:12 in reply to: ↑ 11 ; follow-up: Changed 5 years ago by jogo

  • Component changed from base system to kernel
  • Version changed from Trunk to Attitude Adjustment 12.09 Beta

Replying to fredrik.ohrn@…:

Replying to jogo:

I had the same effect when I had the wrong polarity for a button, can you try building your own image and switching the polarity of one of the buttons (by changing .active_low to 1/0) and see if it fixes it?

Hi Jogo,

I finally got some time to look into this again and I failed rather miserably at building my own patched image.

Let me create a patch for you to test.

However I can confirm that the button polarity is inverted. I made a hotplug button script with a bit of logging and I get a release action when pressing the buttons and a press action when releasing. This is true for both the reset and wps buttons.

Cool, thanks for testing and nice work.

Rather than building a whole firmware image, is there an easy way to build just the gpio_keys_polled.ko module after patching the board_AGPFS0 struct?

This won't work - the information of the board struct is in the kernel, and just passed to the gpio keys polled, so you will have to build a new image.

comment:13 in reply to: ↑ 12 ; follow-up: Changed 5 years ago by fredrik.ohrn@…

Replying to jogo:

Let me create a patch for you to test.

Thank you, much appreciated.

/Fredrik

Changed 5 years ago by jogo

comment:14 in reply to: ↑ 13 Changed 5 years ago by jogo

Replying to fredrik.ohrn@…:

Replying to jogo:

Let me create a patch for you to test.

Thank you, much appreciated.

Okay here it is. Apply it in your checkout's root folder with:

patch -p1 -i invert_button_polarity.patch

This should result in

patching file target/linux/brcm63xx/patches-3.3/550-alice_gate2_leds.patch

After that, issue

make target/linux/clean

to make it clean the kernel source tree so it gets rebuilt, then build an image like usually.

comment:15 follow-up: Changed 5 years ago by fredrik.ohrn@…

Thanks,

Patching the source code is the easy part, it was building a flashable image that gave me trouble, but after a lot of trial and error I figured it out.

I've now tried the patch on device and it fixed the wps button but the reset button is still inverted. Adding an explicit .active_low = 0 line to the struct didn't help either so I guess the reset button polarity must be hard coded somewhere else.

comment:16 in reply to: ↑ 15 Changed 5 years ago by jogo

Replying to fredrik.ohrn@…:

I've now tried the patch on device and it fixed the wps button but the reset button is still inverted. Adding an explicit .active_low = 0 line to the struct didn't help either so I guess the reset button polarity must be hard coded somewhere else.

Hm, are you 100% sure the reset button is active high? There are two ways to test:

a) Build an image with the reset button again with active_low = 1 (just edit build_dir/linux-brcm63xx/linux-3.3.8/arch/mips/bcm63xx/board_brcm963xx.c}} and rebuild the kernel and image with {{{make target/linux/install without any clean this time)

or

b) Don't load the gpio button hotplug module (or unload it), but directly observe the gpio state:

echo 37 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio37/direction
echo 0 > /sys/class/gpio/gpio37/active_low

then observe the value with

cat /sys/class/gpio/gpio37/value

when (de-)pressing the button.

Changed 5 years ago by fredrik.ohrn@…

WPS button is active low on AGPF-S0.

comment:17 follow-up: Changed 5 years ago by fredrik.ohrn@…

I must have been seriously confused when I concluded that the reset button was inverted earlier today, it was correct the entire time.

Both buttons are active low and only the wps button needs fixing. With the wps_active_low.patch applied the device boots just fine, the shutdown is gone.

Still, there must be something broken in the startup sequence since the device shuts down if the wps button is pressed during boot.

comment:18 in reply to: ↑ 17 Changed 5 years ago by jogo

  • Resolution set to fixed
  • Status changed from reopened to closed

Replying to fredrik.ohrn@…:

Still, there must be something broken in the startup sequence since the device shuts down if the wps button is pressed during boot.

Yes, I noticed that, too (on a different device). But this is a separate issue.

Anyway, fix committed with r33340.

comment:19 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.