Coder Social home page Coder Social logo

Comments (7)

uho avatar uho commented on June 2, 2024 1

Fix changes behavior to

`$ go get -u github.com/gokrazy/tools/cmd/gokr-packer`
`# github.com/gokrazy/tools/cmd/gokr-packer`
`go/src/github.com/gokrazy/tools/cmd/gokr-packer/parttable.go:81: undefined: unix.BLKGETSIZE64`
`go/src/github.com/gokrazy/tools/cmd/gokr-packer/parttable.go:93: undefined: unix.BLKRRPART`

still not able to install without errors. Reopening this issue.

from gokrazy.

stapelberg avatar stapelberg commented on June 2, 2024

Thanks for the report. The code in question should only be compiled for the target (linux arm64), but is currently compiled for the host due to the way we pull in code. I’ll push a commit in a second which should fix this. Please reopen if you still encounter issues afterwards.

from gokrazy.

stapelberg avatar stapelberg commented on June 2, 2024

Thanks. I’ll need to make that code conditional, then.

Given that I don’t have a macOS machine handy, any fix would be blind. I might be able to actually test gokrazy (and not just have it compile) on macOS next week. If you want to race me to it, contributions are very welcome :).

from gokrazy.

uho avatar uho commented on June 2, 2024

It looks like the constants

unix.BLKGETSIZE64
unix.BLKRRPART

are not available with darwin/amd64 as Darwin lacks these requests for IOCTL.

A substitute for Darwin has to be identified in order to
determine the device size and re-read partition table.

Maybe The discusscion How do I get the partition offset in OS X with C/C++? on Stackoverflow gives some hints.

from gokrazy.

stapelberg avatar stapelberg commented on June 2, 2024

The commits I just pushed should allow you to install gokr-packer on macOS.

Prep work

Before you’ll be able to create an image, you’ll need to dump the system root certificates:

mkdir -p ~/.config/gokrazy
security find-certificate -a \
  -p /System/Library/Keychains/SystemCACertificates.keychain \
  > ~/.config/gokrazy/cacert.pem

Test cross-compilation

Check whether GOOS=linux GOARCH=arm64 go get -u github.com/gokrazy/hello fails. If it fails due to a permission error (common if you have used the Go installer), you have 3 options:

  1. Run gokrazy as root, thereby gaining write permission to /usr/local/go
  2. Copy /usr/local/go to a temporary directory and set the GOROOT environment variable to that directory
  3. Re-install Go from source into a directory where you have write permission.

Creating an image

I’d recommend to follow https://github.com/gokrazy/tools#alternative-creating-an-sd-card-image and use whichever tool you feel comfortable with to write the image to an SD card.

Creating an image (the harder(?) way)

In case you want to use gokr-packer to directly write to the SD card, a couple more steps are necessary. Notably, you’ll need to repeat all of these steps whenever you want to directly write to your SD card.

Locate your SD card in diskutil list. On my machine, it shows up as /dev/disk2.

In case the SD card contained any partitions with a file system, use umount to unmount the file systems (otherwise you’ll get a “device busy” error on the next command).

Overwrite the SD card with zeros to remove all partitions and file systems, preventing macOS from mounting the file systems after we overwrite the partition table:

dd if=/dev/zero of=/dev/rdisk2 bs=1m count=1024

Afterwards, the following worked for me:

gokr-packer -overwrite=/dev/disk2 github.com/gokrazy/hello

macOS prompts you halfway through the process about not being able to read any file systems (which aren’t written at that point). Dismiss the dialog by clicking its “ignore” button.

from gokrazy.

stapelberg avatar stapelberg commented on June 2, 2024

I’m closing this issue. We can discuss/track individual remaining issues/improvements to the experience in separate issues, if desired.

from gokrazy.

uho avatar uho commented on June 2, 2024

from gokrazy.

Related Issues (20)

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.