cd ~/work/pi wget <<DIRECT FILE LINK>>
md5sum 2016-03-12-jessie-minibian.tar.gz # verify that you get # 136cac722a4f78f49b54971ae1cc03ee 2016-03-12-jessie-minibian.tar.gz tar -zxvf 2016-03-12-jessie-minibian.tar.gz
time sudo /bin/dd bs=1M if=2016-03-12-jessie-minibian.img of=/dev/sdX
sudo gparted /dev/sdb
DO NOT DO THIS… USE gparted
Manually resize partition
lsblk
sudo parted /dev/sdX (parted) unit chs (parted) print Model: Generic STORAGE DEVICE (scsi) Disk /dev/sdb: 490975,3,15 Sector size (logical/physical): 512B/512B BIOS cylinder,head,sector geometry: 490976,4,16. Each cylinder is 32.8kB. Partition Table: msdos Number Start End Type File system Flags 1 0,1,0 1953,3,15 primary fat16 2 1954,0,0 25407,3,15 primary ext4
(parted) rm 2
mkpart primary 1954,0,0 490975,3,15
Attempting to cross compile on the GUI computer
cd ~/work mkdir pi cd ~/work/pi git clone https://github.com/raspberrypi/tools
nano ~/.profile
# add raspberry pi toolchain to path PATH="$HOME/work/pi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin:$PATH"
cd ~/work/pi git clone --depth=1 https://github.com/raspberrypi/linux
Try compiling the source we just downloaded
cd ~/work/pi/linux KERNEL=kernel7 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j `getconf _NPROCESSORS_ONLN`
Install on the sd card
cd /mnt sudo mkdir pisdcard sudo mkdir pisdcard/fat32 sudo mkdir pisdcard/ext4 sudo mount /dev/sdb1 /mnt/pisdcard/fat32 sudo mount /dev/sdb2 /mnt/pisdcard/ext4
# go where the kernel is that you want to install cd /home/lvis/work/pi/linux_original sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/mnt/pisdcard/ext4 modules_install
sudo cp /mnt/pisdcard/fat32/$KERNEL.img /mnt/pisdcard/fat32/$KERNEL-backup.img sudo scripts/mkknlimg arch/arm/boot/zImage /mnt/pisdcard/fat32/$KERNEL.img sudo cp arch/arm/boot/dts/*.dtb /mnt/pisdcard/fat32/ sudo cp arch/arm/boot/dts/overlays/*.dtb* /mnt/pisdcard/fat32/overlays/ sudo cp arch/arm/boot/dts/overlays/README /mnt/pisdcard/fat32/overlays/ sync sudo umount /mnt/pisdcard/fat32 sudo umount /mnt/pisdcard/ext4
cd ~/work/pi wget https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/patch-4.9.13-rt10.patch.xz rsync -vaP linux_original/ linux_4.9.13_rt10/ cd /home/lvis/work/pi/linux_4.9.13_rt10 xz -dc ../patch-4.9.13-rt10.patch.xz | patch -p1 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- clean
cd ~/work/pi/linux_4.9.13_rt10 KERNEL=kernel7 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig
make xconfig
lvis@lvis-desktop:~/work/pi/linux_4.9.13_rt10$ cat .config | grep PREEMPT CONFIG_PREEMPT_RCU=y CONFIG_PREEMPT=y CONFIG_HAVE_PREEMPT_LAZY=y # CONFIG_PREEMPT_NONE is not set # CONFIG_PREEMPT_VOLUNTARY is not set CONFIG_PREEMPT__LL=y # CONFIG_PREEMPT_RTB is not set # CONFIG_PREEMPT_RT_FULL is not set CONFIG_PREEMPT_COUNT=y CONFIG_DEBUG_PREEMPT=y # CONFIG_PREEMPT_TRACER is not set
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j `getconf _NPROCESSORS_ONLN`
Install on the sd card
cd /mnt sudo mkdir pisdcard sudo mkdir pisdcard/fat32 sudo mkdir pisdcard/ext4 sudo mount /dev/sdb1 /mnt/pisdcard/fat32 sudo mount /dev/sdb2 /mnt/pisdcard/ext4
# go where the kernel is that you want to install cd ~/work/pi/linux_4.9.13_rt10 sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/mnt/pisdcard/ext4 modules_install
sudo cp /mnt/pisdcard/fat32/$KERNEL.img /mnt/pisdcard/fat32/$KERNEL-backup.img sudo scripts/mkknlimg arch/arm/boot/zImage /mnt/pisdcard/fat32/$KERNEL.img sudo cp arch/arm/boot/dts/*.dtb /mnt/pisdcard/fat32/ sudo cp arch/arm/boot/dts/overlays/*.dtb* /mnt/pisdcard/fat32/overlays/ sudo cp arch/arm/boot/dts/overlays/README /mnt/pisdcard/fat32/overlays/
sudo nano /mnt/pisdcard/fat32/cmdline.txt
# found this additional one too # http://www.frank-durr.de/?p=203 # Most people also disable the Low Latency Mode (llm) for the SD card: sdhci_bcm2708.enable_llm=0 dwc_otg.fiq_enable=0 dwc_otg.fiq_fsm_enable=0 dwc_otg.nak_holdoff=0
sync # just run this before unmounting the drives.. flush the cache sudo umount /mnt/pisdcard/fat32 sudo umount /mnt/pisdcard/ext4
We want to run cyclic test on here to make sure that the performance on the Pi is what we need /home/lvis/work/pi/linux_4.9.13_rt10
apt-get update apt-get upgrade
apt-get install build-essential git
mkdir ~/work cd ~/work git clone git://git.kernel.org/pub/scm/utils/rt-tests/rt-tests.git
cd ~/work/rt-tests git fetch git checkout stable/v1.0
make all cp ./cyclictest /usr/local/bin/
cyclictest -a -t -n -p99 # use priority 80 and interval of 4khz cyclictest -m -t -p 80 -n -i 250
cd /home/lvis/work/pi mkdir download cd download wget https://xenomai.org/downloads/ipipe/v4.x/arm/ipipe-core-4.1.18-arm-9.patch wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.1.18.tar.xz wget https://xenomai.org/downloads/xenomai/stable/latest/xenomai-3.0.3.tar.bz2 wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.43.tar.xz wget https://xenomai.org/downloads/ipipe/v4.x/arm/ipipe-core-4.4.43-arm-7.patch # uncompress kernel cd /home/lvis/work/pi tar xf download/linux-4.1.18.tar.xz mv linux-4.1.18 linux-4.1.18-ipipe tar xf download/linux-4.4.43.tar.xz mv linux-4.4.43 linux-4.4.43-ipipe # uncompress xenomai tar xvf download/xenomai-3.0.3.tar.bz2 # copy the latest ipipe patch for 4.1.18 in to the patch directory cd /home/lvis/work/pi/xenomai-3.0.3 # cp ../download/ipipe-core-4.1.18-arm-9.patch kernel/cobalt/arch/arm/patches/ cp -a ../download/ipipe-core-4.4.43-arm-7.patch xenomai-3.0.3/kernel/cobalt/arch/arm/patches/ # patch kernel cd ~/work/pi/xenomai-3.0.3 ./scripts/prepare-kernel.sh --linux=~/work/pi/linux-4.1.18-ipipe ./scripts/prepare-kernel.sh --linux=~/work/pi/linux-4.4.43-ipipe # and type "arm" for architecture (no errors) # configure kernel (first default, then we change it) KERNEL=kernel7 cd ../linux-4.1.18-ipipe cd ../linux-4.4.43-ipipe #### make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig * CPU Power Management * Turn it all off * Kernel Features * Preemption Model (Preemptible Kernel (Low-Latency Desktop)) * Kernel Features * [NO] Allow for memory compaction * Kernel Features * [NO] Contiguous Memory Allocator │ Selected by: COMPACTION [=y] && MMU [=y] || CMA [=y] && HAVE_MEMBLOCK [=y] && MMU [=y] ** for sage build, not doing this ** enabling this CONFIG_XENO_OPT_SHIRQ * Had to disable the Intel ethernet modules... it had an error, just disabled ALL Intel ethernet... * Had to disable lustre driver from device -> staging * Had to disable CAIF virtio transport driver make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j `getconf _NPROCESSORS_ONLN`
This did compile for me, haven't tried it yet! — David Lloyd Rabine 2017/03/04 20:55
cd ~/work/pi tar xf download/linux-4.4.43.tar.xz mv linux-4.4.43 linux-4.4.43-ipipe cd xenomai-3.0.3 scripts/prepare-kernel.sh --arch=arm --linux=~/work/pi/linux-4.4.43-ipipe cd ~/work/pi/linux-4.4.43-ipipe export KERNEL=kernel7 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2835_defconfig # make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs # no modules!? make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage dtbs -j `getconf _NPROCESSORS_ONLN` cd /mnt sudo mkdir pisdcard sudo mkdir pisdcard/fat32 sudo mkdir pisdcard/ext4 sudo mount /dev/sdb1 /mnt/pisdcard/fat32 sudo mount /dev/sdb2 /mnt/pisdcard/ext4 # go where the kernel is that you want to install cd ~/work/pi/linux-4.4.43-ipipe sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/mnt/pisdcard/ext4 modules_install # and the rest sudo cp /mnt/pisdcard/fat32/$KERNEL.img /mnt/pisdcard/fat32/$KERNEL-backup.img sudo scripts/mkknlimg arch/arm/boot/zImage /mnt/pisdcard/fat32/$KERNEL.img sudo cp arch/arm/boot/dts/*.dtb /mnt/pisdcard/fat32/ sudo cp arch/arm/boot/dts/overlays/*.dtb* /mnt/pisdcard/fat32/overlays/ sudo cp arch/arm/boot/dts/overlays/README /mnt/pisdcard/fat32/overlays/
Xenomai Application Example from /home/david/src/pi/xenomai-3.0.3/demo/posix/cobalt/eth_p_all.c
pthread_setschedparam(pthread_self(), SCHED_FIFO, ¶m); while(1) { }
Another good example /home/david/src/pi/xenomai-3.0.3/demo/posix/cobalt/xddp-echo.c
This example sends data down the pipe to keep from context switching which is probably what is causing Dan's code to not keep up.
Using this as the basis:
https://www.blaess.fr/christophe/2016/05/22/xenomai-3-sur-raspberry-pi-2/
cd ~/work/pi/download wget <<FILES>>
cd ~/work/pi/ tar xf download/xenomai-3.0.3.tar.bz2 ls xenomai-3.0.3/kernel/cobalt/arch/arm/patches/ # # results ipipe-core-3.10.32-arm-13.patch ipipe-core-3.18.20-arm-11.patch ipipe-core-4.1.18-arm-9.patch README ipipe-core-3.14.44-arm-16.patch ipipe-core-4.1.18-arm-8.patch ipipe-core-4.4.43-arm-7.patch
git clone https://github.com/raspberrypi/linux cd linux git checkout rpi-4.4.y
git checkout -b xenomai-3.0.3
patch --dry-run -p1 <../xenomai-3.0.3/kernel/cobalt/arch/arm/patches/ipipe-core-4.4.43-arm-7.patch
cd .. xenomai-3.0.3/scripts/prepare-kernel.sh --linux=linux --arch=arm --ipipe=xenomai-3.0.3/kernel/cobalt/arch/arm/patches/ipipe-core-4.4.43-arm-7.patch
KERNEL=kernel7 cd linux make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2835_defconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage modules dtbs -j 6