Coder Social home page Coder Social logo

alexmitter / debian-for-toys Goto Github PK

View Code? Open in Web Editor NEW

This project forked from janvrany/debian-for-toys

0.0 0.0 0.0 11.47 MB

A (personal) set of scripts to build bootable Debian images for various architectures and development boards.

Shell 75.50% Makefile 24.50%

debian-for-toys's Introduction

Debian for toys

A (personal) set of scripts to build bootable Debian images for various architectures and development boards (or "toys", that's how we call them).

Supported toys

More toys will be added as I acquire them and get them up and running (or migrate older scripts to this repository).

!!! BIG FAT WARNING !!!

Scripts below do use sudo quite a lot. IF THERE"S A BUG, IT MAY WIPE OUT YOUR SYSTEM. DO NOT RUN THESE SCRIPTS WITHOUT READING THEM CAREFULLY FIRST.

They're provided for convenience. Use at your own risk.

Setting up host environment

Disclaimer: following recipe is (semi-regularly) tested on Debian Testing (Trixie at the time of writing). Debian 12 (Bookworm) is known to work too. If you have Debian 11 (Bullseye) or some other Debian-based distro, e.g, Ubuntu, this recipe may or may not work!

  1. Install required tools (QEMU, mmdebstrap and so on):

    sudo apt-get install mmdebstrap qemu-user-static qemu-system-misc binfmt-support debian-ports-archive-keyring rsync device-tree-compiler genimage genext2fs dosfstools guestfish guestfs-tools
    
  2. Install build tools for each architecture you want to build image for:

    crossbuild-essential-riscv64 crossbuild-essential-ppc64el
    

Building bootable images

For each architecture and "board" you may find following scripts:

  • <arch>/<board>/mk-fs.sh <image> to build a root filesystem. <image> can be either:

    • an empty directory
    • raw filesystem image containing ext4 file system
    • raw or .qcow2 disk image containing a partition table and one exatly one ext4-formatted partition. Note, that when using .qcow2 images, filesystem creation process is really slow.
  • <arch>/<board>/mk-os.sh to build a linux kernel suitable for the board

  • <arch>/<board>/mk-ub.sh to build U-Boot bootloader suitable for the board

  • <arch>/<board>/mk-im.sh to build a complete disk / SD-card image to use with the board. mk-im.sh calls above scripts as needed to build bootloader, kernel and filesystem and package all that into a single file.

Other Notes & Comments

  • Connecting to serial console over FTDI:

    sudo screen /dev/ttyUSB0 115200
    
  • Write SD card image to the SD card:

    pv images/sdcard.img | sudo dd of=/dev/mmcblk0 bs=32M oflag=sync
    
  • Create .tar.gz of root filesystem from disk image:

    guestfish -a sdcard.img \
        run \
      : mount /dev/sda4 / \
      : tar-out / rootfs.tgz compress:gzip numericowner:true xattrs:true acls:true
    

    Replace /dev/sda4 as needed.

  • Sometimes it happened to me that /var/lib/dpkg/available disappeared. This prevents dpkg / apt from removing packages. Following command fixed this for me:

    sudo dpkg --clear-avail && sudo apt-get update
    

License

This code is licensed under MIT license. See LICENSE.txt.

debian-for-toys's People

Contributors

janvrany avatar alexmitter 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.