github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/examples/uinit/README.md (about)

     1  # Example User uinit
     2  
     3  u-root's built-in init command will call uinit if it exits.
     4  
     5  The `uinit.go` in this dir runs a number of commands, including getting an IPv4
     6  address using DHCP, then runs the elvish shell. When the user exists the shell,
     7  `shutdown halt` is automatically run.
     8  
     9  To build the example:
    10  
    11  ```shell
    12      # make some changes to uinit.go in examples/uinit/uinit.go
    13      u-root -format=cpio -build=bb -o initramfs.cpio \
    14          ./cmds/* \
    15          github.com/u-root/u-root/examples/uinit
    16  ```
    17  
    18  And then to run it in qemu, with a network:
    19  
    20  ```shell
    21      qemu-system-x86_64 \
    22          -m 4096M \
    23          -nographic -serial mon:stdio -display none -curses \
    24          -append "console=ttyS0 " \
    25          -net nic,vlan=0,model=virtio \
    26          -net user,vlan=0,hostfwd=tcp::2222-:2222,hostname=u-boot \
    27          -kernel kernel/vmlinuz-$(KERNEL) \
    28          -initrd initramfs.cpio
    29  ```