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