Code Monkey home page Code Monkey logo

rpi-gadget-image-creator's Introduction

Raspbery Pi USB Gadget Image Builder

A script to add USB Ethernet Gadget configuration to a standard Raspbian Lite SD Card image. This should work with Raspberry Pi Zero, Zero W and 4.

Currently only tested on Linux and with Docker Desktop + WSL on Windows 10, but should also run on OSx

Requirements

  • Docker
  • expect

Install

Clone the repo

git clone https://github.com/hardillb/rpi-gadget-image-creator.git

Copy the raspbian lite image into the rpi-gadget-image-creator directory.

Running

./setup.sh 2019-09-26-raspbian-buster-lite.img

To build a 64bit OS image you need to add -64 before the image name. 64bit versions will run on Pi 3 and Pi 4 hardware.

./setup.sh -64 2020-08-20-raspios-buster-arm64.img

Once complete you can write the image file to a SD Card with any of the usual tools e.g. dd or balena-etch. You can find instructions on the Raspberry Pi website here

TODO

Look at repackaging everything into an extention to DockerPi so the whole thing runs in the container.

rpi-gadget-image-creator's People

Contributors

espoelstra avatar hardillb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rpi-gadget-image-creator's Issues

adapting this script to other ditros?

So, I innocently thought that changing the username and the password in the binary would allow me to make this script work on another distro, but it didn't.

How could I make this script work with Kali linux?

https://www.offensive-security.com/kali-linux-arm-images/#1493408272250-e17e9049-9ce8 (I'm using the last one Kali Linux RaspberryPi 2 (v1.2), 3 and 4 64-Bit)

Run /sbin/init as init process
request_module: kmod_concurrent_max (0) close to 0 (max_modprobes: 50), for module binfmt-464c, throttling...
request_module: modprobe binfmt-464c cannot be processed, kmod busy with 50 threads for more than 5 seconds now
Starting init: /sbin/init exists but couldn't execute it (error -8)
Run /etc/init as init process
Run /bin/init as init process
Run /bin/sh as init process
request_module: kmod_concurrent_max (0) close to 0 (max_modprobes: 50), for module binfmt-464c, throttling...
request_module: modprobe binfmt-464c cannot be processed, kmod busy with 50 threads for more than 5 seconds now
Starting init: /bin/sh exists but couldn't execute it (error -8)
Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
CPU: 0 PID: 1 Comm: swapper Not tainted 4.19.50+ #1
Hardware name: ARM-Versatile (Device Tree Support)
[<c001d230>] (unwind_backtrace) from [<c00190ac>] (show_stack+0x10/0x14)
[<c00190ac>] (show_stack) from [<c0025f14>] (panic+0xc8/0x240)
[<c0025f14>] (panic) from [<c054b434>] (kernel_init+0xb8/0xe8)
[<c054b434>] (kernel_init) from [<c00090e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0xcf823fb0 to 0xcf823ff8)
3fa0:                                     00000000 00000000 00000000 00000000
3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
3fe0: 00000000 00000000 00000000 00000000 00000013 00000000
Rebooting in 1 seconds..
send: spawn id exp4 not open
    while executing
"send "root\n""
    (file "./create-image" line 24)

# then it exit 1

Latest Raspbian Kernel broken (5.x)

With the latest kernels the Pi boots fine and all the libcomposite parts come up.

A ethernet device is created on the host (tested with Ubuntu 18.04) for just long enough to get a DHCP address then it stalls and is restarted.

Works with raspbian 2020-02-13 build but not with newer

Ubuntu Image?

Is it possible to tweak this to work with Ubuntu 20.04 or 20.10 Server instead?

`send: spawn id exp6 not open` on MacOS 10.15.5

I am attempting to run this script on a 2015 MacBook Pro 13" (Early 2015) on Catalina 10.15.5.
The script errors out with the following:

send: spawn id exp6 not open
    while executing
"send "pi\n""
    (file "./create-image" line 24)

I am using the image:
2020-05-27-raspios-buster-lite-armhf.img
Strangely, sometimes it fails with this error before systemd bootup occurs, but other times it fails midway through systemd bootup.

I am unsure if this would matter, but I installed expect and docker via Homebrew.

Support For Raspberry Pi Model A?

Does this script support the Raspberry Pi model A or A+?

I know the procedure is mostly the same for setting it up as for the Zero, except that you need to specifically set it to peripheral device mode, with the following line in config.txt: dtoverlay=dwc2,dr_mode=peripheral.

exit in line 11 of setup.sh? $OFFSET with two values?

You introduced an exit in line 11 of setup.sh. So, the script actually does nothing.

Another thing:
Trying to mount manually I see that for "2023-10-10-raspios-bookworm-armhf-lite.img" OFFSET looks like this:

$ OFFSET=$(fdisk -l 2023-10-10-raspios-bookworm-armhf-lite.img | awk '/^[^ ]*1/{ print $2*512 }')
$ echo $OFFSET
4194304 541065216

That $OFFSET with two values won't work with the mount command:

$ sudo mount -o loop,offset=$OFFSET 2023-10-10-raspios-bookworm-armhf-lite.img boot
mount: bad usage
Try 'mount --help' for more information.

RPi 4 lastest Raspbian Image doesn't come with default pi user.

Based off of Debin 11. The lastest raspbian OS doesn't come with a default user "pi" you have to follow the steps listed here.

In short in the /boot folder you have to add a userconf.txt file with the contents of "username:password" The pass word ought to be generated with openssl encryption.

I may modify test and submit a PR, but I don't have a lot of time at the moment. So I'll make a not of it here in the meantime.

Love this idea btw. Thanks!

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.