Skip to content

Commit

Permalink
Revert "Update documentation for new build script"
Browse files Browse the repository at this point in the history
This reverts commit 306b3d7.
  • Loading branch information
rminnich authored and xchenan committed Apr 28, 2017
1 parent a7c5294 commit 96a9889
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 20 deletions.
37 changes: 17 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,41 @@ u-root

# Description

u-root is a "universal root". It's a root file system with mostly Go source with the exception of 5 binaries.
u-root is a "universal root". It's a root file system with mostly Go source with the exception of 5 binaries.

That's the interesting part. This set of utilities is all Go, and mostly source.

When you run a command that is not built, you fall through to the command that does a
`go build` of the command, and then execs the command once it is built. From that point on,
when you run the command, you get the one in tmpfs. This is fast.

# Setup

# Usage
You'll need a GOPATH. Be sure to set it to something, e.g.

Make sure your Go version is the latest (>=1.8). Correctly set up your GOPATH like so:
`export GOPATH=/usr/local/src/go`

$ export GOPATH="$HOME/go"
$ export PATH="$PATH:$GOPATH/bin"
On my machine, my gopath is
`export GOPATH=/home/$USER/go`

Now, download and install u-root:
Then
`go get github.com/u-root/u-root`

$ go get github.com/u-root/u-root
`cd $GOPATH/src/github.com/u-root/u-root`

You can now use the u-root command anywhere for building. Here are some examples:
You may hit a problem where it can't find some standard Go packages, if so, you'll need
to set GOROOT, e.g.
`export GOROOT=/path/to/some_go_>=1.6`

$ u-root --run # build and run in a chroot (requires sudo)
$ u-root --format=cpio -o initramfs.cpio # generate a cpio archive named initramfs.cpio
$ u-root --format=cpio --run # create a cpio in /tmp and run with qemu
$ u-root --format=cpio --build_format=bb # create a cpio containing a busybox
$ u-root --format=docker --run # build and run a docker image

It is also possible to specify packages for inclusion:

$ go get github.com/golang/example/hello
$ u-root --run github.com/golang/example/hello
# Using

To try the chroot, just run the README:
`bash RUN`

## Build an Embeddable U-root

You can build this environment into a kernel as an initramfs, and further
embed that into firmware as a coreboot payload.
embed that into firmware as a coreboot payload.

In the kernel and coreboot case, you need to configure ethernet. We have a primitive
ip command for that case. In qemu:
Expand All @@ -65,7 +62,7 @@ running, you can do this:
The tcz command computes and fetches all dependencies.

If you can't get to tinycorelinux.net, or you want package fetching to be faster,
you can run your own server for tinycore packages.
you can run your own server for tinycore packages.

You can do this to get a local server using the u-root srvfiles command:
`% src/srvfiles/srvfiles -p 80 -d path-to-local-tinycore-packages`
Expand Down
18 changes: 18 additions & 0 deletions RUN
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e
# This README is also a script you can run to test this idea out.
# This is a root file system all based on Go.

if [ -z $GOPATH ]
then
echo "Please set GOPATH and run this command again."
exit 1
fi

if [ -z $GOROOT ]
then
echo "You have not set GOROOT. This can work but if not, please"
echo "set GOROOT to point to a Go tree with version >= 1.6"
fi

go run scripts/ramfs.go -test

0 comments on commit 96a9889

Please sign in to comment.