Build and program starting fixes

This commit is contained in:
Michal Moskal 2017-07-25 14:59:32 +01:00
parent de180e97aa
commit bcf597143a
6 changed files with 17 additions and 21 deletions

View File

@ -8,5 +8,5 @@ mod:
uf2: uf2:
$(MAKE) -C uf2daemon $(MAKE) -C uf2daemon
@mkdir -p bin @mkdir -p bin
cp uf2daemon/server bin/uf2daemon cp uf2daemon/server bin/uf2d

View File

@ -1,22 +1,9 @@
#!/bin/sh #!/bin/sh
set -ex set -ex
cd /mnt/ramdisk/prjs/ko cd /mnt/ramdisk/prjs/ko
echo 3 > /proc/sys/kernel/printk
insmod ./nbd.ko insmod ./nbd.ko
sleep 1 sleep 1
./nbd-serv & ./uf2d > /tmp/uf2d.log 2> /tmp/uf2derr.log
sleep 1 sleep 1
insmod ./d_usbdev.ko file=/dev/nbd0 HostStr=EV3 SerialStr=0016535543af insmod ./d_usbdev.ko file=/dev/nbd0 HostStr=EV3 SerialStr=0016535543af
L=/sys/devices/platform/musb_hdrc/gadget/lun0
echo $L
echo -n "ent: "
read LINE
#echo > $L/file
echo 3 > $L/reset
killall nbd-serv
sleep 1
./nbd-serv &
sleep 1
#echo /dev/nbd0 > $L/file
#sleep 1
echo 4 > $L/reset

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
set -xe set -xe
scp -qr * vm:linux/pxt/ scp -qr kernel uf2daemon Makefile vm:linux/pxt/
ssh vm "cd linux/pxt; make $1" ssh vm "cd linux/pxt; make $1"
mkdir -p bin mkdir -p bin
scp vm:linux/pxt/bin/* bin/ scp vm:linux/pxt/bin/* bin/

View File

@ -3,6 +3,7 @@
./mk ./mk
ev3duder up bin/d_usbdev.ko ../prjs/ko/d_usbdev.ko ev3duder up bin/d_usbdev.ko ../prjs/ko/d_usbdev.ko
ev3duder up bin/nbd.ko ../prjs/ko/nbd.ko ev3duder up bin/nbd.ko ../prjs/ko/nbd.ko
ev3duder up bin/nbd-serv ../prjs/ko/nbd-serv
ev3duder up ins ../prjs/ko/ins ev3duder up ins ../prjs/ko/ins
ev3duder exec 'rm ../prjs/ko/uf2d'
ev3duder up bin/uf2d ../prjs/ko/uf2d

View File

@ -666,21 +666,26 @@ void stopLMS() {
closedir(dir); closedir(dir);
if (lmsPid) { if (lmsPid) {
DBG("SIGSTOP to lmsPID=%d", lmsPid); DBG("SIGSTOP to lmsPID=%d\n", lmsPid);
kill(lmsPid, SIGSTOP); kill(lmsPid, SIGSTOP);
} else {
DBG("LMS not found\n");
} }
} }
void waitAndContinue() { void waitAndContinue() {
stopLMS();
for (int fd = 3; fd < 9999; ++fd) for (int fd = 3; fd < 9999; ++fd)
close(fd); close(fd);
pid_t child = fork(); pid_t child = fork();
if (child == 0) { if (child == 0) {
execl(elfPath, elfPath, "--msd"); DBG("start %s\n", elfPath);
execl(elfPath, elfPath, "--msd", (char*) NULL);
exit(128); exit(128);
} }
int status; int status;
waitpid(child, &status, 0); waitpid(child, &status, 0);
DBG("re-start LMS\n");
if (lmsPid) if (lmsPid)
kill(lmsPid, SIGCONT); kill(lmsPid, SIGCONT);
exit(0); exit(0);

View File

@ -133,6 +133,7 @@ void runNBD() {
reply.error = htonl(0); reply.error = htonl(0);
for (;;) { for (;;) {
nbd_ioctl(BLKFLSBUF, 0); // flush buffers - we don't want the kernel to cache the writes
int nread = read(sock, &request, sizeof(request)); int nread = read(sock, &request, sizeof(request));
if (nread < 0) { if (nread < 0) {
@ -199,7 +200,9 @@ int main() {
if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) != 0) { if (!WIFEXITED(wstatus) || WEXITSTATUS(wstatus) != 0) {
LOG("abnormal child return, %d", child); LOG("abnormal child return, %d", child);
sleep(3); sleep(5);
} else {
sleep(2);
} }
} }