summaryrefslogtreecommitdiff
path: root/debian/patches/bootshell0011-fixup_bootshell.patch
blob: a55c79d5234c1fc8bdf655a47b0c09a2334a86c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
From d649e0d40bb8aa6c2b1de7a556f9453943dd2c9d Mon Sep 17 00:00:00 2001
From: Justus Winter <4winter@informatik.uni-hamburg.de>
Date: Tue, 29 Sep 2015 18:03:45 +0200
Subject: [PATCH hurd 11/11] fixup_bootshell

---
 bootshell/boot.scm      |  5 ++++
 bootshell/bootstrap.scm | 80 +++++++++++++++++++++++++------------------------
 bootshell/runsystem.scm |  2 +-
 3 files changed, 47 insertions(+), 40 deletions(-)

diff --git a/bootshell/boot.scm b/bootshell/boot.scm
index 8b51459..bef374d 100644
--- a/bootshell/boot.scm
+++ b/bootshell/boot.scm
@@ -233,6 +233,11 @@ Environment:
 (define (replay-log)
   (for-each display messages))
 
+(define verbose #f)
+(define (trace . args)
+  (if verbose
+      (log . args)))
+
 (define timeout 1000) ; 1 second
 
 (define (pause)
diff --git a/bootshell/bootstrap.scm b/bootshell/bootstrap.scm
index a521e01..766321e 100644
--- a/bootshell/bootstrap.scm
+++ b/bootshell/bootstrap.scm
@@ -73,45 +73,45 @@
   (letport
    ((proc-task (task-create mach-task-self 0))
     (auth-task (task-create mach-task-self 0)))
-
-    ;; Starting proc and auth is tricky, we need to do it simultaneously.
-    (let ((pc (bootstrap-proc (start-translator proc-task '("/hurd/proc"))))
-	  (ac (bootstrap-auth (start-translator auth-task '("/hurd/auth"))))
-	  ;; Projections for the cookies returned by bootstrap-*.
-	  (:reply car) (:replyPoly cadr) (:server caddr))
-      (log "proc ")
-      (startup-procinit-reply (:reply pc) (:replyPoly pc) ESUCCESS
-			      mach-task-self (:server ac)
-			      host-priv device-master)
-      (bind-proc (:server pc))
-
-      ;; Declare that these tasks are our children, and fix them up.
-      (map fixup-task (list rootfs-server-task exec-server-task
-			    proc-task auth-task))
-
-      (log "auth ")
-      (startup-authinit-reply (:reply ac) (:replyPoly ac) ESUCCESS
-			      (proc->task->proc (:server pc) auth-task))
-      (bind-auth (:server ac))
-
-      ;; Give the rootfs its proc and auth port.
-      (fsys-init rootfs-control
-		 (proc->task->proc (:server pc) rootfs-server-task)
-		 (:server ac))
-
-      ;; Supply the proc server with a standard template.
-      (proc->auth->set-std-execdata! (:server pc) (:server ac))
-
-      ;; Neither the kernel nor our bootscript task have command line
-      ;; arguments.  Fix that.
-      (frob-task (proc->pid->task (:server pc) 3)
-			   '(gnumach huhu lala XXX))
-      (if (mach-port-valid? bootscript-task)
-	  (frob-task bootscript-task '(/hurd/runsystem.scm)))
-      (frob-task mach-task-self '(/hurd/bootshell))
-
-      (mach-port-deallocate mach-task-self (:server pc))
-      (mach-port-deallocate mach-task-self (:server ac)))))
+   (log "about to start proc and auth")
+   ;; Starting proc and auth is tricky, we need to do it simultaneously.
+   (let ((pc (bootstrap-proc (start-translator proc-task '("/hurd/proc"))))
+	 (ac (bootstrap-auth (start-translator auth-task '("/hurd/auth"))))
+	 ;; Projections for the cookies returned by bootstrap-*.
+	 (:reply car) (:replyPoly cadr) (:server caddr))
+     (log "proc ")
+     (startup-procinit-reply (:reply pc) (:replyPoly pc) ESUCCESS
+			     mach-task-self (:server ac)
+			     host-priv device-master)
+     (bind-proc (:server pc))
+
+     ;; Declare that these tasks are our children, and fix them up.
+     (map fixup-task (list rootfs-server-task exec-server-task
+			   proc-task auth-task))
+
+     (log "auth ")
+     (startup-authinit-reply (:reply ac) (:replyPoly ac) ESUCCESS
+			     (proc->task->proc (:server pc) auth-task))
+     (bind-auth (:server ac))
+
+     ;; Give the rootfs its proc and auth port.
+     (fsys-init rootfs-control
+		(proc->task->proc (:server pc) rootfs-server-task)
+		(:server ac))
+
+     ;; Supply the proc server with a standard template.
+     (proc->auth->set-std-execdata! (:server pc) (:server ac))
+
+     ;; Neither the kernel nor our bootscript task have command line
+     ;; arguments.  Fix that.
+     (frob-task (proc->pid->task (:server pc) 3)
+		'(gnumach huhu lala XXX))
+     (if (mach-port-valid? bootscript-task)
+	 (frob-task bootscript-task '(/hurd/runsystem.scm)))
+     (frob-task mach-task-self '(/hurd/bootshell))
+
+     (mach-port-deallocate mach-task-self (:server pc))
+     (mach-port-deallocate mach-task-self (:server ac)))))
 
 (define (start-hurd-console)
   (log "hurd-console ")
@@ -215,6 +215,7 @@
 	  (mach-port-allocate mach-task-self MACH_PORT_RIGHT_RECEIVE))
 	 (task
 	  (prepare-task (make-send-right bootstrap))))
+    (log "proc handshake")
     (handle-startup-procinit bootstrap timeout)))
 
 ;; Bootstraps the auth server using the startup protocol.
@@ -223,6 +224,7 @@
 	  (mach-port-allocate mach-task-self MACH_PORT_RIGHT_RECEIVE))
 	 (task
 	  (prepare-task (make-send-right bootstrap))))
+    (log "auth handshake")
     (handle-startup-authinit bootstrap timeout)))
 
 ;; Bootstraps a translator using the fsys protocol and installs it as
diff --git a/bootshell/runsystem.scm b/bootshell/runsystem.scm
index a2f0ee2..bcf2c80 100644
--- a/bootshell/runsystem.scm
+++ b/bootshell/runsystem.scm
@@ -36,7 +36,7 @@
 			(default)
 			(cdr value)))))
 	(init (:kwarg "init" (lambda () "/sbin/init"))))
-
+    (set! verbose #t)
     (bootstrap (list
 		(lambda () (first-stage (:kwarg "root" (lambda () "xxx"))))
 		early-startup
-- 
2.1.4