UF2 flashing support for Linux (Raspberry Pi Zero)
Перейти к файлу
Michał Moskal 155c4c4833
Merge pull request #11 from microsoft/users/GitHubPolicyService/38442985-53ea-41ea-b833-f63cb3163fd6
Adding Microsoft SECURITY.MD
2023-06-12 11:44:29 -07:00
cfg updated pinout to support 4 players (#4) 2019-07-16 11:16:49 -07:00
docker Kernel config extracted from piCore 11 kernel 2019-12-11 13:57:53 -08:00
image Build for RPI3 on piCore 11 alpha 2019-12-11 13:57:23 -08:00
kernel Initial import 2018-06-18 16:08:27 -07:00
uf2daemon Add "partition table" 2018-06-20 14:51:54 -07:00
.clang-format Add formatting file 2018-06-18 16:09:56 -07:00
.gitignore More random configs 2018-12-19 10:35:29 -08:00
LICENSE Initial commit 2018-06-18 16:05:36 -07:00
README.md Add info about SCAN_CODES in arcade.cfg 2019-11-13 12:52:36 -08:00
SECURITY.md Microsoft mandatory file 2023-06-12 18:25:01 +00:00

README.md

UF2 Flashing for Linux

This repo contains scripts and patches to build a sample Linux image based on piCore for the Raspberry Pi Zero. The image is meant to boot very quickly (currently at around 7s), and expose a USB mass storage device (pen drive), which can be used to program a Raspberry Pi Zero with UF2 files, usually generated from Microsoft MakeCode and in particular from MakeCode Arcade.

The image was tested on a Raspberry Pi Zero Rev 1.3 and Zero W Rev 1.3. It could theoretically work on the original Pi A/A+, but wasn't tested. Other models lack the OTG ID pin, and thus cannot be used in USB device mode.

PRs are welcome!

Building

Building the image requires Docker.

Go to image/ and run ./build.sh. The image will land in built/boot/*.

Configuring keys

After you're done building, copy one of the arcade.cfg files in cfg/ folder to built/boot/* so that it ends up on the SD card. You can also create your own arcade.cfg file if you have the buttons connected differently. The pin numbers in there are BCM pin numbers, not physical pin numbers, see https://pinout.xyz/

It's also possible to use regular Linux key codes if your buttons appear as a standard keyboard. This is enabled by setting SCAN_CODES=/dev/input/event1 or similar. Use evtest program to figure out the scan codes and use these scan codes instead of BCM pin numbers.

"Burning" image

All files in built/boot/ need to be copied to a FAT32-formatted SD card. There is no ext4 partition to worry about, and you don't need to use any special software to "burn" the image. The files need to sit in the root folder of the SD card, i.e., you should have file d:/9.0.3.gz, d:/cmdline.txt, as well as d:/arcade.cfg (if your SD drive is d:/; on macOS it will be /Volumes/NO NAME/9.0.3.gz etc).

Regular SD cards come preformatted as FAT32. If you have a previous Raspberry Pi image on the card you can format it, or just move all files in the first partition into a sub-folder if it's reasonably big.

Any SD card should do. You don't need much space (currently around 13MB), and the Pi will only read a few MBs upon startup, so the speed isn't very important.

Docker image

If you want to build the Docker image (pext/rpi) yourself, use the docker/build.sh script. Usually, you can just pull it from Docker Hub (which will just happen automatically). The image is based on sdthirlwall/raspberry-pi-cross-compiler and contains stock piCore 9.0.3 and sources of its kernel.

Menu program

Sources are here: https://github.com/microsoft/pxt-arcade-cabinet-menu

Button Configuration

gdbserver

By default gdbserver runs on the serial port exposed by the g_multi gadget. To connect to it on macOS run arm-linux-gnueabihf-gdb and then do the following:

(gdb) target extended-remote /dev/cu.usbmodem141123

where the numbers at the end will vary. Do not use /dev/tty.usbmodem..., as this will just hang.

License

The contents of this repo are released under the MIT license.

The images that you build will contain software under all sorts of licenses, including GPL.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.