Giter Club home page Giter Club logo

tools's Introduction

gokr-packer

Default use case: directly writing to an SD card

See gokrazy

Alternative: Creating file system images

Creating individual file system images allows to conveniently archive the images and easily roll back to a previous state.

Specify any combination of -overwrite_root and -overwrite_boot flags, e.g.:

gokr-packer \
  -overwrite_boot=/tmp/boot.fat \
  -overwrite_root=/tmp/root.fat \
  github.com/gokrazy/hello

To overwrite the SD card /dev/sdb’s partitions with these images, use:

sudo dd if=/tmp/boot.fat of=/dev/sdb1 bs=1M
sudo dd if=/tmp/root.fat of=/dev/sdb2 bs=1M

If you’re curious, you can also loop-mount the file system images on your machine to inspect them:

sudo mkdir /mnt/loop
sudo mount -o loop -t vfat /tmp/boot.fat /mnt/loop
ls -lR /mnt/loop
sudo umount /mnt/loop

Alternative: Creating an SD card image

If you prefer, you can also create a full SD card image. It will be slower to transfer to an SD card, but the 1:1 mapping of a file to an SD card state might be appealing.

gokr-packer \
  -overwrite=/tmp/full.img \
  -target_storage_bytes=2147483648 \
  github.com/gokrazy/hello

To overwrite the SD card /dev/sdb with the image, use:

sudo dd if=/tmp/full.img of=/dev/sdb bs=1M

If you’re curious, you can also loop-mount the file systems of the image on your machine to inspect them:

sudo kpartx -avs /tmp/full.img
sudo mkdir /mnt/{boot,root}
sudo mount -t vfat /dev/mapper/loop0p1 /mnt/boot
sudo mount -t vfat /dev/mapper/loop0p2 /mnt/root
ls -lR /mnt/{boot,root}
sudo umount /mnt/{boot,root}
sudo kpartx -d /tmp/full.img

tools's People

Contributors

stapelberg avatar twpayne avatar willglynn avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.