drtyhlpr / rpi23-gen-image Goto Github PK
View Code? Open in Web Editor NEWAdvanced Debian "stretch" and "buster" bootstrap script for RPi 0/1/2/3 and QEMU
License: GNU General Public License v2.0
Advanced Debian "stretch" and "buster" bootstrap script for RPi 0/1/2/3 and QEMU
License: GNU General Public License v2.0
Hi,
On build RELEASE=stretch ENABLE_MINBASE=true ENABLE_REDUCE=true ENABLE_MINGPU=true BUILD_KERNEL=true ENABLE_UBOOT=true I have:
`+ chroot_exec apt-get -q -y --force-yes --no-install-recommends install linux-compiler-gcc-4.8-arm g++ make bc
during testing I currently run into massive problems using the serial console. Hard to track the error down but I am almost sure it has todo with systemd.
Not sure what else I can add other than the output:
``alex@debian:~/rpi23-gen-image$ echo y | sudo RPI_MODEL=3 ./rpi23-gen-image.sh
-e
do you want to install the missing packages right now? [y/n] E: Unable to locate package crossbuild-essential-armhf``
Hi
I cannot set up /dev/i2c* devices in the raspberry with the image built with rpi2-gen-image... I have tried allt ricks I have found on the web with no effect and finally I asked the question on Rasberry forum and the engineer sends me back here with the following message : Raspberry Pi forum
The dtparam directive in config.txt constructs a device tree in memory, then passes its address to the kernel. If your kernel is u-boot then it is likely that the message isn't getting through. You'll have to ask the maintainers of your distribution what to do. If your u-boot is expecting the device-tree at 0x100 then you might be able to use:
`device_tree_address=0x100`
in config.txt. The correct technique is for u-boot to either specify the required DTB load address using a custom stub file or to read the actual load address from address 0xf8 (see raspberrypi/tools )
Device Tree is required when using our 4.4 kernels, so attempts to disable it will be ignored.
This comment is beyond my competencies, but I suppose that some other users may like to be able to use i2c bus on their raspberry , I hope this comment may help to solve the problem...
Thanks again for your work
If you run rpi2-gen-image.sh
with APT_SERVER=ftp.au.debian.org
(or whatever server), debootstrap
will fail with unknown location ftp.debian.org/debian/dists/jessie/Release
because it's expecting a 'http://' in front of the location.
However, later on the sources.list
is generated from the same variable
# Set up initial sources.list
cat <<EOM >$R/etc/apt/sources.list
deb http://${APT_SERVER}/debian ${RELEASE} main contrib
#deb-src http://${APT_SERVER}/debian ${RELEASE} main contrib
So if you make APT_SERVER correct by adding a http in front of it, you'll end up with an invalid sources.list later
Is there a way to make the project compatible with Raspbian and Raspberry ?
Will Raspbian and Raspberry repository be or already are in the roadmap ?
the fbturbo driver is not available as Debian package. I am currently doing tests to let the script compile xf86-video-fbturbo in the chroot (like the ENABLE_UBOOT section). expect to have that parameter running next week.
I hate to ask this, but I use a wifi dongle with my Pi 2 and it needs non-free firmware, please enable it or give a choice (default=no) to enable non-free
thanks
Shouldn't the proxy setting be applied if APT_PROXY is not NULL? -z evaluates to true if the variable is NULL, in this case a string of length 0. In this case I think you should check for not NULL or -n
https://github.com/drtyhlpr/rpi2-gen-image/blob/master/rpi2-gen-image.sh#L205
If I set no proxy I get this Error:
E: Syntax error /etc/apt/apt.conf.d/10proxy:2: Extra junk at end of file
expect fast fix
Hi,
Many thanks for this great work, I was wondering if it could be possible to build a debian "stretch" image or more conveniently a "testing" image. I have seen the progress with rpi3 I will get one shortly I can help with tests if you need.
I have also found a bug, the image building process crashes if I choose a different locale than "en_EN.utf8" I have found a hint using :
DEFLOCAL="fr_FR.utf8" ENABLE_MINBASE=true
I am unfornately not able to propose a clean patch (I'll try again if I can find some time but I am not a dev...)
I do not have a RPi3 yet and I do not know about the status of arm64 rpi3 support. so please tell me your ideas:) ty
When calculcating the image file size, something goes wrong.
For example: The build directory is 421612 bytes in size, but I get an image that is 1GB in size.
If I now plug that into the calculation for image size I get the following values
CHROOT_SIZE=$(expr 421612 / 1024 ) # = 411
IMAGE_SIZE=`expr $(expr 411 / 1024 + 1) * 1024` # = 1024
IMAGE_SECTORS=`expr $(expr 1024 * 1048576) / 512 - 133120` # = 1964032
OK, now this translates to a size limit for the root partition of IMAGE_SIZE - 64 = 960 MB
The steps in which the image "grows" is 1GB, so it is at least of size 1GB.
So this works for image builds where the chroot is below the size of 960MB in total (minus the rootfs).
Now if for example the size of the chroot is 999MB, the resulting image will still be max 1GB in size.
The first 64MB are used for the /boot partition, leaving 960MB for the rootfs, which in reality is 999MB - (size of the boot partition) which in my case is 22MB. This concludes that I am left with 977MB to write to a partition with 960MB, which results in a "no space left" IO error when copying the files.
My suggestions would be the following:
I will happily contribute this, if you tell me what you think about it.
I have problems enabling a initramfs. no matter if I use default raspberry bootloader or uboot. one way or another it always ends with mmc0/sdhci/ext4 write(?) errors - so the system is even bootable sometimes. maybe someone has an idea on how to fix this.
BUILD_KERNEL=true KERNELSRC_DIR=/tmp/linux ENABLE_MINBASE=true ./rpi2-gen-image.sh
...
apt-get -y install initramfs-utils
mkinitramfs -o /boot/firmware/initrd
(also tested with update-initramfs, custom cpio ramfs, hardcoded kernel i2c/spi/rnd)
(kernel initramfs support is enabled in default kernel config used)
(tested mount options inside custom busbox-cpio-initramfs - nope even with same mount options as in fstab... errors)
A - Add initramfs to default rpi bootloader (/boot/firmware/config.txt)
initramfs initrd followkernel
ramfsfile=initrd
ramfsaddr=-1
B - Add initramfs to uboot
(convert initrd to initrd.uboot - using mkimage -A arm -O linux -T ramdisk ...)
# Add initramfs to default uboot bootloader
# Set device tree file
setenv fdtfile bcm2709-rpi-2-b.dtb
# Tell Linux that it is booting on a Raspberry Pi2
setenv machid 0x00000c42
# Save these changes to u-boot's environment
saveenv
# Load the existing Linux kernel into RAM
fatload mmc 0:1 ${kernel_addr_r} kernel7.img
fatload mmc 0:1 ${fdt_addr_r} ${fdtfile}
fatload mmc 0:1 ${ramdisk_addr_r} initrd.uboot
# Boot the kernel we have just loaded
bootz ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
(re-generate boot.scr mkimage -A arm -O linux -T script ...)
expect write (no read?) errors...mmc 0x900 and such..lead to ext4 etc.
ps. my sdcard(s) are fine and still work
pps. this initramfs support would be important for the next planned feature ENABLE_CRYPTOFS=luks parameters... also known as ENABLE_FBI=false :)
I did first tests to support the Debian "stretch" release. You can try to create a bootable (but unstable) system using RELEASE=stretch parameter. Currently the init, systemd and systemd-sysv packages cause trouble with the "stretch" release.
I used RELEASE=stretch ENABLE_MINBASE=true APT_INCLUDES="systemd"
and added a simple apt-get install systemd-sysv at the end of the script.
So far no success on building (default) ENABLE_MINBASE=false "stretch" releases. Feel free to support.
There is a typo in gen script @ line 110
ENABLE_REDUCE=${ENABLE_REDUCE:= flase }
Hello,
the sed expression line 223 must use double quotes for the shell variable substitution to work.
Right now, the /etc/locale.gen is NOT modified by sed.
working on a fix. should affect RPi3 only. (using dtoverlay in config.txt causes problems)
the uboot binaries are generated and configuration / device tree looks fine, rpi3 does not boot and keeps stuck in colorfull screen...
ENABLE_WM should be used so the user can decide what X window manager to install. Requires a lot of testing: blackBox, openbox, fluxbox, jwm, dwm, awsome and other tiny window managers should be supported.
REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static dosfstools rsync bmap-tools whois git-core"
apt-get -q -y install ${REQUIRED_PACKAGES}
${REQUIRED_PACKAGES} are currently forcefully installed (-y) - sorry about that - fixing soon - thought about getchar y/n fix...
build-22431209.txt
Hi,
I've built the image yesterday evening whit the attached parameters, when I plug the power chord the rasp doesn't boot.
According whit this table[1], rasp is saying "kernel.img not found", but looking in the /boot mntpoint i see these files:
-rw-r--r-- 1 root root 17840 dic 28 2014 bootcode.bin
-rw-r--r-- 1 root root 192 set 12 23:01 cmdline.txt
-rw-r--r-- 1 root root 1311 set 12 23:01 config.txt
-rw-r--r-- 1 root root 2352 dic 28 2014 fixup_cd.dat
-rw-r--r-- 1 root root 6140 dic 28 2014 fixup.dat
-rw-r--r-- 1 root root 9188 dic 28 2014 fixup_x.dat
-rw-r--r-- 1 root root 3304216 set 12 23:01 kernel7.img
-rw-r--r-- 1 root root 550584 dic 28 2014 start_cd.elf
-rw-r--r-- 1 root root 2636696 dic 28 2014 start.elf
-rw-r--r-- 1 root root 3593672 dic 28 2014 start_x.elf
Following some information I hope can help you:
The host where I've built the image is a debian stretch:
debootstrap:all/testing 1.0.81 uptodate
debian-archive-keyring:all/testing 2014.3 uptodate
qemu-user-static:amd64/testing 1:2.6+dfsg-3 uptodate
binfmt-support:amd64/testing 2.1.6-1 uptodate
dosfstools:amd64/testing 4.0-2 uptodate
rsync:amd64/testing 3.1.1-3 uptodate
bmap-tools:all/testing 3.2-4 uptodate
whois:amd64/testing 5.2.12 uptodate
git:amd64/testing 1:2.9.3-1 uptodate
The card is a Raspberry Pi 2 B+ V 1.2 (2014)
My parameters:
script -c 'RPI_MODEL=2 ENABLE_CONSOLE=true ENABLE_DHCP=true APT_INCLUDES="firmware-linux-free,network-manager" TIMEZONE="Europe/Rome" XKB_LAYOUT="it" USER_NAME=pi ./rpi23-gen-image.sh'
./build-$(date +%H%M%d%m)
This seems not help, 7 green blink:
APT_INCLUDES="firmware-linux-free,firmware-linux-nonfree,firmware-brcm80211,firmware-realtek,network-manager"
ENABLE_NONFREE=true
This one not work, when I enable UBOOT rasp blink one green and then nothing:
ENABLE_UBOOT=true
To try out the SD and rasp integrity, after the rpi23-gen-image test I've flashed 2016-05-27-raspbian-jessie-lite.img in the same SD and it work.
[1] http://elinux.org/R-Pi_Troubleshooting#Green_LED_blinks_in_a_specific_pattern
Hello
this is a request for improvement, could you add a setting to inject a ssh key for the root user?
I do it manually before "burning" the image to the sd.
thanks!
1/2 The ENABLE_SOUND was not fully tested and alsa packages are missing - needs some testing - please give me some time.
2/2 The ENABLE_SOUND=false does not work - the snd modules are still loaded no matter if they are listed in the modules blacklist file. working on a fix.
so you don't need a dhcp server / script to get network running. (well or wait for the dhcp timeout and scan 169.254.0.0/16). adding feature soon - not sure about command-line parameter syntax
GNU Screen works in a weird way in the image generated using your script - detached screen terminals get terminated when you log out.
To test this, you need to connect to your Raspberry Pi 2 via SSH, and then do the following:
$ ssh $IP_ADDRESS
$ screen
# type in ctrl +d to detach your screen session
$ screen -r
# re-attachment works correctly
# type in ctrl +d to detach your screen session
$ exit # we are logging out from
#let's log back in via SSH
ssh $IP_ADDRESS
$ screen -r
There is no screen to be resumed.
I have no idea how to fix this, apologies if I haven't explained myself properly. I have never encountered this problem before, I have no idea what to type in to Google in order to search for solutions.
This is how I generated my image:
APT_SERVER="http.debian.net" HOSTNAME="vanguard" PASSWORD="afvzsdcx" DEFLOCAL="en_GB.UTF-8" TIMEZONE="Europe/London" ENABLE_CONSOLE=true ENABLE_IPV6=true ENABLE_SSHD=true ENABLE_SOUND=false ENABLE_MINGPU=true ENABLE_DBUS=false ENABLE_XORG=false ENABLE_UBOOT=true ./rpi2-gen-image.sh
I had to install dbus after generating the image by running:
sudo apt-get install dbus
The file LICENSE includes GPL-3 while the header of rpi2-gen-image.sh mentions GPL-2 or later, like the original rpi2-build-image.sh from Ryan Finnie did.
Was it your intention to make use of the "or later" clause and switch to GPL-3 (or later)? Then I would change the header of rpi2-gen-image.sh accordingly. Otherwise you might replace LICENSE with the GPL-2 which you can get here.
Hi all,
In the image built with rpi23-gen-image I2C bus is not activated. To do so things have slightly changed from rpi2 situation. Two things must be done :
/lib/modules-load.d/rpi2.conf
file# bcm2708_rng
snd_bcm2835
i2c-bcm2708
i2c-dev
# rtc-ds1307
/boot/firmware/config.txt
filedtoverlay=i2c0-bcm2708
dtoverlay=i2c1-bcm2708
Then reboot and you'll get the wanted /dev/i2c-0
and /dev/i2c-1
devices; of course if you need just one bus activate only one line.
sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- 77
Best regards
Hi all,
This script works like a charm! The image produced can run identically on Raspi2 AND Raspi3.
For display manager and window manager I have tested lightdm and lxde (it works perfectly, tested in its minimalist form without background and lxde "goodies").
Thanks for enabling the non-free which permits to use much easily the wifi but some improvements will reduce the necessary initial manipulations (see below).
I used the following parameters to build my image among other more specific (name,login country, etc...):
APT_INCLUDES="firmware-linux-free,firmware-linux-nonfree,firmware-brcm80211,firmware-realtek,network-manager,network-manager-gnome,lxde"
ENABLE_NONFREE=true
ENABLE_WM="lightdm"
Things that may help a lot :
/etc/NetworkManager/system-connections
or its contentsI think you'll need to lift /lib/firmware/brcm/* from a Raspbian card.
I've put a 7zipped version on Github at: DougieLawson
I do not know what will be the proper way to handle this but it is frustrating to se that the correct driver is there but it does not work and finally the only solution is to copy Raspbian's one ! (I spent too much time finding that even if the driver name was correct the content was not! :-( )
Thanks for this very usefull work, hope you may find some time to consider my proposals.
Best regards.
I apologize a lot for this question.
Nowhere I found the fact nor a hint to follow to fact that your version is based on armhf ...
Could you update readme.md for that ?
I'm running the script regulary to compile new kernel images. It's not too much of a hassle to install the new images and modules by hand, however it is kind of slow and tedious. Generating Debian packages would make this step faster and more reliable. I reckon it to be a rather simple task to implement this functionality. If I successfully implement this, I will send an PR request. Unless of course somebody else does it first or points out that it is already done somewhere.
Hey,
thank you for your hard work, this is very close to what I am looking for.
Maybe I have missed it in the README, but is there a way to add custom packages during image build?
This are the use cases I am looking for:
Those two things should preferably happen through a config file and not by editing the script directly.
If this is not possible yet, but something you would like to see, let me know and I would happily contribute that functionality.
The current stretch release does currently not boot on RPi3 (hangs after WLAN detection, no matter if firmware available or not). If you have ideas how to fix it - feel free to help
The build
and source
links in /lib/modules/$(uname -r)
have a destination that is on the build machine:
$ pwd
/lib/modules/4.4.6-rt14-v7+
$ ls -l build source
lrwxrwxrwx 1 root root 82 Sep 7 16:07 build -> /home/simark/polarsys-os/rpi23-gen-image/images/stretch/build/chroot/usr/src/linux
lrwxrwxrwx 1 root root 82 Sep 7 16:07 source -> /home/simark/polarsys-os/rpi23-gen-image/images/stretch/build/chroot/usr/src/linux
As a result, it's not possible to build external kernel modules. The workaround is simply to make the links point at the right place.
In my setup, I use a kernel that I build myself beforehand (KERNELSRC_PREBUILT=true
). I guess these links are installed by the make modules_install
step? Perhaps it needs to be done from inside the chroot, or the links need to be fixed up afterwards?
The script /bin/setupcon compare date (with test <cached_file> -ot <config_file>) to regenerate the cached files. My raspberry doesn't have a real clock. So the <config_file> is generated in 2014 and <cached_file> is newer.
(My solution or temporay hack is to remove cached files to force the regeneration in a custom script)
(I do not look at keyboard under X11)
The script and its parameters have grown quite big. I will try to find a simple way to implement configuration template (files) support. So you can simply write down the desired script command line parameter variables into a file and load that with "CONFIG_TEMPLATE=basic" parameter (detect if other params are used together with CONIFG_TEMPLATE and A: overwrite or B: deny execution with warning) or such...
Hi. Just for your informationen: I've created a fork that uses kernel and boot binaries from Raspbian here: https://github.com/daniell1/rpi2-gen-image
If you like, I can add it as an option to your image. Please note that this will mix Debian and Raspbian repositories and might end up in an unstable system. If you don't want me to add it, I'll try to maintain it separately.
It appears that the initramfs is located in /boot rather than /boot/firmware. This means that I can't add modules that are needed during the boot process easily - I want to convert my rootfs to btrfs.
According to the Readme ENABLE_ROOT
and ENABLE_ROOT_SSH
should have default true
, but rpi23-gen-image.sh
shows:
ENABLE_ROOT=${ENABLE_ROOT:=false}
ENABLE_ROOT_SSH=${ENABLE_ROOT_SSH:=false}
The build fails is the command fuser
is not available. psmisc provides this program.
there seems to be a problem with the latest raspberry kernel (maybe related to dtds). investigating... hmm
Would be nice to add custom repositories to the buildscript so you can add packages from custom repositories
hi, please test the building, hunt down the errors (some in dmsg) and tell me what additional parameters you need. feel free to PR :).
missing:
have fun
For using the scripts I had to install the following extra dependencies under Debian Jessie:
1/1 APT_PROXY is currently not used by "/debootstrap/debootstrap --second-stage" related apt-gets. Fixing soon - important to speed up further script testing (fe with larger output images)
Hi,
I am using the Raspberry to share meteorological data from a weatherstation. I am using weewx software to get data from the WeatherStation and unfortunately, even if it is very active and opensource, the software is not in the debian repositories. A .deb package can be dowloaded from weewx site.
Would it be possible to include this deb file in the process of building the image to have it installed automatically (Maybe also usefull for other makers that may have "non-standard packages").
Thanks again, best regards
Hi. Perfectly everything is compiled. But at start of kodi constantly I have libEGL warning error: DRI2: failed to authenticate. Tried ubunu mate, arch linux, raspbian and there I have no such mistakes.
Successfully built for rpi3.
Gui works fluidly. No problems, but there is a severe lag in console activity. Both with keystroke input and with regular console activity such as executing a search within aptitude. The characters you type to search took a long time simply to show up after you type them.
Again, using aptitude as an example, it takes an inordinate amount of time to move from one highlighted file name to the next. but there is no lag in moving from one category to the next. Strange.
Also, it makes no difference whether the application is run from a terminal (within GUI) or from a console (tty2, etc...)
Is this a framebuffer issue> Has anyone encountered or solved this issue?
Hey,
I would like to run one or more script as last step of the image building process, or better said as the last step before the image is actually built.
Is this planned, or would you like to see this feature? If so, I am willing to contribute this functionality.
Your build host needs binfmt-support installed, or the kernel won't know what do with the armhf binaries.
Trivial change, but it's cost me half an hour of looking at it, never having done this before.
Ta.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.