最近发现STlinux系统无法reboot,执行了如下几个命令都是一样的结果
root@wtCAB7167jffs2 :~# reboot
INIT: Switching to runlevel: 6
root@xxha:~#
Broadcast message from root (console) (Sat Jan 1 00:09:00 2000):
INIT: Switching to runlevel: 6
root@xxha:~#
Broadcast message from root (console) (Sat Jan 1 00:09:00 2000):
The system is going down for reboot NOW!
INIT: Sending processes the TERM signal
INIT: Sending processes the KILL signal
Stopping portmap daemon: portmap.
Stopping sshd:ok
Saving random seed...done.
Stopping xinetd: ok
Stopping kernel log daemon: klogd.
not deconfiguring network interfaces: network file systems still mounted.
Stopping system log daemon: syslogd.
Stopping kernel event manager...
Sending all processes the TERM signal...done.
Sending all processes the KILL signal...done.
Unmounting remote and non-toplevel virtual filesystems...done.
Deactivating swap...umount: invalid option -- t
done.
Unmounting local filesystems...umount: invalid option -- t
done.
Rebooting... Restarting
INIT: Sending processes the TERM signal
INIT: Sending processes the KILL signal
Stopping portmap daemon: portmap.
Stopping sshd:ok
Saving random seed...done.
Stopping xinetd: ok
Stopping kernel log daemon: klogd.
not deconfiguring network interfaces: network file systems still mounted.
Stopping system log daemon: syslogd.
Stopping kernel event manager...
Sending all processes the TERM signal...done.
Sending all processes the KILL signal...done.
Unmounting remote and non-toplevel virtual filesystems...done.
Deactivating swap...umount: invalid option -- t
done.
Unmounting local filesystems...umount: invalid option -- t
done.
Rebooting... Restarting
root@xxha :~# init 6
INIT: Switching to runlevel: 6
INIT: Sending processes the TERM signal
INIT: Sending processes the KILL signal
Stopping portmap daemon: portmap.
Stopping sshd:ok
Saving random seed...done.
Stopping xinetd: ok
Stopping kernel log daemon: klogd.
not deconfiguring network interfaces: network file systems still mounted.
Stopping system log daemon: syslogd.
Stopping kernel event manager...
Sending all processes the TERM signal...done.
Sending all processes the KILL signal...done.
Unmounting remote and non-toplevel virtual filesystems...done.
Deactivating swap...umount: invalid option -- t
done.
Unmounting local filesystems...umount: invalid option -- t
done.
Rebooting... Restarting
root@xxha :~# shutdown -r now
INIT: Switching to runlevel: 6
root@xxha:~#
Broadcast message from root (console) (Sat Jan 1 00:06:13 2000):
The system is going down for reboot NOW!
INIT: Sending processes the TERM signal
INIT: Sending processes the KILL signal
Stopping portmap daemon: portmap.
Stopping sshd:ok
Saving random seed...done.
Stopping xinetd: ok
Stopping kernel log daemon: klogd.
not deconfiguring network interfaces: network file systems still mounted.
Stopping system log daemon: syslogd.
Stopping kernel event manager...
Sending all processes the TERM signal...done.
Sending all processes the KILL signal...done.
Unmounting remote and non-toplevel virtual filesystems...done.
Deactivating swap...umount: invalid option -- t
done.
Unmounting local filesystems...umount: invalid option -- t
done.
Rebooting... Restarting
INIT: Sending processes the TERM signal
INIT: Sending processes the KILL signal
Stopping portmap daemon: portmap.
Stopping sshd:ok
Saving random seed...done.
Stopping xinetd: ok
Stopping kernel log daemon: klogd.
not deconfiguring network interfaces: network file systems still mounted.
Stopping system log daemon: syslogd.
Stopping kernel event manager...
Sending all processes the TERM signal...done.
Sending all processes the KILL signal...done.
Unmounting remote and non-toplevel virtual filesystems...done.
Deactivating swap...umount: invalid option -- t
done.
Unmounting local filesystems...umount: invalid option -- t
done.
Rebooting... Restarting
root@xxha :~# reboot -f
Restarting
Restarting
分析,应该是kernel和uboot出了问题。
在uboot里执行reset,也没重起反应,说明uboot的重起也有问题。
后来联系了支持,得到几个补丁。打上后,果然就好了。
补丁如下:
1.内核部分,有2个patch:
[root@localhost kernel]# cat linux-sh4-2.6.23.17_stm23_0122-7105machine_restart-kernel122.patch
--- linux-sh4-2.6.23.17_stm23_0122/ arch/sh/kernel/process.c 2009-08-28 13:07:14.000000000 +0100
+++ linux-sh4-2.6.23.17_stm23_0122new/arch/sh/kernel/process.c 2009-09-29 13:41:35.000000000 +0100
@@ -26,6 +26,7 @@
#include <asm/system.h>
#include <asm/ubc.h>
#include <asm/watchdog.h>
+#include <linux/stm/sysconf.h>
static int hlt_counter;
int ubc_usercnt = 0;
@@ -106,10 +107,20 @@ static void watchdog_trigger_immediate(v
void machine_restart(char *__unused)
{
- /* Use watchdog timer to trigger reset */
- local_irq_disable();
- watchdog_trigger_immediate();
- while (1) {};
+ struct sysconf_field *sc1;
+ struct sysconf_field *sc2;
+ /* Use watchdog timer to trigger reset */
+ local_irq_disable();
+ /* ensure the reset period is short and that the reset is */
+ /* not masked */
+ if (! (sc1 = sysconf_claim (SYS_CFG, 9, 29, 29, "kernel")))
+ printk (KERN_EMERG "Cant claim sysconf9\n");
+ if (! (sc2 = sysconf_claim (SYS_CFG, 9, 0, 25, "kernel")))
+ printk (KERN_EMERG "Cant claim sysconf9\n");
+ sysconf_write (sc1, 0x0);
+ sysconf_write (sc2, 0x00000a8c);
+ watchdog_trigger_immediate();
+ while (1) {};
}
void machine_halt(void)
[root@localhost kernel]#
--- linux-sh4-2.6.23.17_stm23_0122/ arch/sh/kernel/process.c 2009-08-28 13:07:14.000000000 +0100
+++ linux-sh4-2.6.23.17_stm23_0122new/arch/sh/kernel/process.c 2009-09-29 13:41:35.000000000 +0100
@@ -26,6 +26,7 @@
#include <asm/system.h>
#include <asm/ubc.h>
#include <asm/watchdog.h>
+#include <linux/stm/sysconf.h>
static int hlt_counter;
int ubc_usercnt = 0;
@@ -106,10 +107,20 @@ static void watchdog_trigger_immediate(v
void machine_restart(char *__unused)
{
- /* Use watchdog timer to trigger reset */
- local_irq_disable();
- watchdog_trigger_immediate();
- while (1) {};
+ struct sysconf_field *sc1;
+ struct sysconf_field *sc2;
+ /* Use watchdog timer to trigger reset */
+ local_irq_disable();
+ /* ensure the reset period is short and that the reset is */
+ /* not masked */
+ if (! (sc1 = sysconf_claim (SYS_CFG, 9, 29, 29, "kernel")))
+ printk (KERN_EMERG "Cant claim sysconf9\n");
+ if (! (sc2 = sysconf_claim (SYS_CFG, 9, 0, 25, "kernel")))
+ printk (KERN_EMERG "Cant claim sysconf9\n");
+ sysconf_write (sc1, 0x0);
+ sysconf_write (sc2, 0x00000a8c);
+ watchdog_trigger_immediate();
+ while (1) {};
}
void machine_halt(void)
[root@localhost kernel]#
[ root@localhost kernel]# cat linux-sh4-2.6.23.17_stm23_0122-pdk7105setup.patch
--- linux-sh4-2.6.23.17_stm23_0122 /arch/sh/boards/st/pdk7105/setup.c 2009-08-28 13:07:14.000000000 +0100
+++ linux-sh4-2.6.23.17_stm23_0122-new/arch/sh/boards/st/pdk7105/setup.c 2009-09-29 13:44:53.000000000 +0100
@@ -313,6 +313,12 @@ static int __init device_init(void)
struct sysconf_field *sc;
u32 boot_mode;
+ /* Get the reset chain correct to start with */
+ sc = sysconf_claim(SYS_CFG, 9, 27, 28, "reset_chain");
+ sysconf_write(sc, 0);
+ /* release the sysconf bits so the coprocessor driver can claim them*/
+ sysconf_release (sc);
+
bank1_start = emi_bank_base(1);
bank2_start = emi_bank_base(2);
[root@localhost kernel]#
2.uboot部分内核:
把 pdk7105.romgen 拷贝到
[root@localhost u-boot-sh4-1.3.1_stm23_0046]# cp -f pdk7105.romgen board/st/pdk7105/pdk7105.romgen
[root@localhost u-boot-sh4-1.3.1_stm23_0046]# cp -f pdk7105.romgen board/st/pdk7105/pdk7105.romgen
[root@localhost kernel]# cat u-boot_0042_reset_7105.patch
--- u-boot-sh4-1.3.1_stm23_0042/cpu/sh/stx7105/stx7105.c 2008-10-15 00:09:42.000000000 +0100
+++ u-boot-sh4-1.3.1_stm23_0042-mb680/cpu/sh/stx7105/stx7105.c 2009-03-23 13:47:15.000000000 +0000
@@ -181,10 +181,9 @@ int soc_init(void)
bd->bi_devid = *STX7105_SYSCONF_DEVICEID_0;
-#if QQQ /* QQQ - TO FIX */
- /* Make sure reset period is shorter than WDT timeout */
- *STX7105_SYSCONF_SYS_CFG09 = (*STX7105_SYSCONF_SYS_CFG09 & 0xFF000000) | 0x000A8C;
-#endif /* QQQ - TO FIX */
+ /* Make sure reset period is shorter than WDT timeout and that */
+ /* the reset is not bypassed */
+ *STX7105_SYSCONF_SYS_CFG09 = (*STX7105_SYSCONF_SYS_CFG09 & 0xF7000000) | 0x000A8C;
return 0;
}
[root@localhost kernel]#
--- u-boot-sh4-1.3.1_stm23_0042/cpu/sh/stx7105/stx7105.c 2008-10-15 00:09:42.000000000 +0100
+++ u-boot-sh4-1.3.1_stm23_0042-mb680/cpu/sh/stx7105/stx7105.c 2009-03-23 13:47:15.000000000 +0000
@@ -181,10 +181,9 @@ int soc_init(void)
bd->bi_devid = *STX7105_SYSCONF_DEVICEID_0;
-#if QQQ /* QQQ - TO FIX */
- /* Make sure reset period is shorter than WDT timeout */
- *STX7105_SYSCONF_SYS_CFG09 = (*STX7105_SYSCONF_SYS_CFG09 & 0xFF000000) | 0x000A8C;
-#endif /* QQQ - TO FIX */
+ /* Make sure reset period is shorter than WDT timeout and that */
+ /* the reset is not bypassed */
+ *STX7105_SYSCONF_SYS_CFG09 = (*STX7105_SYSCONF_SYS_CFG09 & 0xF7000000) | 0x000A8C;
return 0;
}
[root@localhost kernel]#
打完上述4个补丁,重新编译u-boot,kernel,烧写进nandflash,启动,就可以reboot成功了~,u-boot也可以成功reset了~