diff --git a/docker/Dockerfile b/docker/Dockerfile index 16db4e7..1da8a34 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,6 +12,7 @@ RUN curl https://deb.nodesource.com/node_6.x/pool/main/n/nodejs/nodejs_6.11.0-1n RUN apt-get update RUN apt-get install mtools cpio bc p7zip-full squashfs-tools +# RPI0 RUN mkdir -p /picore/kernel WORKDIR /picore/kernel @@ -41,8 +42,42 @@ WORKDIR /picore RUN rm -rf img RUN mkdir rootfs RUN cd rootfs && zcat ../boot/9.0.3.gz | cpio -i -H newc -d -RUN mkdir rootfsv7 -RUN cd rootfsv7 && zcat ../boot/9.0.3v7.gz | cpio -i -H newc -d + +# RPI3 + +RUN mkdir -p /picore/kernel3 +WORKDIR /picore/kernel3 +RUN curl http://www.tinycorelinux.net/10.x/armv7/releases/RPi/src/kernel/linux-rpi-4.19.58.tar.xz > linux-rpi.tar.xz \ + && tar xf linux-rpi.tar.xz \ + && mv linux-rpi-4.19.58 linux-rpi \ + && rm linux-rpi.tar.xz +RUN curl http://www.tinycorelinux.net/10.x/armv7/releases/RPi/src/kernel/4.19.58-piCore-v7.config.xz | xzcat > linux-rpi/.config +RUN curl http://www.tinycorelinux.net/10.x/armv7/releases/RPi/src/kernel/4.19.58-piCore-v7_Module.symvers.xz | xzcat > linux-rpi/Module.symvers +RUN curl http://www.tinycorelinux.net/10.x/armv7/releases/RPi/src/kernel/4.19.58-piCore-v7_System.map.xz | xzcat > linux-rpi/System.map + +WORKDIR /picore/kernel3/linux-rpi + +RUN apt-get update +RUN apt-get install -y bison flex libssl-dev + +RUN make ARCH=arm CROSS_COMPILE=/rpxc/bin/arm-linux-gnueabihf- modules_prepare +RUN echo "#!/bin/sh" > mkusb.sh +RUN echo "make ARCH=arm CROSS_COMPILE=/rpxc/bin/arm-linux-gnueabihf- SUBDIRS=drivers/usb -j10 modules" >> mkusb.sh +RUN chmod +x mkusb.sh +RUN ./mkusb.sh + +RUN mkdir /picore/img3 +WORKDIR /picore/img3 +RUN curl http://www.tinycorelinux.net/10.x/armv7/test_relases/RPi/piCore-10.0beta12b.zip > picore.zip +RUN 7z x picore.zip +RUN mkdir /picore/boot3 +RUN mcopy -s -i piCore-10.0beta12b.img@@4096K ::* ../boot3 +WORKDIR /picore +RUN rm -rf img +RUN mkdir rootfs3 +RUN cd rootfs3 && zcat ../boot3/10.0beta12bv7.gz | cpio -i -H newc -d + +# Generic WORKDIR /picore RUN git clone https://github.com/WiringPi/WiringPi diff --git a/docker/build.sh b/docker/build.sh index 48edde6..244c730 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -docker build -t pext/rpi:alsa --squash -f Dockerfile . +docker build -t pext/rpi:rpi3 --squash -f Dockerfile . diff --git a/image/boot/config.txt b/image/boot/config.txt index 9e2ac86..ec3cc46 100644 --- a/image/boot/config.txt +++ b/image/boot/config.txt @@ -3,12 +3,12 @@ # Some settings may impact device functionality. See link above for details [PI0] -initramfs 9.0.3.gz followkernel +initramfs rootfs.gz followkernel kernel kernel4922.img cmdline cmdline.txt [PI1] -initramfs 9.0.3.gz followkernel +initramfs rootfs.gz followkernel kernel kernel4922.img cmdline cmdline.txt diff --git a/image/boot3/cmdline3.txt b/image/boot3/cmdline3.txt new file mode 100644 index 0000000..f40bcaa --- /dev/null +++ b/image/boot3/cmdline3.txt @@ -0,0 +1 @@ +zswap.compressor=lz4 zswap.zpool=z3fold dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.lpm_enable=0 console=tty1 root=/dev/ram0 elevator=deadline rootwait quiet nortc loglevel=3 noembed diff --git a/image/boot3/config.txt b/image/boot3/config.txt new file mode 100644 index 0000000..be49b3b --- /dev/null +++ b/image/boot3/config.txt @@ -0,0 +1,84 @@ +# For more options and information see +# http://www.raspberrypi.org/documentation/configuration/config-txt.md +# Some settings may impact device functionality. See link above for details + +[PI0] +initramfs 10.0beta5a.gz followkernel +kernel kernel41442.img +cmdline cmdline.txt + +[PI1] +initramfs 10.0beta5a.gz followkernel +kernel kernel41442.img +cmdline cmdline.txt + +[PI2] +initramfs 10.0beta12bv7.gz followkernel +kernel kernel41913v7.img +cmdline cmdline.txt + +[PI3] +initramfs rootfs.gz followkernel +kernel kernel41913v7.img +cmdline cmdline3.txt + +[ALL] + +# uncomment if you get no picture on HDMI for a default "safe" mode +#hdmi_safe=1 + +# uncomment this if your display has a black border of unused pixels visible +# and your display can output without overscan +disable_overscan=1 + +# uncomment the following to adjust overscan. Use positive numbers if console +# goes off screen, and negative if there is too much border +#overscan_left=16 +#overscan_right=16 +#overscan_top=16 +#overscan_bottom=16 + +# uncomment to force a console size. By default it will be display's size minus +# overscan. +#framebuffer_width=1280 +#framebuffer_height=720 + +# uncomment if hdmi display is not detected and composite is being output +#hdmi_force_hotplug=1 + +# uncomment to force a specific HDMI mode (this will force VGA) +#hdmi_group=1 +#hdmi_mode=1 + +# uncomment to force a HDMI mode rather than DVI. This can make audio work in +# DMT (computer monitor) modes +#hdmi_drive=2 + +# uncomment to increase signal to HDMI, if you have interference, blanking, or +# no display +#config_hdmi_boost=4 + +# uncomment for composite PAL +#sdtv_mode=2 + +#uncomment to overclock the arm. 700 MHz is the default. +#arm_freq=800 + +#---------------------------------------------------- +# Enable peripheral buses + +dtparam=i2c=on,spi=on,i2s=on + +# Enable onboard audio + +dtparam=audio=on + +# Enable serial console + +enable_uart=1 + +[PI3] +dtoverlay=pi3-disable-bt +dtoverlay=dwc2 + +[ALL] diff --git a/image/build.sh b/image/build.sh index c42f500..953cc90 100755 --- a/image/build.sh +++ b/image/build.sh @@ -1,15 +1,23 @@ #!/bin/sh -TCZ="gdb alsa-modules-4.9.22-piCore alsa-oss alsa-plugins alsa alsa-utils libasound libasound-dev" +TCZ_C="alsa-plugins alsa alsa-utils libasound libasound-dev" +TCZ="gdb alsa-modules-4.9.22-piCore alsa-oss $TCZ_C" +TCZ3="alsa-modules-4.19.58-piCore-v7 $TCZ_C" f="$1" if [ "X$f" = X ] ; then mkdir -p ../built/tcz + mkdir -p ../built/tcz3 for t in $TCZ ; do test -f ../built/tcz/$t.tcz || curl http://www.tinycorelinux.net/9.x/armv6/tcz/$t.tcz > ../built/tcz/$t.tcz done - rm -rf ../built/boot + for t in $TCZ3 ; do + test -f ../built/tcz3/$t.tcz || curl http://www.tinycorelinux.net/10.x/armv7/tcz/$t.tcz > ../built/tcz3/$t.tcz + done + cp ../built/tcz{,3}/gdb.tcz + + rm -rf ../built/boot{,3} f=/build/image/inner.sh fi -docker run -i -t --rm -v `cd .. && pwd`:/build pext/rpi:alsa "$f" +docker run -i -t --rm -v `cd .. && pwd`:/build pext/rpi:rpi3 "$f" diff --git a/image/inner.sh b/image/inner.sh index b0ed955..5bb2182 100755 --- a/image/inner.sh +++ b/image/inner.sh @@ -5,47 +5,59 @@ set -ex cd /build/uf2daemon make -cd /picore/boot +for suff in "" "3" ; do +k=4.9.22-piCore +if [ "X$suff" = "X3" ]; then +k=4.19.13-piCore-v7 +fi + +cd /picore/boot$suff # remove stuff we don't support yet anyway rm *v7* *_cd.* *_x.* *_db.* # overlay files -cp -r /build/image/boot/* . +cp -r /build/image/boot$suff/* . # extract TCZs cd /picore +rm -rf sq mkdir sq -for f in /build/built/tcz/*.tcz ; do +for f in /build/built/tcz$suff/*.tcz ; do unsquashfs $f cp -r squashfs-root/* sq/ rm -rf squashfs-root done -cp sq/usr/local/bin/gdbserver rootfs/usr/bin/ -cp -r sq/lib rootfs/ +r=rootfs$suff +cp sq/usr/local/bin/gdbserver $r/usr/bin/ +cp -r sq/lib $r/ # copy alsa stuff -mkdir -p rootfs/usr/local/bin/ rootfs/usr/local/share/ rootfs/usr/local/lib/ rootfs/usr/local/sbin/ -cp -ar sq/usr/local/bin/a* rootfs/usr/local/bin/ -cp -ar sq/usr/local/sbin rootfs/usr/local/ -cp -ar sq/usr/local/lib/lib* sq/usr/local/lib/alsa* rootfs/usr/local/lib/ -cp -ar sq/usr/local/share/alsa rootfs/usr/local/share/ -for mod in snd-pcm-oss snd-mixer-oss snd-soc-core snd-bcm2835 snd-pcm-dmaengine snd-pcm snd-timer snd-compress snd ; do - p=`find sq -name $mod.ko` - cp $p rootfs/lib/modules/4.9.22-piCore/kernel/drivers/ -done +mkdir -p $r/usr/local/bin/ $r/usr/local/share/ $r/usr/local/lib/ $r/usr/local/sbin/ +cp -ar sq/usr/local/bin/a* $r/usr/local/bin/ +cp -ar sq/usr/local/sbin $r/usr/local/ +cp -ar sq/usr/local/lib/lib* sq/usr/local/lib/alsa* $r/usr/local/lib/ +cp -ar sq/usr/local/share/alsa $r/usr/local/share/ -#cp -r sq/* rootfs/ +if [ "X$suff" = "X3" ]; then +cp `find sq -name snd-\*.ko` $r/lib/modules/$k/kernel/drivers/ +else +for mod in snd-soc-core snd-bcm2835 snd-pcm-dmaengine snd-pcm snd-timer snd-compress snd ; do + p=`find sq -name $mod.ko` + cp $p $r/lib/modules/$k/kernel/drivers/ +done +fi +#cp -r sq/* $r/ #cp -ra sq /build/ -cp -r /build/image/rootfs/* rootfs/ -cp /build/uf2daemon/uf2d rootfs/sbin/ +cp -r /build/image/rootfs/* $r/ +cp /build/uf2daemon/uf2d $r/sbin/ -cd rootfs -patch -p1 < /build/image/rootfs.patch +cd $r +patch -p1 < /build/image/rootfs$suff.patch # kernel modules -cd /picore/kernel/linux-rpi +cd /picore/kernel$suff/linux-rpi patch drivers/usb/gadget/function/f_mass_storage.c < /build/kernel/f_mass_storage.c.sync.patch ./mkusb.sh -dst=/picore/rootfs/lib/modules/4.9.22-piCore/kernel +dst=/picore/$r/lib/modules/$k/kernel for d in drivers/usb/dwc2 drivers/usb/gadget \ drivers/usb/gadget/legacy drivers/usb/gadget/function drivers/usb/gadget/udc ; do @@ -54,9 +66,11 @@ for d in drivers/usb/dwc2 drivers/usb/gadget \ done # create new image -cd /picore/rootfs -find | cpio -o -R 0:0 -H newc | gzip -4 > ../boot/9.0.3.gz +cd /picore/$r +find | cpio -o -R 0:0 -H newc | gzip -4 > ../boot$suff/rootfs.gz # Copy out results to host mkdir -p /build/built -cp -r /picore/boot /build/built/boot +cp -r /picore/boot$suff /build/built/boot$suff + +done diff --git a/image/rootfs3.patch b/image/rootfs3.patch new file mode 100644 index 0000000..2d99848 --- /dev/null +++ b/image/rootfs3.patch @@ -0,0 +1,48 @@ +Only in orig/etc/init.d/: busybox-aliases +Only in orig/etc/init.d/: dhcp.sh +Only in orig/etc/init.d/: rc.shutdown +Only in orig/etc/init.d/: rcS +Only in orig/etc/init.d/: services +Only in orig/etc/init.d/: settime.sh +diff -ur orig/etc/init.d/tc-config rootfs/etc/init.d/tc-config +--- orig/etc/init.d/tc-config 2018-06-15 09:35:38.000000000 -0700 ++++ rootfs/etc/init.d/tc-config 2018-06-16 23:20:09.000000000 -0700 +@@ -25,8 +25,8 @@ + + # Main + +-#clear +-echo "${GREEN}Booting ${YELLOW}Core $VERSION ${NORMAL}" ++#clear ++echo "${GREEN}Booting ${YELLOW}Core $VERSION - Arcade Pi ${NORMAL}" + echo "${GREEN}Running Linux Kernel ${YELLOW}$KERNEL${GREEN}.${NORMAL}" + export PATH=/usr/local/sbin:/usr/local/bin:"$PATH" + +@@ -102,6 +102,8 @@ + done + fi + ++depmod -a ++ + # Start Udev to populate /dev and handle hotplug events + echo -n "${BLUE}Starting udev daemon for hotplug support...${NORMAL}" + #/sbin/udevd --daemon 2>/dev/null >/dev/null +@@ -536,6 +538,8 @@ + sync + + wait $fstab_pid ++ ++if false ; then + MSSG="${BLUE}Loading extensions...${NORMAL}" + if [ -n "$SHOWAPPS" ]; then + touch /etc/sysconfig/showapps +@@ -557,6 +561,7 @@ + echo -n "${RED}Press Enter key.${NORMAL}"; read ans + fi + fi ++fi + + [ -n "$KEYMAP" ] || KEYMAP="us" + if [ -f "/usr/share/kmap/$KEYMAP.kmap" ]; then +Only in orig/etc/init.d/: tc-restore.sh +Only in orig/etc/init.d/: tc_noscan.lst