var w io.Writer = zf
        if *gopackage != "" {
-               fmt.Fprintf(zf, "package %s\n\nfunc init() {\n\tunzip(\"", *gopackage)
+               fmt.Fprintf(zf, `package %s
+import "sync"
+func init() {
+       var once sync.Once
+       fsinit = func() {
+               once.Do(func() {
+                       unzip("`, *gopackage)
                gw := &goWriter{b: bufio.NewWriter(w)}
                defer func() {
                        if err := gw.Close(); err != nil {
 }
 
 func (w *goWriter) Close() error {
-       fmt.Fprintf(w.b, "\")\n}\n")
+       fmt.Fprintf(w.b, "\")\n\t\t})\n\t}\n}")
        w.b.Flush()
        return nil
 }
 
 }
 
 var fs = newFsys()
+var fsinit = func() {}
 
 func init() {
+       // do not trigger loading of zipped file system here
+       oldFsinit := fsinit
+       defer func() { fsinit = oldFsinit }()
+       fsinit = func() {}
        Mkdir("/dev", 0555)
        Mkdir("/tmp", 0777)
        mkdev("/dev/null", 0666, openNull)
 func chdirEnv() {
        pwd, ok := Getenv("NACLPWD")
        if ok {
-               Chdir(pwd)
+               chdir(pwd)
        }
 }
 
 // Standard Unix system calls.
 
 func Open(path string, openmode int, perm uint32) (fd int, err error) {
+       fsinit()
        fs.mu.Lock()
        defer fs.mu.Unlock()
        f, err := fs.open(path, openmode, perm&0777|S_IFREG)
 }
 
 func Stat(path string, st *Stat_t) error {
+       fsinit()
        fs.mu.Lock()
        defer fs.mu.Unlock()
        ip, _, err := fs.namei(path, false)
 }
 
 func unlink(path string, isdir bool) error {
+       fsinit()
        fs.mu.Lock()
        defer fs.mu.Unlock()
        dp, elem, err := fs.namei(path, true)
 }
 
 func Chmod(path string, mode uint32) error {
+       fsinit()
        fs.mu.Lock()
        defer fs.mu.Unlock()
        ip, _, err := fs.namei(path, false)
 }
 
 func Chown(path string, uid, gid int) error {
+       fsinit()
        fs.mu.Lock()
        defer fs.mu.Unlock()
        ip, _, err := fs.namei(path, false)
        if len(ts) != 2 {
                return EINVAL
        }
+       fsinit()
        fs.mu.Lock()
        defer fs.mu.Unlock()
        ip, _, err := fs.namei(path, false)
 }
 
 func Link(path, link string) error {
+       fsinit()
        ip, _, err := fs.namei(path, false)
        if err != nil {
                return err
 }
 
 func Rename(from, to string) error {
+       fsinit()
        fdp, felem, err := fs.namei(from, true)
        if err != nil {
                return err
 }
 
 func Truncate(path string, length int64) error {
+       fsinit()
        fs.mu.Lock()
        defer fs.mu.Unlock()
        ip, _, err := fs.namei(path, false)
 }
 
 func Chdir(path string) error {
+       fsinit()
+       return chdir(path)
+}
+
+func chdir(path string) error {
        fs.mu.Lock()
        defer fs.mu.Unlock()
        ip, _, err := fs.namei(path, false)
 // Special devices.
 
 func mkdev(path string, mode uint32, open func() (devFile, error)) error {
-       fs.mu.Lock()
-       fs.mu.Unlock()
        f, err := fs.open(path, O_CREATE|O_RDONLY|O_EXCL, S_IFCHR|mode)
        if err != nil {
                return err