{"id":13588175,"url":"https://github.com/neo954/raspbian-toolbox","last_synced_at":"2025-04-08T02:35:04.001Z","repository":{"id":191314445,"uuid":"149374326","full_name":"neo954/raspbian-toolbox","owner":"neo954","description":"Raspbian Toolbox is a collection of tools for Raspbian image customization.","archived":false,"fork":false,"pushed_at":"2023-08-29T03:39:06.000Z","size":24,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-02T16:09:24.008Z","etag":null,"topics":["rasberry-pi","raspberry-pi-3","raspberry-pi-zero","raspbian","raspbian-image","raspbian-stretch","retropie"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/neo954.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-19T01:29:19.000Z","updated_at":"2023-08-29T03:39:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"5a46fdfa-0b8a-495c-94ac-32197c96a23f","html_url":"https://github.com/neo954/raspbian-toolbox","commit_stats":null,"previous_names":["neo954/raspbian-toolbox"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo954%2Fraspbian-toolbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo954%2Fraspbian-toolbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo954%2Fraspbian-toolbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/neo954%2Fraspbian-toolbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/neo954","download_url":"https://codeload.github.com/neo954/raspbian-toolbox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223300736,"owners_count":17122679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rasberry-pi","raspberry-pi-3","raspberry-pi-zero","raspbian","raspbian-image","raspbian-stretch","retropie"],"created_at":"2024-08-01T15:06:33.098Z","updated_at":"2024-11-06T07:31:02.252Z","avatar_url":"https://github.com/neo954.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# Raspbian Toolbox\n\nRaspbian Toolbox is a collection of tools for Raspbian image customization.\n\n## Set up a developing environment for Raspbian image customization\n\n### The selection of Linux distro\n\nDebian or Ubuntu is preferred for Raspbian image customization works. But other Linux distro can be used. I do not see any obstruction here.\n\n### Set up Qemu User Emulation\n\nQemu User Emulation [1] is used to run arm executable files. Install the `qemu-user-static` and `binfmt-support` packages.\n\n```\n# apt-get install qemu qemu-user-static binfmt-support\n```\n\n[1] https://wiki.debian.org/RaspberryPi/qemu-user-static\n\n### Get the lastest Raspbian image\n\nGet the lastest Respbian from the official web site of Raspberry Pi [2]. The lite image is prefered for Raspbian image customization works.\n\n[2] https://www.raspberrypi.org/downloads/raspbian/\n\n## Tools\n\n### `raspbian-lvm-reform`\n\nReform Raspbian image to LVM partition layout.\n\n```\n# raspbian-lvm-reform /path/to/raspbian.img\n```\n\nThis will generate a new image file `/path/to/raspbian-lvm.img`, which will be in the same directory, along with original image file. The default LVM partition layout look like the following.\n\n```\nFilesystem             Size  Used Avail Use% Mounted on\n/dev/mapper/sd0-root   488M  207M  246M  46% /\n/dev/sda1              197M   46M  152M  24% /boot\n/dev/mapper/sd0-home   488M  796K  452M   1% /home\n/dev/mapper/sd0-opt    488M   41M  412M  10% /opt\n/dev/mapper/sd0-srv    120M  1.6M  110M   2% /srv\n/dev/mapper/sd0-tmp    488M  780K  452M   1% /tmp\n/dev/mapper/sd0-var    976M  162M  748M  18% /var\n/dev/mapper/sd0-usr    2.0G  559M  1.3G  31% /usr\n/dev/mapper/sd0-local  120M  1.6M  110M   2% /usr/local\n```\n\nThe default partition layout can be customized by edit the part of configurations in the script. Just change the number of the size, add lines for additional file systems.\n\n```bash\n################################\n####     Configurations     ####\n################################\nTARGET_IMAGE_SIZE_LIMIT=\"6GB\"\nTARGET_BOOT_PART_OFFSET=\"4MiB\"\nTARGET_BOOT_PART_SIZE=\"200MiB\"\nTARGET_LVM_VG_NAME=\"sd0\"\nTARGET_LVM_LV_000=(\"root\"  \"/\"          \"512MiB\" \"ext4\")\nTARGET_LVM_LV_001=(\"home\"  \"/home\"      \"512MiB\" \"ext4\")\nTARGET_LVM_LV_002=(\"opt\"   \"/opt\"       \"512MiB\" \"ext4\")\nTARGET_LVM_LV_003=(\"srv\"   \"/srv\"       \"128MiB\" \"ext4\")\nTARGET_LVM_LV_004=(\"tmp\"   \"/tmp\"       \"512MiB\" \"ext4\")\nTARGET_LVM_LV_005=(\"var\"   \"/var\"      \"1024MiB\" \"ext4\")\nTARGET_LVM_LV_006=(\"usr\"   \"/usr\"      \"2048MiB\" \"ext4\")\nTARGET_LVM_LV_007=(\"local\" \"/usr/local\" \"128MiB\" \"ext4\")\n################################\n```\n\n### `raspbian-chroot`\n\nRun command or interactive shell inside the Raspbian image.\n\n#### Get an interactive shell\n\nYou can do whatever change you want inside the Raspbian image.\n\nExample\n\n```\n# raspbian-chroot /path/to/raspbian.img\nroot@raspbian:~# id\nuid=0(root) gid=0(root) groups=0(root)\nroot@raspbian:~# pwd\n/root\nroot@raspbian:~# mount\n/dev/loop1 on / type ext4 (rw,noatime,data=ordered)\n/dev/loop0 on /boot type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)\nudev on /dev type devtmpfs (rw,nosuid,relatime,size=2000092k,nr_inodes=500023,mode=755)\ndevpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)\nsysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)\nproc on /proc type proc (rw,nosuid,nodev,noexec,relatime)\nroot@raspbian:~# df\nFilesystem     1K-blocks   Used Available Use% Mounted on\n/dev/loop1       1708880 970988    633036  61% /\n/dev/loop0         43539  22191     21348  51% /boot\nudev             2000092      0   2000092   0% /dev\nroot@raspbian:~# ls -l /\ntotal 79\ndrwxr-xr-x   2 root root  4096 Jun 27 00:21 bin\ndrwx------   3 root root  2560 Jan  1  1970 boot\ndrwxr-xr-x   2 root root  4096 Jun 27 00:13 debootstrap\ndrwxr-xr-x  17 root root  3340 Sep 21 10:43 dev\ndrwxr-xr-x  84 root root  4096 Jun 27 01:09 etc\ndrwxr-xr-x   3 root root  4096 Jun 27 00:17 home\ndrwxr-xr-x  16 root root  4096 Jun 27 00:30 lib\ndrwx------   2 root root 16384 Jun 27 01:08 lost+found\ndrwxr-xr-x   2 root root  4096 Jun 27 00:03 media\ndrwxr-xr-x   2 root root  4096 Jun 27 00:03 mnt\ndrwxr-xr-x   3 root root  4096 Jun 27 00:17 opt\ndr-xr-xr-x 140 root root     0 Sep 21 04:58 proc\ndrwx------   2 root root  4096 Sep  6 09:05 root\ndrwxr-xr-x   5 root root  4096 Jun 27 00:18 run\ndrwxr-xr-x   2 root root  4096 Jun 27 00:30 sbin\ndrwxr-xr-x   2 root root  4096 Jun 27 00:03 srv\ndr-xr-xr-x  13 root root     0 Sep 21 04:58 sys\ndrwxrwxrwt   2 root root  4096 Jun 27 01:09 tmp\ndrwxr-xr-x  10 root root  4096 Jun 27 00:03 usr\ndrwxr-xr-x  11 root root  4096 Jun 27 00:03 var\nroot@raspbian:~# exit\n```\n\n#### Run command directly inside the Raspbian image\n\nExample\n\n```\n# raspbian-chroot /path/to/raspbian.img file /bin/bash\n/bin/bash: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=b1e8e19f3b7b388468f2914bfb2ae8ac6b9f0478, stripped\n```\n\n#### Copy files into the Raspbian image\n\nUse of `tar` is preferred for file copy.\n\nExample\n\n```\n# ( cd /path/to/src \u0026\u0026 tar cf - ) | raspbian-chroot /path/to/raspbian.img 'cd /path/to/dst \u0026\u0026 tar xf -'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo954%2Fraspbian-toolbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneo954%2Fraspbian-toolbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneo954%2Fraspbian-toolbox/lists"}