|
|||||||
|
You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community today, you will have fewer ads, access to post topics, communicate privately with other members, respond to polls, upload content and access many other special features. If you have any problems with the registration process or your account login, please contact us. Hint: Don't have time to visit us daily? Subscribe to our main RSS feed to receive our frontpage posts at your convenience. |
| iRex Developer's Corner For iRex-based development discussion and planning |
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
|
#1 |
|
JSR FFD2
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
|
Hi All,
When experimenting with essential iliad programs, a small mistake can be fatal: unbootable device, re-flash required. I solved this with the following set-up:
This is a long post, but it's really quite simple. Read along... When experimenting you can just modify 'my_start.sh', and let this do whatever you want. If the iliad doesn't start properly: remove the sd-card (it works even with the dummy plastic one), reboot, and try again. Here is the modification at the start of the official 'start.sh': Code:
#!/bin/sh #HANSEL: Alternative start export MYLOG=/home/root/start.log /usr/local/bin/sd_present aaa 2>>$MYLOG if /usr/local/bin/sd_present then . /home/root/my_start.sh exit 0 fi #HANSEL: original start follows... . /usr/bin/do_updates.sh #/usr/bin/erregInit #/sbin/syslogd -s 500 -b 0 -O /var/log/messages export DISPLAY=:0 [snip] It's a good idea to start my_start.sh (/home/root/my_script.sh) as a copy of start.sh, and modify it in small steps. The following script is my first experiment: Code:
#!/bin/sh date >>$MYLOG echo "############################" >>$MYLOG /usr/local/bin/sd_present aaa 2>>$MYLOG echo "===== pwd =======================" >>$MYLOG pwd >>$MYLOG echo "===== mount =======================" >>$MYLOG mount >>$MYLOG echo "====== ps -edalf ======================" >>$MYLOG ps -edalf >>$MYLOG echo "====== /usr/local ======================" >>$MYLOG ls -l /usr/local >>$MYLOG echo "====== /mnt/free ======================" >>$MYLOG ls -l /mnt/free >>$MYLOG echo "============================" >>$MYLOG . /usr/bin/do_updates.sh #/usr/bin/erregInit #/sbin/syslogd -s 500 -b 0 -O /var/log/messages export DISPLAY=:0 export LD_LIBRARY_PATH=/usr/lib/mozilla-minimo [snip] Code:
// This progam return 0 (= success) when sd-card is present
// free-ware without purpose, hansel<AT>hpelbers<DOT>org, 12-12-2008
// To test: run it with any parameter: it will print if the card is inserted or not
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#define BUTTON_IOCTL_BASE 'b'
#define BUTTON_IOCTL_GET_STATUS _IOR( BUTTON_IOCTL_BASE,7,unsigned int)
int main(int argc, char *argv[]) {
int stat;
int dev;
if ((dev = open("/dev/buttons", O_RDWR)) < 0) {
fprintf(stderr,"ERROR opening failed\n");
return 10; // error
}
else if (ioctl(dev, BUTTON_IOCTL_GET_STATUS, &stat)) {
fprintf(stderr, "ERROR: BUTTON_IOCTL_GET_STATUS failed\n");
return 11; // error
}
else {
if(argc>1) fprintf(stderr, "OK: sd_present=%d\n", (stat&0x800) != 0);
return (stat&0x800) ? 0 : 1;
}
}
Code:
arm-linux-gcc sd_present.c -o sd_present Happy hacking, Hansel Edit: attached binary that runs on Iliad
__________________
Interests: God, people, computers; Iliad notes and projects; Private site (dutch, spam, ):
Last edited by hansel; 12-11-2008 at 05:37 PM. Reason: attach sd_present |
|
|
|
|
Enthusiast
|
|
|
|
#2 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]()
Posts: 933
Karma: 595
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Can't I test if sd is inserted by using shell script: "if [ -e /media/card/specific_file_onsd ]"?
Added: I seem to understand your idea. It's really a good idea for customizing boot. With your idea, we can add customized boot script in SD for testing. If failed, just remove SD and reboot, and everything goes back to normal. Last edited by ericshliao; 12-11-2008 at 09:03 PM. |
|
|
|
|
|
#3 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]()
Posts: 933
Karma: 595
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
I would like to suggest a small modification:
just replace the line in /home/root/.start.sh: Code:
/usr/bin/displayMgr -p & Code:
if [-f /media/card/mybootscript.sh ]; then
. /media/card/mybootscript.sh
else
/usr/bin/displayMgr -p &
fi
Last edited by ericshliao; 12-11-2008 at 10:17 PM. |
|
|
|
|
|
#4 |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
|
|
|
|
|
|
|
#5 | |
|
JSR FFD2
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts: 305
Karma: 1045
Join Date: Aug 2008
Location: Rotterdam, Netherlands, Europe, Sol 3
Device: iliad
|
Quote:
= The Idea it to only make a small change to start.sh, and then leave it alone. Personally I'm experimenting with contentLister. If you change it often for different things, you'll end up by making a 'fatal' mistake as I did earlier yesterday ![]() = The -f test will not work. The removable devices are not yet mounted at that stage. The hotplug stuff is at the *end* of start.sh. That's why I put those start scripts in the main file system...
__________________
Interests: God, people, computers; Iliad notes and projects; Private site (dutch, spam, ):
|
|
|
|
|
|
|
#6 | |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]()
Posts: 933
Karma: 595
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Quote:
What if I move the following lines: Code:
modprobe phci modprobe usb-storage /etc/init.d/hotplug start modprobe mscd Last edited by ericshliao; 12-12-2008 at 02:24 AM. |
|
|
|
|
|
|
#7 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]()
Posts: 933
Karma: 595
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Ah...
I have another idea. put xepdmgr and mybootscript.sh in /home/root. And use the following code in .start.sh: Code:
if [ -f /home/root/mybootscript.sh ]; then chmod 777 /home/root/mybootscript.sh chmod 777 /home/root/xepdmgr . /home/root/mybootscript.sh mv /home/root/mybootscript.sh /home/root/_mybootscript.sh else /usr/bin/displayMgr -p & fi If xepdmgr failed, there still a chance it will back to normal in the next boot. Last edited by ericshliao; 12-12-2008 at 02:45 AM. |
|
|
|
|
|
#8 | |
|
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts: 415
Karma: 754
Join Date: Jun 2006
Location: Madrid, Spain
Device: iliad, onhandpc, newton, zaurus
|
Quote:
would be some scenarios that would be fatal with your current code.AFAICT Hansel's code is safe. |
|
|
|
|
|
|
#9 |
|
Guru
![]() ![]() ![]() ![]() ![]() ![]()
Posts: 933
Karma: 595
Join Date: Nov 2007
Device: Dell X51v; iLiad v2
|
Yes, it's fatal if anything wrong with mybootscript.sh and that mv line might never be executed. But I don't understand your words. How to do it?
![]() Added: Ah... I understand your words now. Yes, I should do the mv action before do source action. Currently, there is only one line in mybootscript.sh: Code:
/home/root/xepdmgr & I can replace displayMgr with xepdmgr with my mod now. Last edited by ericshliao; 12-12-2008 at 04:10 AM. |
|
|
|
|
|
#10 |
|
Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
Posts: 294
Karma: 3441
Join Date: Apr 2007
Location: Brooklyn, NY, USA
Device: iRex iLiad v1, Blackberry Tour, Kindle DX, iPad.
|
Hi, all!
Nice work. I did something similar a while ago; I posted it in this thread. It's pretty much the same idea, but the implementation is a little different. Basically it's a start.sh that calls the original start.sh by default. However, if it finds a lockfile, it first deletes the lockfile and then calls testing.sh instead of the default start.sh. This way, you can just create the lockfile (I use the command 'touch lockfile') and reboot. The iLiad will delete the lockfile and use the experimental start script. If the script fails, simply reboot and you're back to the original start script. I like your idea of checking for an SD card, because then all your work can be done on the SD card. No need to use ssh to login or to manually create a lockfile, it's all just automatic. Nice work! |
|
|
|
![]() |
| Tags |
| development, iliad, software |
| Thread Tools | Search this Thread |
| Display Modes | |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Problem with News scripts | Derry | Calibre | 4 | 08-19-2008 05:08 AM |
| Purchasing from jinke.com.cn. Is it safe? | July | HanLin eBook | 12 | 07-23-2008 12:38 PM |
| Fox Searchlight scripts available in PDF | jckatz | Reading Recommendations | 1 | 02-23-2008 11:39 PM |
| Network Control Scripts | synerr | iRex | 3 | 01-13-2008 06:54 AM |
| Television scripts for your handheld | Bob Russell | Lounge | 2 | 01-07-2006 06:22 PM |