├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── aarch64 ├── 4.9.30-docker │ ├── .config │ └── patch.sh ├── 4.9.30-std │ ├── .config │ └── patch.sh ├── README.md └── include.mk ├── armv7l ├── 3.18.28-std │ ├── .config │ └── patch.sh ├── 3.19.8-pbox │ ├── .config │ └── patch.sh ├── 3.2.34-apparmor │ ├── .config │ ├── .gitignore │ ├── README.md │ ├── include.mk │ └── patch.sh ├── 3.2.34-san │ ├── .config │ ├── .gitignore │ ├── include.mk │ └── patch.sh ├── 3.2.34-std │ ├── .config │ ├── .gitignore │ ├── README.md │ ├── include.mk │ └── patch.sh ├── 4.10.8-apparmor │ ├── .config │ └── patch.sh ├── 4.10.8-debug │ ├── .config │ └── patch.sh ├── 4.10.8-docker │ ├── .config │ └── patch.sh ├── 4.10.8-fedora │ ├── .config │ └── patch.sh ├── 4.10.8-std │ ├── .config │ ├── .latest │ └── patch.sh ├── 4.4.38-std │ ├── .config │ └── patch.sh ├── 4.4.57-std │ ├── .config │ └── patch.sh ├── 4.4.59-std │ ├── .config │ └── patch.sh ├── 4.5.2-android │ ├── .config │ └── patch.sh ├── 4.8.14-apparmor │ ├── .config │ └── patch.sh ├── 4.8.14-debug │ ├── .config │ └── patch.sh ├── 4.8.14-docker │ ├── .config │ └── patch.sh ├── 4.8.14-fedora │ ├── .config │ └── patch.sh ├── 4.8.14-std │ ├── .config │ └── patch.sh ├── 4.9.20-docker │ ├── .config │ └── patch.sh ├── 4.9.20-std │ ├── .config │ └── patch.sh ├── README.md └── include.mk ├── bitrig └── bitrig-bsd │ ├── README.md │ └── dtb ├── dtbs └── scaleway-c1.dts ├── modules └── scaleway-c1-soc-irq.c ├── patches ├── .gitignore ├── 0001-add-new-dt-autoneg-property.patch ├── 0001-enable-hardware-I-O-coherency.patch ├── 0001-fix-chained-per-cpu-interrupts.patch ├── 0001-net-mvneta-fix-TX-coalesce-interrupt-mode.patch ├── 0001-ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch ├── 0002-net-enable-inband.patch ├── 0003-fixed-phy-handle-link-down.patch ├── android │ ├── 0001-These-patches-will-allow-the-Android-binder-driver-i.patch │ └── 0002-This-patch-is-not-really-needed-for-Android-Lollipop.patch ├── patch-cpuidle-3.17-std.patch ├── patch-cpuidle-3.19-std.patch ├── patch-cpuidle-4.0.patch ├── patch-cve-2016-0728.patch ├── patch-enable-IO-coherency-3.17-std.patch ├── patch-enable-IO-coherency-4.0.patch ├── patch-inband-status_1.patch ├── patch-inband-status_2.patch ├── patch-inband-status_3.patch ├── patch-inband-status_4.patch ├── patch-mvneta-DMA-buffer-unmapping.patch ├── patch-revert-mvneta-init-nego.patch ├── patch-x86-perf-add-lbr-filter-support-for-slm.patch ├── patch_aufs.bash └── patch_mvneta_fix_tx_coalesce.bash ├── rules.mk ├── tools ├── .gitignore ├── .gitkeep ├── configs │ ├── aarch64-mainline.conf │ ├── armv7l-lsp.conf │ ├── armv7l-mainline.conf │ ├── defconfig.conf │ ├── versatile.conf │ ├── x86_64-external.conf │ └── x86_64-mainline.conf └── verify_kernel_config.pl └── x86_64 ├── 4.10.8-apparmor ├── .config └── patch.sh ├── 4.10.8-debug ├── .config └── patch.sh ├── 4.10.8-docker ├── .config └── patch.sh ├── 4.10.8-fedora ├── .config └── patch.sh ├── 4.10.8-rancher ├── .config ├── 4.8.14-fedora │ ├── .config │ └── patch.sh ├── include.mk └── patch.sh ├── 4.10.8-std ├── .config └── patch.sh ├── 4.4.38-std ├── .config └── patch.sh ├── 4.4.57-std ├── .config └── patch.sh ├── 4.4.59-std ├── .config └── patch.sh ├── 4.4.70-std ├── .config └── patch.sh ├── 4.8.14-apparmor ├── .config └── patch.sh ├── 4.8.14-debug ├── .config └── patch.sh ├── 4.8.14-docker ├── .config └── patch.sh ├── 4.8.14-fedora ├── .config └── patch.sh ├── 4.8.14-rancher ├── .config ├── include.mk └── patch.sh ├── 4.8.14-std ├── .config └── patch.sh ├── 4.9.20-docker ├── .config └── patch.sh ├── 4.9.20-std ├── .config └── patch.sh ├── README.md └── include.mk /.gitignore: -------------------------------------------------------------------------------- 1 | **/*uImage* 2 | *~ 3 | *# 4 | .#* 5 | dist/ 6 | ccache/ 7 | source -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: bash 2 | 3 | services: 4 | - docker 5 | 6 | sudo: required 7 | 8 | env: 9 | - ACTION=check 10 | - ACTION=build 11 | 12 | before_install: 13 | - docker images 14 | - if [ "$ACTION" = "build" -a -n "$TRAVIS_TAG" ]; then docker pull moul/kernel-builder; fi 15 | - docker images 16 | 17 | script: 18 | - env 19 | - docker version 20 | - docker info 21 | - df -h 22 | - if [ "$ACTION" = "check" ]; then make travis_check; fi 23 | - if [ "$ACTION" = "build" -a -n "$TRAVIS_TAG" ]; then make travis_build CCACHE_DIR=$HOME/.ccache; fi 24 | - if [ -d dist ]; then ls -laR dist; fi 25 | - docker info 26 | - docker images 27 | - df -h 28 | 29 | ccache: ccache -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2015 Scaleway 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | KERNEL ?= $(patsubst %/,%,$(dir $(wildcard armv7l/*-*/.latest))) 2 | -include $(KERNEL)/include.mk 3 | 4 | # Default variables 5 | REVISION ?= manual 6 | KERNELS ?= $(wildcard x86_64/*-* armv7l/*-* aarch64/*-*) 7 | KERNEL_ARCH ?= $(shell echo $(KERNEL) | cut -d/ -f1) 8 | -include $(KERNEL_ARCH)/include.mk 9 | KERNEL_VERSION ?= $(shell echo $(KERNEL) | cut -d/ -f2 | cut -d- -f1) 10 | KERNEL_FLAVOR ?= $(shell echo $(KERNEL) | cut -d/ -f2 | cut -d- -f2) 11 | KERNEL_FULL ?= $(KERNEL_ARCH)-$(KERNEL_VERSION)-$(KERNEL_FLAVOR)-$(REVISION) 12 | DOCKER_BUILDER ?= moul/kernel-builder:latest 13 | CONCURRENCY_LEVEL ?= $(shell expr 1 + `nproc || sysctl -n hw.ncpu`) 14 | J ?= -j $(CONCURRENCY_LEVEL) 15 | S3_TARGET ?= s3://$(shell whoami)/$(KERNEL_FULL)/ 16 | STORE_HOSTNAME ?= store.scw.42.am 17 | STORE_USERNAME ?= $(shell whoami) 18 | STORE_TARGET ?= $(STORE_HOSTNAME):store/kernels/$(KERNEL_FULL) 19 | CHECKOUT_TARGET ?= refs/tags/v$(KERNEL_VERSION) 20 | LOCALVERSION ?= -$(KERNEL_FLAVOR)-$(REVISION) 21 | KBUILD_BUILD_USER ?= $(shell whoami) 22 | KBUILD_BUILD_HOST ?= $(shell hostname) 23 | 24 | 25 | CCACHE_DIR ?= $(PWD)/ccache 26 | LINUX_PATH=/usr/src/linux 27 | 28 | KERNEL_TYPE ?= mainline 29 | ENTER_COMMAND ?= (git show-ref refs/tags/v$(KERNEL_VERSION) >/dev/null || git fetch --tags) && git checkout $(CHECKOUT_TARGET) && git log HEAD^..HEAD 30 | SHELL_EXEC_CMD ?= make -f rules.mk shell 31 | TRAVIS_TAG ?= 32 | 33 | all: help 34 | 35 | .PHONY: help 36 | help: 37 | @echo 'General purpose commands' 38 | @echo ' menuconfig KERNEL=4.0.5-std run "make menuconfig" in the builder container' 39 | @echo ' oldconfig KERNEL=4.0.5-std run "make oldconfig" in the builder container' 40 | @echo ' olddefconfig KERNEL=4.0.5-std run "make olddefconfig" in the builder container' 41 | @echo ' build KERNEL=4.0.5-std run "make build" in the builder container' 42 | @echo ' shell KERNEL=4.0.5-std open a shell in the kernel builder image' 43 | @echo ' diff KERNEL=4.0.5-std show diffs between 2 .config files' 44 | @echo ' publish_on_s3 S3_TARGET=s3://me/ publish uImage, dtbs, lib, modules on s3' 45 | @echo ' publish_on_store STORE_TARGET=str.io/me publish uImage, dtbs, lib, modules on store' 46 | @echo ' create KERNEL=5.1.2-std create a new kernel directory' 47 | 48 | 49 | print-%: 50 | @echo $* = $($*) 51 | 52 | 53 | info: 54 | @echo "KERNEL $(KERNEL)" 55 | @echo "KERNEL_FLAVOR $(KERNEL_FLAVOR)" 56 | @echo "KERNEL_FULL $(KERNEL_FULL)" 57 | @echo "KERNEL_TYPE $(KERNEL_TYPE)" 58 | @echo "KERNEL_VERSION $(KERNEL_VERSION)" 59 | @echo "KERNEL_ARCH $(KERNEL_ARCH)" 60 | @echo "ARCH_CONFIG $(ARCH_CONFIG)" 61 | @echo "CONCURRENCY_LEVEL $(CONCURRENCY_LEVEL)" 62 | @echo "DOCKER_ENV $(DOCKER_ENV)" 63 | @echo "DOCKER_VOLUMES $(DOCKER_VOLUMES)" 64 | @echo "LINUX_PATH $(LINUX_PATH)" 65 | @echo "DOCKER_BUILDER $(DOCKER_BUILDER)" 66 | @echo "ENTER_COMMAND $(ENTER_COMMAND)" 67 | @echo "S3_TARGET $(S3_TARGET)" 68 | 69 | 70 | bump-builder: 71 | docker pull $(DOCKER_BUILDER) 72 | 73 | 74 | create: 75 | @test -d ./$(KERNEL) && echo " Kernel $(KERNEL) already exists !" && exit 1 || true 76 | mkdir -p $(KERNEL) 77 | touch $(KERNEL)/.config $(KERNEL)/patch.sh 78 | @echo " Now you can generate a default configuration using:" 79 | @echo " - make mvebu_v7_defconfig KERNEL=$(KERNEL)" 80 | 81 | 82 | shell menuconfig:: local_assets 83 | docker run -it $(DOCKER_ENV) $(DOCKER_VOLUMES) $(DOCKER_BUILDER) \ 84 | make -f rules.mk ENTER_COMMAND="$(ENTER_COMMAND)" J="$(J)" enter $@ leave 85 | 86 | 87 | oldconfig olddefconfig $(ARCH_CONFIG)_defconfig dtbs diff cache_stats uImage build bzImage:: local_assets 88 | docker run -i $(DOCKER_ENV) $(DOCKER_VOLUMES) $(DOCKER_BUILDER) \ 89 | make -f rules.mk ENTER_COMMAND="$(ENTER_COMMAND)" J="$(J)" enter $@ leave 90 | 91 | 92 | shell_exec:: 93 | docker exec -it `docker ps -f image=$(DOCKER_BUILDER) -f event=start -lq` $(SHELL_EXEC_CMD) 94 | 95 | 96 | publish_uImage_on_s3: dist/$(KERNEL_FULL)/uImage 97 | s3cmd put --acl-public $< $(S3_TARGET) 98 | wget --read-timeout=3 --tries=0 -O - $(shell s3cmd info $(S3_TARGET)uImage | grep URL | awk '{print $$2}') >/dev/null 99 | 100 | 101 | publish_on_s3: dist/$(KERNEL_FULL)/dtbs/_ dist/$(KERNEL_FULL)/lib.tar.gz dist/$(KERNEL_FULL)/include.tar.gz 102 | cd dist/$(KERNEL_FULL) && \ 103 | for file in lib.tar.gz include.tar.gz uImage* *zImage* config* vmlinuz* build.txt modules.order modules.builtin kernel.release System.map Module.symvers dtbs/*; do \ 104 | s3cmd put --acl-public $$file $(S3_TARGET); \ 105 | sleep 5; \ 106 | done 107 | 108 | 109 | publish_on_store: dist/$(KERNEL_FULL)/lib.tar.gz dist/$(KERNEL_FULL)/include.tar.gz 110 | ssh $(shell echo "$(STORE_TARGET)" | cut -d: -f1) mkdir -p $(shell echo "$(STORE_TARGET)" | cut -d: -f2) 111 | cd dist/$(KERNEL_FULL) && \ 112 | for file in lib.tar.gz include.tar.gz uImage* *zImage* config* vmlinuz* build.txt modules.order modules.builtin kernel.release System.map Module.symvers dtbs/*; do \ 113 | if [ -f $$file ]; then \ 114 | scp $$file $(STORE_TARGET)/; \ 115 | fi; \ 116 | done 117 | 118 | 119 | publish_on_store_ftp: dist/$(KERNEL_FULL)/dtbs/_ dist/$(KERNEL_FULL)/lib.tar.gz dist/$(KERNEL_FULL)/include.tar.gz 120 | cd dist/$(KERNEL_FULL) && \ 121 | for file in lib.tar.gz include.tar.gz uImage* *zImage* config* vmlinuz* build.txt modules.order modules.builtin kernel.release System.map Module.symvers dtbs/*; do \ 122 | curl -T "$$file" --netrc ftp://$(STORE_HOSTNAME)/kernels/$(KERNEL_FULL)/; \ 123 | done 124 | 125 | 126 | publish_on_store_sftp: dist/$(KERNEL_FULL)/dtbs/_ dist/$(KERNEL_FULL)/lib.tar.gz dist/$(KERNEL_FULL)/include.tar.gz 127 | cd dist/$(KERNEL_FULL) && \ 128 | for file in lib.tar.gz include.tar.gz uImage* *zImage* config* vmlinuz* build.txt modules.order modules.builtin kernel.release System.map Module.symvers dtbs/*; do \ 129 | lftp -u $(STORE_USERNAME) -p 2222 sftp://$(STORE_HOSTNAME) -e "mkdir store/kernels/$(KERNEL_FULL); cd store/kernels/$(KERNEL_FULL); put $$file; bye"; \ 130 | done 131 | 132 | 133 | dist/$(KERNEL_FULL)/dtbs/_: 134 | mkdir -p dist/$(KERNEL_FULL)/dtbs 135 | touch $@ 136 | 137 | 138 | dist/$(KERNEL_FULL)/lib.tar.gz: dist/$(KERNEL_FULL)/lib 139 | tar -C dist/$(KERNEL_FULL) -cvzf $@ lib 140 | 141 | 142 | dist/$(KERNEL_FULL)/include.tar.gz: dist/$(KERNEL_FULL)/include 143 | tar -C dist/$(KERNEL_FULL) -cvzf $@ include 144 | 145 | 146 | # dist/$(KERNEL_FULL)/lib dist/$(KERNEL_FULL)/include: build 147 | 148 | 149 | clean: 150 | rm -rf dist/$(KERNEL_FULL) 151 | 152 | 153 | fclean: clean 154 | rm -rf dist ccache 155 | 156 | 157 | local_assets: $(KERNEL)/.config $(KERNEL)/patch.sh dist/$(KERNEL_FULL) ccache 158 | 159 | 160 | $(KERNEL)/patch.sh: $(KERNEL) 161 | touch $@ 162 | chmod +x $@ 163 | 164 | 165 | $(KERNEL)/.config: 166 | @echo "💣 💀 ⚠️ WARNING: Kernel '$(KERNEL)' is not yet initialized." 167 | exit 1 168 | 169 | 170 | dist/$(KERNEL_FULL) ccache $(KERNEL): 171 | mkdir -p $@ 172 | 173 | 174 | .PHONY: all build run menuconfig clean fclean ccache_stats 175 | 176 | 177 | ## Travis 178 | travis_common: 179 | #for file in */.config; do bash -n $$file; done 180 | find . -name "*.bash" | xargs bash -n 181 | make -n 182 | 183 | tools/docker-checkconfig.sh: 184 | curl -sLo $@ https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh 185 | chmod +x $@ 186 | 187 | tools/lxc-checkconfig.sh: 188 | curl -sLo $@ https://raw.githubusercontent.com/dotcloud/lxc/master/src/lxc/lxc-checkconfig.in 189 | chmod +x $@ 190 | 191 | travis_kernel: local_assets tools/lxc-checkconfig.sh tools/docker-checkconfig.sh 192 | bash -n $(KERNEL)/.config 193 | 194 | # Optional checks, these checks won't fail but we can see the detail in the Travis build result 195 | CONFIG=$(KERNEL)/.config GREP=grep ./tools/lxc-checkconfig.sh || true 196 | CONFIG=$(KERNEL)/.config ./tools/docker-checkconfig.sh || true 197 | 198 | ./tools/verify_kernel_config.pl $(KERNEL_ARCH)-$(KERNEL_TYPE) $(KERNEL)/.config 199 | 200 | # Disabling make oldconfig check for now because of the memory limit on travis CI builds 201 | # ./run $(MAKE) oldconfig 202 | 203 | 204 | # travis_common + travis_kernel for each kernels 205 | travis_check: travis_common 206 | echo $(KERNELS) 207 | for kernel in $(KERNELS); do \ 208 | make travis_kernel KERNEL=$$kernel || exit 1; \ 209 | done 210 | 211 | 212 | travis_build: 213 | $(MAKE) build KERNEL=$(shell echo $(TRAVIS_TAG) | cut -d- -f1,2) REVISION=$(shell echo $(TRAVIS_TAG) | cut -d- -f3) 214 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kernel Config 2 | [![Build Status](https://travis-ci.org/scaleway/kernel-tools.svg?branch=master)](https://travis-ci.org/scaleway/kernel-tools) 3 | 4 | https://community.cloud.online.net/t/official-linux-kernel-new-modules-optimizations-hacks/226 5 | 6 | The kernel is built with the official mainline kernel, here are the .config files used. 7 | 8 | The list of Scaleway's bootscripts is available at http://devhub.scaleway.com/#/bootscripts. 9 | 10 | ## Modifications 11 | 12 | We added kernel module to simulate some virtualization features: 13 | - serial console activation 14 | - remote soft reset trigger 15 | 16 | --- 17 | 18 | ## How to build a custom kernel module 19 | 20 | You'll need the usual toolchain for kernel compilation, which on Ubuntu is generally fulfilled by `apt-get install build-essential libssl-dev`. Then, the following script can be run. 21 | 22 | ```bash 23 | # Determine versions 24 | arch="$(uname -m)" 25 | release="$(uname -r)" 26 | upstream="${release%%-*}" 27 | local="${release#*-}" 28 | 29 | # Get kernel sources 30 | mkdir -p /usr/src 31 | wget -O "/usr/src/linux-${upstream}.tar.xz" "https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-${upstream}.tar.xz" 32 | tar xf "/usr/src/linux-${upstream}.tar.xz" -C /usr/src/ 33 | ln -fns "/usr/src/linux-${upstream}" /usr/src/linux 34 | ln -fns "/usr/src/linux-${upstream}" "/lib/modules/${release}/build" 35 | 36 | # Prepare kernel 37 | zcat /proc/config.gz > /usr/src/linux/.config 38 | printf 'CONFIG_LOCALVERSION="%s"\nCONFIG_CROSS_COMPILE=""\n' "${local:+-$local}" >> /usr/src/linux/.config 39 | wget -O /usr/src/linux/Module.symvers "http://mirror.scaleway.com/kernel/${arch}/${release}/Module.symvers" 40 | apt-get install -y libssl-dev # adapt to your package manager 41 | make -C /usr/src/linux prepare modules_prepare 42 | ``` 43 | 44 | Then you can make your module as usual by configuring `KDIR=/lib/modules/$(uname -r)/build/` 45 | 46 | Alternatively, you can now build a DKMS-based kernel module, for instance: `apt-get install zfsutils-linux` 47 | 48 | ## Kernels 49 | 50 | Name | Maintainer | Sources | Target | Links 51 | ------------------|-----------------|---------|--------|------- 52 | 3.2.34 | Marvell | Closed | C1 | n/a 53 | 3.18.20 | Linux community | Open | C1 | [Sources](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/?id=v3.18.20) 54 | 3.19.8 | Linux community | Open | C1 | [Sources](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/?id=v3.19.8) 55 | 4.1.6 | Linux community | Open | C1 | [Sources](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/?id=v4.1.6) 56 | 4.2 | Linux community | Open | C1 | [Sources](https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/?id=v4.2) 57 | 58 | --- 59 | 60 | ## Build a custom kernel using Docker 61 | 62 | Run a `make menuconfig` for `3-18-std/.config` 63 | 64 | make menuconfig KERNEL=3.18-std 65 | 66 | Build a kernel with `3.17-std/.config` file 67 | 68 | make build KERNEL=3.17-std 69 | 70 | ## Advanced options 71 | 72 | Create a new `3.10-new/.config` file from scratch for kernel `3.10` 73 | 74 | make create defconfig KERNEL=3.10-new 75 | 76 | Make oldconfig a `3.18-std` kernel 77 | 78 | make oldconfig KERNEL=3.18-std 79 | 80 | Run a shell in the container for easy debugging and run custom commands 81 | 82 | make shell KERNEL=3.17-std 83 | 84 | ## Test a kernel with QEMU 85 | 86 | You should use a config file made for `versatile`. 87 | 88 | Build a `3.18` kernel for `versatile`: 89 | 90 | make build KERNEL=3.18-defconfig_versatile 91 | 92 | Run the kernel in qemu 93 | 94 | make qemu KERNEL=3.18-defconfig_versatile 95 | 96 | ## How to upgrade a kernel 97 | 98 | **An example with 4.0.8-docker** 99 | 100 | You should move the directory 101 | 102 | git mv 4.0.8-docker 4.0.9-docker 103 | 104 | Run a `make oldconfig` with the newest version 105 | 106 | make oldconfig KERNEL=4.0.9-docker 107 | 108 | --- 109 | 110 | ## Build a custom kernel from scratch (without Docker) 111 | 112 | ### Prerequisites: 113 | 114 | - An arm(hf) compiler: 115 | - a cross-compiler on non-armhf host, ie `gcc-arm-linux-gnueabihf` 116 | - a standard compiler from an armhf host (you can build a kernel from your C1) 117 | - Theses packages: git, wget, make 118 | 119 | 120 | ### Steps: 121 | 122 | - Configure environment 123 | ```bash 124 | export VERSION=3.17 125 | export ARCH=arm 126 | export ARTIFACTS=artifacts 127 | ``` 128 | 129 | - Download archive via web 130 | ```bash 131 | wget https://kernel.org/pub/linux/kernel/v3.x/linux-$VERSION.tar.xz && tar xf linux-$VERSION.tar.xz 132 | ``` 133 | or via git 134 | ```bash 135 | git clone -b v$VERSION --single-branch git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux-$VERSION 136 | ``` 137 | 138 | - Generate a base `.config` file by building it 139 | ``` 140 | make ARCH=arm mvebu_v7_defconfig 141 | ``` 142 | or by fetching our one 143 | ``` 144 | wget -O .config https://raw.githubusercontent.com/scaleway/kernel-tools/master/$VERSION/.config 145 | ``` 146 | 147 | - Tune the .config 148 | ```bash 149 | make ARCH=arm menuconfig 150 | # ... configure using console interface 151 | ``` 152 | 153 | - Building kernel and modules 154 | ```bash 155 | make -j $(echo `nproc` ' * 2' | bc) uImage modules LOADADDR=0x8000 156 | ``` 157 | 158 | - Export the artifacts (kernel, header, modules) to `$ARTIFACTS` directory 159 | ```bash 160 | mkdir -p $ARTIFACTS 161 | cp arch/arm/boot/uImage $ARTIFACTS/ 162 | cp System.map $ARTIFACTS/ 163 | cp .config $ARTIFACTS/ 164 | make headers_install INSTALL_HDR_PATH=$ARTIFACTS/ > /dev/null 165 | find $ARTIFACTS/include -name ".install" -or -name "..install.cmd" -delete 166 | make modules_install INSTALL_MOD_PATH=$ARTIFACTS/ > /dev/null 167 | rm -rf $ARTIFACTS/modules && \ 168 | mv $ARTIFACTS/lib/modules $ARTIFACTS && \ 169 | rmdir $ARTIFACTS/lib && \ 170 | rm $ARTIFACTS/modules/*/source $ARTIFACTS/modules/*/build 171 | ``` 172 | 173 | ### Minimal configuration for C1 servers 174 | 175 | ```gherkin 176 | - Networking support 177 | - Networking options 178 | - 802.1Q/802.1ad VLAN Support -> **YES** 179 | - Packet socket -> **YES** 180 | - Unix domain sockets -> **YES** 181 | - Device Drivers 182 | - Network device support 183 | - PHY Device support and infrastructure 184 | - Driver for MDIO Bus/PHY emulation with fixed speed/link PHYs -> **YES** 185 | - Block devices 186 | - Network block device support -> **YES** 187 | - Kernel hacking 188 | - Kernel low-level debugging functions -> **YES** 189 | - Early prink -> **YES** 190 | - File systems 191 | - The Extended 4 (ext4) filesystem -> **YES** 192 | ``` 193 | 194 | ### How to bump multiple kernels at once 195 | 196 | ```bash 197 | # It's an example to bump the kernels from 4.5.7 to 4.6.4 198 | git mv x86_64/4.{5.7,6.4}-std 199 | git mv x86_64/4.{5.7,6.4}-docker 200 | git mv x86_64/4.{5.7,6.4}-apparmor 201 | git mv x86_64/4.{5.7,6.4}-coreos 202 | git mv x86_64/4.{5.7,6.4}-fedora 203 | git mv x86_64/4.{5.7,6.4}-rancher 204 | git mv armv7l/4.{5.7,6.4}-std 205 | git mv armv7l/4.{5.7,6.4}-apparmor 206 | git mv armv7l/4.{5.7,6.4}-debug 207 | git mv armv7l/4.{5.7,6.4}-docker 208 | git mv armv7l/4.{5.7,6.4}-fedora 209 | for kernel in `find x86_64 -name "4.6.4-*"`; do make oldconfig KERNEL=$kernel; done 210 | for kernel in `find armv7l -name "4.6.4-*"`; do make oldconfig KERNEL=$kernel; done 211 | ``` 212 | 213 | ### How to bump a kernel 214 | 215 | ```bash 216 | git mv x86_64/4.{5.7,6.4}-std 217 | make oldconfig KERNEL=x86_64/4.6.4-std 218 | ``` 219 | 220 | 221 | ## Licensing 222 | 223 | © 2014-2015 Scaleway - [MIT License](https://github.com/scaleway/kernel-tools/blob/master/LICENSE). 224 | -------------------------------------------------------------------------------- /aarch64/4.9.30-docker/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | KVER=4.9 /bin/bash -x patches/patch_aufs.bash 4 | -------------------------------------------------------------------------------- /aarch64/4.9.30-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | -------------------------------------------------------------------------------- /aarch64/README.md: -------------------------------------------------------------------------------- 1 | # `arm64` kernel images 2 | -------------------------------------------------------------------------------- /aarch64/include.mk: -------------------------------------------------------------------------------- 1 | DOCKER_ENV ?= -e LOADADDR=0x8000 \ 2 | -e CONCURRENCY_LEVEL=$(CONCURRENCY_LEVEL) \ 3 | -e ARCH=arm64 \ 4 | -e CROSS_COMPILE="ccache aarch64-linux-gnu-" \ 5 | -e KERNEL_ARCH=$(KERNEL_ARCH) \ 6 | -e KBUILD_BUILD_USER=$(KBUILD_BUILD_USER) \ 7 | -e KBUILD_BUILD_HOST=$(KBUILD_BUILD_HOST) \ 8 | -e LOCALVERSION=$(LOCALVERSION) 9 | 10 | DOCKER_VOLUMES ?= -v $(PWD)/$(KERNEL)/.config:/tmp/.config \ 11 | -v $(PWD)/dist/$(KERNEL_FULL):$(LINUX_PATH)/build/ \ 12 | -v $(CCACHE_DIR):/ccache \ 13 | -v $(PWD)/patches:$(LINUX_PATH)/patches:rw \ 14 | -v $(PWD)/$(KERNEL)/patch.sh:$(LINUX_PATH)/patches-apply.sh:ro \ 15 | -v $(PWD)/rules.mk:$(LINUX_PATH)/rules.mk:ro 16 | 17 | qemu: 18 | qemu-system-aarch64 \ 19 | -M versatilepb \ 20 | -m 256 \ 21 | -initrd ./dist/$(KERNEL_FULL)/initrd.img-* \ 22 | -kernel ./dist/$(KERNEL_FULL)/Image-* \ 23 | -append "console=tty1" 24 | -------------------------------------------------------------------------------- /armv7l/3.18.28-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | patch -p1 < patches/0001-enable-hardware-I-O-coherency.patch 4 | patch -p1 < patches/patch-cpuidle-3.17-std.patch 5 | -------------------------------------------------------------------------------- /armv7l/3.19.8-pbox/patch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | patch -p1 < patches/0001-enable-hardware-I-O-coherency.patch 4 | patch -p1 < patches/patch-cpuidle-3.19-std.patch 5 | -------------------------------------------------------------------------------- /armv7l/3.2.34-apparmor/.gitignore: -------------------------------------------------------------------------------- 1 | /linux-marvell -------------------------------------------------------------------------------- /armv7l/3.2.34-apparmor/README.md: -------------------------------------------------------------------------------- 1 | # 3.2.34-apparmor 2 | 3 | Marvell 3.2.x LSP kernel with standard configuration 4 | 5 | # Changelog 6 | 7 | ## 3.2.34-xx-apparmor (xxxx-xx-xx) 8 | 9 | * Use ext4 for ext2/ext3 file systems 10 | 11 | ## 3.2.34-31-apparmor (2015-06-09) 12 | 13 | * Enabled apparmor support 14 | 15 | ## 3.2.34-30-std (2015-04-13) 16 | 17 | * Disable MV_XOR ([#67](https://github.com/scaleway/kernel-tools/issues/67)) 18 | 19 | ## 3.2.34-29-std (xxxx-xx-xx) 20 | 21 | * Build nf_conntrack as module ([#35](https://github.com/scaleway/kernel-tools/issues/35)) 22 | * Add cryptodev support for testing 23 | * Add plenty of new modules ([#26](https://github.com/scaleway/kernel-tools/issues/26)) 24 | * Add perf counters 25 | 26 | 27 | ## 3.2.34-xx-std (xxxx-xx-xx) 28 | 29 | * Add tasks stats support ([#18](https://github.com/scaleway/kernel-tools/issues/18)) 30 | * Add plenty of new modules 31 | * Enable CGROUPS 32 | * Enable NF_CONNTRACK, NF_CONNTRACK_IPV4, NV_DEFRAG_IPV4 and CONFIG_DEVPTS_MULTIPLE_INSTANCES 33 | 34 | ## 3.2.34 (2014-12-08) 35 | 36 | * Bump to Linux 3.2.34 + Marvell LSP patches 37 | * [linux changelog](https://kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.2.34) 38 | * Marvell LSP patches are closed source 39 | -------------------------------------------------------------------------------- /armv7l/3.2.34-apparmor/include.mk: -------------------------------------------------------------------------------- 1 | KERNEL_TYPE ?= lsp 2 | DOCKER_BUILDER ?= moul/kernel-builder:local-cross-armhf 3 | ENTER_COMMAND ?= git branch && git checkout -q lsp-v$(KERNEL_VERSION) && git checkout . && git status && git log HEAD^..HEAD 4 | 5 | 6 | oldconfig olddefconfig menuconfig $(ARCH_CONFIG)_defconfig shell build diff:: $(KERNEL)/linux-marvell 7 | echo $(eval DOCKER_VOLUMES := $(DOCKER_VOLUMES) -v $(PWD)/$(KERNEL)/linux-marvell/.git:$(LINUX_PATH)/.git) 8 | 9 | 10 | $(KERNEL)/linux-marvell: 11 | @echo "***" 12 | @echo "You need to put the closed-source marvell's kernel git here (a symbolic link works)" 13 | @echo "***" 14 | @echo 15 | @exit 1 16 | -------------------------------------------------------------------------------- /armv7l/3.2.34-apparmor/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/armv7l/3.2.34-apparmor/patch.sh -------------------------------------------------------------------------------- /armv7l/3.2.34-san/.gitignore: -------------------------------------------------------------------------------- 1 | /linux-marvell -------------------------------------------------------------------------------- /armv7l/3.2.34-san/include.mk: -------------------------------------------------------------------------------- 1 | KERNEL_TYPE ?= lsp 2 | DOCKER_BUILDER ?= moul/kernel-builder:local-cross-armhf 3 | ENTER_COMMAND ?= git branch && git checkout -q lsp-v$(KERNEL_VERSION) && git checkout . && git status && git log HEAD^..HEAD 4 | 5 | 6 | oldconfig olddefconfig menuconfig $(ARCH_CONFIG)_defconfig shell build diff:: $(KERNEL)/linux-marvell 7 | echo $(eval DOCKER_VOLUMES := $(DOCKER_VOLUMES) -v $(PWD)/$(KERNEL)/linux-marvell/.git:$(LINUX_PATH)/.git) 8 | 9 | 10 | $(KERNEL)/linux-marvell: 11 | @echo "***" 12 | @echo "You need to put the closed-source marvell's kernel git here (a symbolic link works)" 13 | @echo "***" 14 | @echo 15 | @exit 1 16 | -------------------------------------------------------------------------------- /armv7l/3.2.34-san/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/armv7l/3.2.34-san/patch.sh -------------------------------------------------------------------------------- /armv7l/3.2.34-std/.gitignore: -------------------------------------------------------------------------------- 1 | /linux-marvell -------------------------------------------------------------------------------- /armv7l/3.2.34-std/README.md: -------------------------------------------------------------------------------- 1 | # 3.2.34-std 2 | 3 | Marvell 3.2.x LSP kernel with standard configuration 4 | 5 | # Changelog 6 | 7 | ## 3.2.34-xx-std (xxxx-xx-xx) 8 | 9 | * Use ext4 for ext2/ext3 file systems 10 | 11 | ## 3.2.34-30-std (2015-04-13) 12 | 13 | * Disable MV_XOR ([#67](https://github.com/scaleway/kernel-tools/issues/67)) 14 | 15 | ## 3.2.34-29-std (xxxx-xx-xx) 16 | 17 | * Build nf_conntrack as module ([#35](https://github.com/scaleway/kernel-tools/issues/35)) 18 | * Add cryptodev support for testing 19 | * Add plenty of new modules ([#26](https://github.com/scaleway/kernel-tools/issues/26)) 20 | * Add perf counters 21 | 22 | 23 | ## 3.2.34-xx-std (xxxx-xx-xx) 24 | 25 | * Add tasks stats support ([#18](https://github.com/scaleway/kernel-tools/issues/18)) 26 | * Add plenty of new modules 27 | * Enable CGROUPS 28 | * Enable NF_CONNTRACK, NF_CONNTRACK_IPV4, NV_DEFRAG_IPV4 and CONFIG_DEVPTS_MULTIPLE_INSTANCES 29 | 30 | ## 3.2.34 (2014-12-08) 31 | 32 | * Bump to Linux 3.2.34 + Marvell LSP patches 33 | * [linux changelog](https://kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.2.34) 34 | * Marvell LSP patches are closed source 35 | -------------------------------------------------------------------------------- /armv7l/3.2.34-std/include.mk: -------------------------------------------------------------------------------- 1 | KERNEL_TYPE ?= lsp 2 | DOCKER_BUILDER ?= moul/kernel-builder:local-cross-armhf 3 | ENTER_COMMAND ?= git branch && git checkout -q lsp-v$(KERNEL_VERSION) && git checkout . && git status && git log HEAD^..HEAD 4 | 5 | 6 | oldconfig olddefconfig menuconfig $(ARCH_CONFIG)_defconfig shell build diff:: $(KERNEL)/linux-marvell 7 | echo $(eval DOCKER_VOLUMES := $(DOCKER_VOLUMES) -v $(PWD)/$(KERNEL)/linux-marvell/.git:$(LINUX_PATH)/.git) 8 | 9 | 10 | $(KERNEL)/linux-marvell: 11 | @echo "***" 12 | @echo "You need to put the closed-source marvell's kernel git here (a symbolic link works)" 13 | @echo "***" 14 | @echo 15 | @exit 1 16 | -------------------------------------------------------------------------------- /armv7l/3.2.34-std/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/armv7l/3.2.34-std/patch.sh -------------------------------------------------------------------------------- /armv7l/4.10.8-apparmor/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | -------------------------------------------------------------------------------- /armv7l/4.10.8-debug/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | -------------------------------------------------------------------------------- /armv7l/4.10.8-docker/patch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | KVER=4.10 /bin/bash -x patches/patch_aufs.bash 4 | 5 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 6 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 7 | -------------------------------------------------------------------------------- /armv7l/4.10.8-fedora/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | -------------------------------------------------------------------------------- /armv7l/4.10.8-std/.latest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/armv7l/4.10.8-std/.latest -------------------------------------------------------------------------------- /armv7l/4.10.8-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | -------------------------------------------------------------------------------- /armv7l/4.4.38-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | #patch -p1 < patches/patch-cpuidle-4.0.patch 6 | 7 | # sgmii mvneta 8 | #patch -p1 < patches/patch-inband-status_1.patch 9 | #patch -p1 < patches/patch-inband-status_2.patch 10 | #patch -p1 < patches/patch-inband-status_3.patch 11 | #patch -p1 < patches/patch-inband-status_4.patch 12 | -------------------------------------------------------------------------------- /armv7l/4.4.57-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | #patch -p1 < patches/patch-cpuidle-4.0.patch 6 | 7 | # sgmii mvneta 8 | #patch -p1 < patches/patch-inband-status_1.patch 9 | #patch -p1 < patches/patch-inband-status_2.patch 10 | #patch -p1 < patches/patch-inband-status_3.patch 11 | #patch -p1 < patches/patch-inband-status_4.patch 12 | -------------------------------------------------------------------------------- /armv7l/4.4.59-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | #patch -p1 < patches/patch-cpuidle-4.0.patch 6 | 7 | # sgmii mvneta 8 | #patch -p1 < patches/patch-inband-status_1.patch 9 | #patch -p1 < patches/patch-inband-status_2.patch 10 | #patch -p1 < patches/patch-inband-status_3.patch 11 | #patch -p1 < patches/patch-inband-status_4.patch 12 | -------------------------------------------------------------------------------- /armv7l/4.5.2-android/patch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # arm io coherency 4 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 5 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 6 | 7 | # android from Joel Isaacson joel@ascender.com 8 | patch -p1 < patches/android/0001-These-patches-will-allow-the-Android-binder-driver-i.patch 9 | patch -p1 < patches/android/0002-This-patch-is-not-really-needed-for-Android-Lollipop.patch 10 | -------------------------------------------------------------------------------- /armv7l/4.8.14-apparmor/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | #patch -p1 < patches/patch-cve-2016-0728.patch 5 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 6 | #patch -p1 < patches/patch-cpuidle-4.0.patch 7 | 8 | # sgmii mvneta 9 | #patch -p1 < patches/patch-inband-status_1.patch 10 | #patch -p1 < patches/patch-inband-status_2.patch 11 | #patch -p1 < patches/patch-inband-status_3.patch 12 | #patch -p1 < patches/patch-inband-status_4.patch 13 | #patch -p1 < patches/patch-mvneta-DMA-buffer-unmapping.patch 14 | -------------------------------------------------------------------------------- /armv7l/4.8.14-debug/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | #patch -p1 < patches/patch-cve-2016-0728.patch 5 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 6 | #patch -p1 < patches/patch-cpuidle-4.0.patch 7 | 8 | # sgmii mvneta 9 | #patch -p1 < patches/patch-inband-status_1.patch 10 | #patch -p1 < patches/patch-inband-status_2.patch 11 | #patch -p1 < patches/patch-inband-status_3.patch 12 | #patch -p1 < patches/patch-inband-status_4.patch 13 | #patch -p1 < patches/patch-mvneta-DMA-buffer-unmapping.patch 14 | -------------------------------------------------------------------------------- /armv7l/4.8.14-docker/patch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | KVER=4.8 /bin/bash -x patches/patch_aufs.bash 4 | 5 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 6 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 7 | -------------------------------------------------------------------------------- /armv7l/4.8.14-fedora/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | #patch -p1 < patches/patch-cve-2016-0728.patch 5 | 6 | #patch -p1 < patches/patch-cpuidle-4.0.patch 7 | #patch -p1 < patches/0001-ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch 8 | 9 | # sgmii mvneta 10 | #patch -p1 < patches/patch-inband-status_1.patch 11 | #patch -p1 < patches/patch-inband-status_2.patch 12 | #patch -p1 < patches/patch-inband-status_3.patch 13 | #patch -p1 < patches/patch-inband-status_4.patch 14 | #patch -p1 < patches/patch-mvneta-DMA-buffer-unmapping.patch 15 | -------------------------------------------------------------------------------- /armv7l/4.8.14-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | #patch -p1 < patches/patch-cve-2016-0728.patch 5 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 6 | #patch -p1 < patches/patch-cpuidle-4.0.patch 7 | 8 | # sgmii mvneta 9 | #patch -p1 < patches/patch-inband-status_1.patch 10 | #patch -p1 < patches/patch-inband-status_2.patch 11 | #patch -p1 < patches/patch-inband-status_3.patch 12 | #patch -p1 < patches/patch-inband-status_4.patch 13 | #patch -p1 < patches/patch-mvneta-DMA-buffer-unmapping.patch 14 | -------------------------------------------------------------------------------- /armv7l/4.9.20-docker/patch.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | KVER=4.9 /bin/bash -x patches/patch_aufs.bash 4 | 5 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 6 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 7 | -------------------------------------------------------------------------------- /armv7l/4.9.20-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 4 | git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 5 | -------------------------------------------------------------------------------- /armv7l/README.md: -------------------------------------------------------------------------------- 1 | # `armv7l` kernel images 2 | 3 | ## Supported architectures: 4 | 5 | * Scaleway' C1 servers 6 | * Online.net' Pibox 7 | * `qemu-system-arm` 8 | -------------------------------------------------------------------------------- /armv7l/include.mk: -------------------------------------------------------------------------------- 1 | ARCH_CONFIG ?= mvebu_v7 2 | 3 | DOCKER_ENV ?= -e LOADADDR=0x8000 \ 4 | -e CONCURRENCY_LEVEL=$(CONCURRENCY_LEVEL) \ 5 | -e ARCH=arm \ 6 | -e CROSS_COMPILE="ccache arm-linux-gnueabihf-" \ 7 | -e KERNEL_ARCH=$(KERNEL_ARCH) \ 8 | -e KBUILD_BUILD_USER=$(KBUILD_BUILD_USER) \ 9 | -e KBUILD_BUILD_HOST=$(KBUILD_BUILD_HOST) \ 10 | -e LOCALVERSION=$(LOCALVERSION) 11 | 12 | DOCKER_VOLUMES ?= -v $(PWD)/$(KERNEL)/.config:/tmp/.config \ 13 | -v $(PWD)/dist/$(KERNEL_FULL):$(LINUX_PATH)/build/ \ 14 | -v $(CCACHE_DIR):/ccache \ 15 | -v $(PWD)/patches:$(LINUX_PATH)/patches:rw \ 16 | -v $(PWD)/$(KERNEL)/patch.sh:$(LINUX_PATH)/patches-apply.sh:ro \ 17 | -v $(PWD)/rules.mk:$(LINUX_PATH)/rules.mk:ro \ 18 | -v $(PWD)/dtbs/scaleway-c1.dts:$(LINUX_PATH)/arch/arm/boot/dts/scaleway-c1.dts:ro 19 | 20 | qemu: 21 | qemu-system-arm \ 22 | -M versatilepb \ 23 | -m 256 \ 24 | -initrd ./dist/$(KERNEL_FULL)/initrd.img-* \ 25 | -kernel ./dist/$(KERNEL_FULL)/uImage-* \ 26 | -append "console=tty1" 27 | -------------------------------------------------------------------------------- /bitrig/bitrig-bsd/README.md: -------------------------------------------------------------------------------- 1 | # BSD kernel on Scaleway 2 | 3 | :warning: *Still in development* :warning: 4 | 5 | The [Bitrig](https://www.bitrig.org) team is working on Scaleway support 6 | 7 | ## Related links: 8 | 9 | - https://github.com/bitrig/bitrig/issues/64 10 | - https://github.com/bitrig/bitrig/issues/65 11 | -------------------------------------------------------------------------------- /bitrig/bitrig-bsd/dtb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/bitrig/bitrig-bsd/dtb -------------------------------------------------------------------------------- /dtbs/scaleway-c1.dts: -------------------------------------------------------------------------------- 1 | /* 2 | * Device Tree file for Online-Labs C1 Computing 3 | * 4 | * Copyright (C) 2012-2014 Marvell 5 | * Copyright (C) 2014-2015 Scaleway 6 | * 7 | * Lior Amsalem 8 | * Gregory CLEMENT 9 | * Thomas Petazzoni 10 | * Manfred Touron 11 | * Vincent Auclair 12 | * 13 | * This file is licensed under the terms of the GNU General Public 14 | * License version 2. This program is licensed "as is" without any 15 | * warranty of any kind, whether express or implied. 16 | */ 17 | 18 | /dts-v1/; 19 | #include "armada-xp-mv78460.dtsi" 20 | 21 | / { 22 | model = "Scaleway - C1 Computing"; 23 | compatible = "marvell,axp-db", "marvell,armadaxp-mv78460", "marvell,armadaxp", "marvell,armada-370-xp"; 24 | 25 | chosen { 26 | bootargs = "console=ttyS0,9600 earlyprintk"; 27 | }; 28 | 29 | memory { 30 | device_type = "memory"; 31 | reg = <0 0x00000000 0 0x80000000>; /* 2 GB */ 32 | }; 33 | 34 | soc { 35 | ranges = ; 38 | 39 | devbus-bootcs { 40 | status = "okay"; 41 | 42 | /* Device Bus parameters are required */ 43 | 44 | /* Read parameters */ 45 | devbus,bus-width = <16>; 46 | devbus,turn-off-ps = <60000>; 47 | devbus,badr-skew-ps = <0>; 48 | devbus,acc-first-ps = <124000>; 49 | devbus,acc-next-ps = <248000>; 50 | devbus,rd-setup-ps = <0>; 51 | devbus,rd-hold-ps = <0>; 52 | 53 | /* Write parameters */ 54 | devbus,sync-enable = <0>; 55 | devbus,wr-high-ps = <60000>; 56 | devbus,wr-low-ps = <60000>; 57 | devbus,ale-wr-ps = <60000>; 58 | 59 | }; 60 | 61 | internal-regs { 62 | uart0: serial@12000 { 63 | status = "okay"; 64 | }; 65 | 66 | eth0: ethernet@70000 { 67 | status = "okay"; 68 | fixed-link = <1 1 1000 0 0>; 69 | phy-mode = "sgmii"; 70 | }; 71 | 72 | mvsdio@d4000 { 73 | pinctrl-0 = <&sdio_pins>; 74 | pinctrl-names = "default"; 75 | status = "okay"; 76 | /* No CD or WP GPIOs */ 77 | broken-cd; 78 | }; 79 | 80 | }; 81 | }; 82 | aliases { 83 | ethernet0 = ð0; 84 | serial0 = &uart0; 85 | }; 86 | }; 87 | -------------------------------------------------------------------------------- /modules/scaleway-c1-soc-irq.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Scaleway C1 SoC IRQ handling 3 | * 4 | * Copyright (C) 2014-2015 Scaleway 5 | * 6 | * Manfred Touron 7 | * 8 | * This file is licensed under the terms of the GNU General Public 9 | * License version 2. This program is licensed "as is" without any 10 | * warranty of any kind, whether express or implied. 11 | */ 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #define SCALEWAYC1_GPIO_SWRESET 47 30 | #define SCALEWAYC1_GPIO_BOOTED 42 31 | 32 | static int g_irq = -1; 33 | static struct task_struct *task; 34 | static int need_reboot = 0; 35 | static atomic_t probe_count = ATOMIC_INIT(0); 36 | static DECLARE_WAIT_QUEUE_HEAD(probe_waitqueue); 37 | static void scalewayc1_reboot(void); 38 | 39 | static int scalewayc1_reboot_thread(void *arg) { 40 | /* block the thread and wait for a wakeup. 41 | wakeup is done in two cases: module unload and reset gpio state change */ 42 | wait_event_interruptible(probe_waitqueue, atomic_read(&probe_count) > 0); 43 | 44 | /* clean the counter */ 45 | atomic_dec(&probe_count); 46 | 47 | /* reboot if woke up from gpio state change */ 48 | if (need_reboot) { 49 | scalewayc1_reboot(); 50 | } 51 | 52 | return 0; 53 | } 54 | 55 | static void scalewayc1_reboot(void) { 56 | /* Call /sbin/reset */ 57 | char *argv[] = { 58 | "/sbin/init", 59 | "6", 60 | NULL 61 | }; 62 | char *envp[] = { 63 | "HOME=/", 64 | "PWD=/", 65 | "PATH=/sbin", 66 | NULL 67 | }; 68 | int ret; 69 | 70 | ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); 71 | if (!ret) { 72 | printk("Scaleway C1 SoC IRQ: Soft resetting\n"); 73 | } else { 74 | printk("Scaleway C1 SoC IRQ: cannot soft-reset\n"); 75 | } 76 | } 77 | 78 | static irqreturn_t scalewayc1_irq_resethandler(int irq, void *dev_id) { 79 | /* handled when reset gpio state changed */ 80 | if (irq == g_irq) { 81 | need_reboot = 1; 82 | atomic_inc(&probe_count); 83 | wake_up(&probe_waitqueue); 84 | irq_clear_status_flags(irq, IRQ_LEVEL); 85 | } 86 | return IRQ_HANDLED; 87 | } 88 | 89 | static int __init scalewayc1gpio_init(void) { 90 | unsigned int gpio; 91 | int ret; 92 | 93 | printk(KERN_DEBUG "Scaleway C1 SoC IRQ: initializing\n"); 94 | 95 | /* create reboot thread */ 96 | task = kthread_create(scalewayc1_reboot_thread, NULL, "scaleway-c1-soc-irq"); 97 | if (IS_ERR(task)) { 98 | printk(KERN_ALERT "Scaleway C1 SoC IRQ: kthread_create error\n"); 99 | return -1; 100 | } 101 | wake_up_process(task); 102 | 103 | /* setup an irq that watch the reset gpio state */ 104 | gpio = SCALEWAYC1_GPIO_SWRESET; 105 | gpio_request(gpio, "softreset"); 106 | gpio_direction_input(gpio); 107 | g_irq = gpio_to_irq(gpio); 108 | irq_clear_status_flags(g_irq, IRQ_LEVEL); 109 | ret = request_any_context_irq(g_irq, scalewayc1_irq_resethandler, 110 | IRQF_TRIGGER_FALLING, "scaleway-c1", NULL); 111 | 112 | /* enable console, switch the booted gpio */ 113 | gpio = SCALEWAYC1_GPIO_BOOTED; 114 | gpio_request(gpio, "booted"); 115 | gpio_direction_output(gpio, 0); 116 | 117 | printk(KERN_INFO "Scaleway C1 SoC IRQ: initialized\n"); 118 | return 0; 119 | } 120 | 121 | static void __exit scalewayc1gpio_cleanup(void) { 122 | printk(KERN_DEBUG "Scaleway C1 SoC IRQ: cleaning\n"); 123 | 124 | /* terminate the thread */ 125 | need_reboot = 0; 126 | atomic_inc(&probe_count); 127 | wake_up(&probe_waitqueue); 128 | 129 | /* ensure free irq */ 130 | if (-1 == g_irq) { 131 | free_irq(g_irq, NULL); 132 | } 133 | 134 | /* free gpio */ 135 | gpio_free(SCALEWAYC1_GPIO_SWRESET); 136 | gpio_free(SCALEWAYC1_GPIO_BOOTED); 137 | 138 | printk(KERN_DEBUG "Scaleway SoC IRQ cleaned\n"); 139 | return; 140 | } 141 | 142 | module_init(scalewayc1gpio_init); 143 | module_exit(scalewayc1gpio_cleanup); 144 | 145 | MODULE_AUTHOR("Scaleway"); 146 | MODULE_DESCRIPTION("Scaleway - Scaleway C1 SoC IRQ"); 147 | MODULE_LICENSE("GPL"); 148 | -------------------------------------------------------------------------------- /patches/.gitignore: -------------------------------------------------------------------------------- 1 | aufs-aufs3-standalone 2 | aufs-aufs4-standalone -------------------------------------------------------------------------------- /patches/0001-add-new-dt-autoneg-property.patch: -------------------------------------------------------------------------------- 1 | 2 | 3 | Currently fixed_phy driver recognizes only the link-up state. 4 | This simple patch adds an implementation of link-down state. 5 | The actual change is 1-line, the rest is an indentation. 6 | 7 | Signed-off-by: Stas Sergeev 8 | 9 | CC: Florian Fainelli 10 | CC: netdev@vger.kernel.org 11 | CC: linux-kernel@vger.kernel.org 12 | --- 13 | drivers/net/phy/fixed_phy.c | 99 +++++++++++++++++++++++---------------------- 14 | 1 file changed, 50 insertions(+), 49 deletions(-) 15 | 16 | diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c 17 | index 1960b46..a5d93cf 100644 18 | --- a/drivers/net/phy/fixed_phy.c 19 | +++ b/drivers/net/phy/fixed_phy.c 20 | @@ -52,58 +52,59 @@ static int fixed_phy_update_regs(struct fixed_phy *fp) 21 | u16 lpagb = 0; 22 | u16 lpa = 0; 23 | 24 | - if (fp->status.duplex) { 25 | - bmcr |= BMCR_FULLDPLX; 26 | - 27 | - switch (fp->status.speed) { 28 | - case 1000: 29 | - bmsr |= BMSR_ESTATEN; 30 | - bmcr |= BMCR_SPEED1000; 31 | - lpagb |= LPA_1000FULL; 32 | - break; 33 | - case 100: 34 | - bmsr |= BMSR_100FULL; 35 | - bmcr |= BMCR_SPEED100; 36 | - lpa |= LPA_100FULL; 37 | - break; 38 | - case 10: 39 | - bmsr |= BMSR_10FULL; 40 | - lpa |= LPA_10FULL; 41 | - break; 42 | - default: 43 | - pr_warn("fixed phy: unknown speed\n"); 44 | - return -EINVAL; 45 | - } 46 | - } else { 47 | - switch (fp->status.speed) { 48 | - case 1000: 49 | - bmsr |= BMSR_ESTATEN; 50 | - bmcr |= BMCR_SPEED1000; 51 | - lpagb |= LPA_1000HALF; 52 | - break; 53 | - case 100: 54 | - bmsr |= BMSR_100HALF; 55 | - bmcr |= BMCR_SPEED100; 56 | - lpa |= LPA_100HALF; 57 | - break; 58 | - case 10: 59 | - bmsr |= BMSR_10HALF; 60 | - lpa |= LPA_10HALF; 61 | - break; 62 | - default: 63 | - pr_warn("fixed phy: unknown speed\n"); 64 | - return -EINVAL; 65 | - } 66 | - } 67 | - 68 | - if (fp->status.link) 69 | + if (fp->status.link) { 70 | bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE; 71 | 72 | - if (fp->status.pause) 73 | - lpa |= LPA_PAUSE_CAP; 74 | + if (fp->status.duplex) { 75 | + bmcr |= BMCR_FULLDPLX; 76 | + 77 | + switch (fp->status.speed) { 78 | + case 1000: 79 | + bmsr |= BMSR_ESTATEN; 80 | + bmcr |= BMCR_SPEED1000; 81 | + lpagb |= LPA_1000FULL; 82 | + break; 83 | + case 100: 84 | + bmsr |= BMSR_100FULL; 85 | + bmcr |= BMCR_SPEED100; 86 | + lpa |= LPA_100FULL; 87 | + break; 88 | + case 10: 89 | + bmsr |= BMSR_10FULL; 90 | + lpa |= LPA_10FULL; 91 | + break; 92 | + default: 93 | + pr_warn("fixed phy: unknown speed\n"); 94 | + return -EINVAL; 95 | + } 96 | + } else { 97 | + switch (fp->status.speed) { 98 | + case 1000: 99 | + bmsr |= BMSR_ESTATEN; 100 | + bmcr |= BMCR_SPEED1000; 101 | + lpagb |= LPA_1000HALF; 102 | + break; 103 | + case 100: 104 | + bmsr |= BMSR_100HALF; 105 | + bmcr |= BMCR_SPEED100; 106 | + lpa |= LPA_100HALF; 107 | + break; 108 | + case 10: 109 | + bmsr |= BMSR_10HALF; 110 | + lpa |= LPA_10HALF; 111 | + break; 112 | + default: 113 | + pr_warn("fixed phy: unknown speed\n"); 114 | + return -EINVAL; 115 | + } 116 | + } 117 | 118 | - if (fp->status.asym_pause) 119 | - lpa |= LPA_PAUSE_ASYM; 120 | + if (fp->status.pause) 121 | + lpa |= LPA_PAUSE_CAP; 122 | + 123 | + if (fp->status.asym_pause) 124 | + lpa |= LPA_PAUSE_ASYM; 125 | + } 126 | 127 | fp->regs[MII_PHYSID1] = 0; 128 | fp->regs[MII_PHYSID2] = 0; 129 | -- 130 | 1.9.1 131 | 132 | -------------------------------------------------------------------------------- /patches/0001-enable-hardware-I-O-coherency.patch: -------------------------------------------------------------------------------- 1 | From 8506fd73a9209560c7ee88aa7746ea55d3ebba1f Mon Sep 17 00:00:00 2001 2 | From: Manfred Touron 3 | Date: Thu, 5 Feb 2015 17:54:52 +0000 4 | Subject: [PATCH] enable hardware I/O coherency 5 | 6 | --- 7 | arch/arm/mach-mvebu/coherency.c | 6 ++---- 8 | 1 file changed, 2 insertions(+), 4 deletions(-) 9 | 10 | diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c 11 | index 1163a3e..b89ff27 100644 12 | --- a/arch/arm/mach-mvebu/coherency.c 13 | +++ b/arch/arm/mach-mvebu/coherency.c 14 | @@ -399,13 +399,11 @@ static int coherency_type(void) 15 | } 16 | 17 | /* 18 | - * As a precaution, we currently completely disable hardware I/O 19 | - * coherency, until enough testing is done with automatic I/O 20 | - * synchronization barriers to validate that it is a proper solution. 21 | + * Re-enabling hardware I/O coherency. 22 | */ 23 | int coherency_available(void) 24 | { 25 | - return false; 26 | + return true; 27 | } 28 | 29 | int __init coherency_init(void) 30 | -- 31 | 2.1.4 32 | 33 | -------------------------------------------------------------------------------- /patches/0001-fix-chained-per-cpu-interrupts.patch: -------------------------------------------------------------------------------- 1 | Cc: # 3.15+ 2 | Signed-off-by: Maxime Ripard 3 | --- 4 | Changes from v1: 5 | - Renamed the function and notifier names 6 | 7 | drivers/irqchip/irq-armada-370-xp.c | 21 ++++++++++++++++++++- 8 | 1 file changed, 20 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c 11 | index 463c235acbdc..4387dae14e45 100644 12 | --- a/drivers/irqchip/irq-armada-370-xp.c 13 | +++ b/drivers/irqchip/irq-armada-370-xp.c 14 | @@ -69,6 +69,7 @@ static void __iomem *per_cpu_int_base; 15 | static void __iomem *main_int_base; 16 | static struct irq_domain *armada_370_xp_mpic_domain; 17 | static u32 doorbell_mask_reg; 18 | +static int parent_irq; 19 | #ifdef CONFIG_PCI_MSI 20 | static struct irq_domain *armada_370_xp_msi_domain; 21 | static DECLARE_BITMAP(msi_used, PCI_MSI_DOORBELL_NR); 22 | @@ -356,6 +357,7 @@ static int armada_xp_mpic_secondary_init(struct notifier_block *nfb, 23 | { 24 | if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) 25 | armada_xp_mpic_smp_cpu_init(); 26 | + 27 | return NOTIFY_OK; 28 | } 29 | 30 | @@ -364,6 +366,20 @@ static struct notifier_block armada_370_xp_mpic_cpu_notifier = { 31 | .priority = 100, 32 | }; 33 | 34 | +static int mpic_cascaded_secondary_init(struct notifier_block *nfb, 35 | + unsigned long action, void *hcpu) 36 | +{ 37 | + if (action == CPU_STARTING || action == CPU_STARTING_FROZEN) 38 | + enable_percpu_irq(parent_irq, IRQ_TYPE_NONE); 39 | + 40 | + return NOTIFY_OK; 41 | +} 42 | + 43 | +static struct notifier_block mpic_cascaded_cpu_notifier = { 44 | + .notifier_call = mpic_cascaded_secondary_init, 45 | + .priority = 100, 46 | +}; 47 | + 48 | #endif /* CONFIG_SMP */ 49 | 50 | static struct irq_domain_ops armada_370_xp_mpic_irq_ops = { 51 | @@ -539,7 +555,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, 52 | struct device_node *parent) 53 | { 54 | struct resource main_int_res, per_cpu_int_res; 55 | - int parent_irq, nr_irqs, i; 56 | + int nr_irqs, i; 57 | u32 control; 58 | 59 | BUG_ON(of_address_to_resource(node, 0, &main_int_res)); 60 | @@ -587,6 +603,9 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node, 61 | register_cpu_notifier(&armada_370_xp_mpic_cpu_notifier); 62 | #endif 63 | } else { 64 | +#ifdef CONFIG_SMP 65 | + register_cpu_notifier(&mpic_cascaded_cpu_notifier); 66 | +#endif 67 | irq_set_chained_handler(parent_irq, 68 | armada_370_xp_mpic_handle_cascade_irq); 69 | } 70 | -- 71 | 2.3.0 72 | -------------------------------------------------------------------------------- /patches/0001-net-mvneta-fix-TX-coalesce-interrupt-mode.patch: -------------------------------------------------------------------------------- 1 | From 01b23da3607dbce1d1abfe5b7f092de11ae327cf Mon Sep 17 00:00:00 2001 2 | From: Willy Tarreau 3 | Date: Sat, 25 Oct 2014 19:12:49 +0200 4 | Subject: net: mvneta: fix TX coalesce interrupt mode 5 | 6 | The mvneta driver sets the amount of Tx coalesce packets to 16 by 7 | default. Normally that does not cause any trouble since the driver 8 | uses a much larger Tx ring size (532 packets). But some sockets 9 | might run with very small buffers, much smaller than the equivalent 10 | of 16 packets. This is what ping is doing for example, by setting 11 | SNDBUF to 324 bytes rounded up to 2kB by the kernel. 12 | 13 | The problem is that there is no documented method to force a specific 14 | packet to emit an interrupt (eg: the last of the ring) nor is it 15 | possible to make the NIC emit an interrupt after a given delay. 16 | 17 | In this case, it causes trouble, because when ping sends packets over 18 | its raw socket, the few first packets leave the system, and the first 19 | 15 packets will be emitted without an IRQ being generated, so without 20 | the skbs being freed. And since the socket's buffer is small, there's 21 | no way to reach that amount of packets, and the ping ends up with 22 | "send: no buffer available" after sending 6 packets. Running with 3 23 | instances of ping in parallel is enough to hide the problem, because 24 | with 6 packets per instance, that's 18 packets total, which is enough 25 | to grant a Tx interrupt before all are sent. 26 | 27 | The original driver in the LSP kernel worked around this design flaw 28 | by using a software timer to clean up the Tx descriptors. This timer 29 | was slow and caused terrible network performance on some Tx-bound 30 | workloads (such as routing) but was enough to make tools like ping 31 | work correctly. 32 | 33 | Instead here, we simply set the packet counts before interrupt to 1. 34 | This ensures that each packet sent will produce an interrupt. NAPI 35 | takes care of coalescing interrupts since the interrupt is disabled 36 | once generated. 37 | 38 | No measurable performance impact nor CPU usage were observed on small 39 | nor large packets, including when saturating the link on Tx, and this 40 | fixes tools like ping which rely on too small a send buffer. 41 | 42 | This fix needs to be backported to stable kernels starting with 3.10. 43 | 44 | Signed-off-by: Willy Tarreau 45 | --- 46 | drivers/net/ethernet/marvell/mvneta.c | 2 +- 47 | 1 file changed, 1 insertion(+), 1 deletion(-) 48 | 49 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c 50 | index 4762994..35bfba7 100644 51 | --- a/drivers/net/ethernet/marvell/mvneta.c 52 | +++ b/drivers/net/ethernet/marvell/mvneta.c 53 | @@ -214,7 +214,7 @@ 54 | /* Various constants */ 55 | 56 | /* Coalescing */ 57 | -#define MVNETA_TXDONE_COAL_PKTS 16 58 | +#define MVNETA_TXDONE_COAL_PKTS 1 59 | #define MVNETA_RX_COAL_PKTS 32 60 | #define MVNETA_RX_COAL_USEC 100 61 | 62 | -- 63 | 1.7.12.2.21.g234cd45.dirty 64 | 65 | -------------------------------------------------------------------------------- /patches/0001-ntp-Fixup-adjtimex-freq-validation-on-32bit-systems.patch: -------------------------------------------------------------------------------- 1 | From 1079a4c2288cf33c13d2c6ca3e07d4039b1f39f0 Mon Sep 17 00:00:00 2001 2 | From: John Stultz 3 | Date: Mon, 2 Feb 2015 10:57:56 -0800 4 | Subject: [PATCH] ntp: Fixup adjtimex freq validation on 32bit systems 5 | 6 | Additional validation of adjtimex freq values to avoid 7 | potential multiplication overflows were added in commit 8 | 5e5aeb4367b (time: adjtimex: Validate the ADJ_FREQUENCY values) 9 | 10 | Unfortunately the patch used LONG_MAX/MIN instead of 11 | LLONG_MAX/MIN, which was fine on 64bit systems, but caused 12 | false positives on 32bit systems resulting in most direct 13 | frequency adjustments to fail w/ EINVAL. 14 | 15 | ntpd only does driect frequency adjustments at startup, 16 | so the issue was not easily observed there, but other sync 17 | applications like ptpd and chrony were more effected by 18 | the bug. 19 | 20 | Cc: Sasha Levin 21 | Reported-by: Josh Boyer 22 | Reported-by: George Joseph 23 | Signed-off-by: John Stultz 24 | --- 25 | kernel/time/ntp.c | 4 ++-- 26 | 1 file changed, 2 insertions(+), 2 deletions(-) 27 | 28 | diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c 29 | index 28bf91c..242774d 100644 30 | --- a/kernel/time/ntp.c 31 | +++ b/kernel/time/ntp.c 32 | @@ -634,9 +634,9 @@ int ntp_validate_timex(struct timex *txc) 33 | return -EPERM; 34 | 35 | if (txc->modes & ADJ_FREQUENCY) { 36 | - if (LONG_MIN / PPM_SCALE > txc->freq) 37 | + if (LLONG_MIN / PPM_SCALE > txc->freq) 38 | return -EINVAL; 39 | - if (LONG_MAX / PPM_SCALE < txc->freq) 40 | + if (LLONG_MAX / PPM_SCALE < txc->freq) 41 | return -EINVAL; 42 | } 43 | 44 | -- 45 | 1.9.1 46 | 47 | -------------------------------------------------------------------------------- /patches/0002-net-enable-inband.patch: -------------------------------------------------------------------------------- 1 | 2 | Currently for fixed-link the MAC driver decides whether to use the 3 | link status auto-negotiation or not. 4 | Unfortunately the auto-negotiation may not work when expected by 5 | the MAC driver. Sebastien Rannou explains: 6 | << Yes, I confirm that my HW does not generate an in-band status. AFAIK, it's 7 | a PHY that aggregates 4xSGMIIs to 1xQSGMII ; the MAC side of the PHY (with 8 | inband status) is connected to the switch through QSGMII, and in this context 9 | we are on the media side of the PHY. >> 10 | https://lkml.org/lkml/2015/7/10/206 11 | 12 | This patch introduces the new boolean property 'autoneg' that allows 13 | the user to request the auto-negotiation explicitly. 14 | 15 | Signed-off-by: Stas Sergeev 16 | 17 | CC: Rob Herring 18 | CC: Pawel Moll 19 | CC: Mark Rutland 20 | CC: Ian Campbell 21 | CC: Kumar Gala 22 | CC: Florian Fainelli 23 | CC: Grant Likely 24 | CC: devicetree@vger.kernel.org 25 | CC: linux-kernel@vger.kernel.org 26 | CC: netdev@vger.kernel.org 27 | --- 28 | .../devicetree/bindings/net/fixed-link.txt | 6 +++++- 29 | drivers/of/of_mdio.c | 23 ++++++++++++++++++++-- 30 | include/linux/of_mdio.h | 5 +++++ 31 | 3 files changed, 31 insertions(+), 3 deletions(-) 32 | 33 | diff --git a/Documentation/devicetree/bindings/net/fixed-link.txt b/Documentation/devicetree/bindings/net/fixed-link.txt 34 | index 82bf7e0..e2959a8 100644 35 | --- a/Documentation/devicetree/bindings/net/fixed-link.txt 36 | +++ b/Documentation/devicetree/bindings/net/fixed-link.txt 37 | @@ -9,8 +9,12 @@ Such a fixed link situation is described by creating a 'fixed-link' 38 | sub-node of the Ethernet MAC device node, with the following 39 | properties: 40 | 41 | +* 'autoneg' (boolean, optional), to enable the auto-negotiation of link 42 | + state. Auto-negotiation is MII protocol, HW and driver-specific and is 43 | + not supported in many cases, so use it only when you know what you do. 44 | * 'speed' (integer, mandatory), to indicate the link speed. Accepted 45 | - values are 10, 100 and 1000 46 | + values are 10, 100 and 1000. If the auto-negotiation is enabled, 47 | + 'speed' may not be set. It will then be auto-negotiated, if possible. 48 | * 'full-duplex' (boolean, optional), to indicate that full duplex is 49 | used. When absent, half duplex is assumed. 50 | * 'pause' (boolean, optional), to indicate that pause should be 51 | diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c 52 | index 1bd4305..12b2ede 100644 53 | --- a/drivers/of/of_mdio.c 54 | +++ b/drivers/of/of_mdio.c 55 | @@ -280,6 +280,22 @@ bool of_phy_is_fixed_link(struct device_node *np) 56 | } 57 | EXPORT_SYMBOL(of_phy_is_fixed_link); 58 | 59 | +bool of_phy_is_autoneg_link(struct device_node *np) 60 | +{ 61 | + struct device_node *dn; 62 | + bool ret; 63 | + 64 | + dn = of_get_child_by_name(np, "fixed-link"); 65 | + if (!dn) 66 | + return false; 67 | + 68 | + ret = of_property_read_bool(dn, "autoneg"); 69 | + 70 | + of_node_put(dn); 71 | + return ret; 72 | +} 73 | +EXPORT_SYMBOL(of_phy_is_autoneg_link); 74 | + 75 | int of_phy_register_fixed_link(struct device_node *np) 76 | { 77 | struct fixed_phy_status status = {}; 78 | @@ -291,10 +307,13 @@ int of_phy_register_fixed_link(struct device_node *np) 79 | /* New binding */ 80 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); 81 | if (fixed_link_node) { 82 | - status.link = 1; 83 | + bool autoneg = of_property_read_bool(fixed_link_node, 84 | + "autoneg"); 85 | + status.link = !autoneg; 86 | status.duplex = of_property_read_bool(fixed_link_node, 87 | "full-duplex"); 88 | - if (of_property_read_u32(fixed_link_node, "speed", &status.speed)) 89 | + if (of_property_read_u32(fixed_link_node, "speed", 90 | + &status.speed) != 0 && !autoneg) 91 | return -EINVAL; 92 | status.pause = of_property_read_bool(fixed_link_node, "pause"); 93 | status.asym_pause = of_property_read_bool(fixed_link_node, 94 | diff --git a/include/linux/of_mdio.h b/include/linux/of_mdio.h 95 | index d449018..647f348 100644 96 | --- a/include/linux/of_mdio.h 97 | +++ b/include/linux/of_mdio.h 98 | @@ -65,6 +65,7 @@ static inline struct mii_bus *of_mdio_find_bus(struct device_node *mdio_np) 99 | #if defined(CONFIG_OF) && defined(CONFIG_FIXED_PHY) 100 | extern int of_phy_register_fixed_link(struct device_node *np); 101 | extern bool of_phy_is_fixed_link(struct device_node *np); 102 | +extern bool of_phy_is_autoneg_link(struct device_node *np); 103 | #else 104 | static inline int of_phy_register_fixed_link(struct device_node *np) 105 | { 106 | @@ -74,6 +75,10 @@ static inline bool of_phy_is_fixed_link(struct device_node *np) 107 | { 108 | return false; 109 | } 110 | +static inline bool of_phy_is_autoneg_link(struct device_node *np) 111 | +{ 112 | + return false; 113 | +} 114 | #endif 115 | 116 | 117 | -- 118 | 1.9.1 119 | 120 | -------------------------------------------------------------------------------- /patches/0003-fixed-phy-handle-link-down.patch: -------------------------------------------------------------------------------- 1 | 2 | The commit 898b2970e2c9 ("mvneta: implement SGMII-based in-band link state 3 | signaling") implemented the link parameters auto-negotiation unconditionally. 4 | Unfortunately it appears that some HW that implements SGMII protocol, 5 | doesn't generate the inband status, so it is not possible to auto-negotiate 6 | anything with such HW. 7 | 8 | This patch enables the auto-negotiation only if the 'autoneg' DT property 9 | is set to 1. 10 | For old configurations where the 'autoneg' property is not specified, the 11 | default is to not use auto-negotiation. 12 | 13 | This patch fixes the following regression: 14 | https://lkml.org/lkml/2015/7/8/865 15 | and is therefore CCed to stable. 16 | 17 | Signed-off-by: Stas Sergeev 18 | 19 | CC: Thomas Petazzoni 20 | CC: netdev@vger.kernel.org 21 | CC: linux-kernel@vger.kernel.org 22 | CC: stable@vger.kernel.org 23 | --- 24 | drivers/net/ethernet/marvell/mvneta.c | 7 +++---- 25 | 1 file changed, 3 insertions(+), 4 deletions(-) 26 | 27 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c 28 | index 74176ec..d4c29a3 100644 29 | --- a/drivers/net/ethernet/marvell/mvneta.c 30 | +++ b/drivers/net/ethernet/marvell/mvneta.c 31 | @@ -3009,7 +3009,7 @@ static int mvneta_probe(struct platform_device *pdev) 32 | char hw_mac_addr[ETH_ALEN]; 33 | const char *mac_from; 34 | int phy_mode; 35 | - int fixed_phy = 0; 36 | + int autoneg_link = 0; 37 | int err; 38 | 39 | /* Our multiqueue support is not complete, so for now, only 40 | @@ -3043,7 +3043,7 @@ static int mvneta_probe(struct platform_device *pdev) 41 | dev_err(&pdev->dev, "cannot register fixed PHY\n"); 42 | goto err_free_irq; 43 | } 44 | - fixed_phy = 1; 45 | + autoneg_link = of_phy_is_autoneg_link(dn); 46 | 47 | /* In the case of a fixed PHY, the DT node associated 48 | * to the PHY is the Ethernet MAC DT node. 49 | @@ -3067,8 +3067,7 @@ static int mvneta_probe(struct platform_device *pdev) 50 | pp = netdev_priv(dev); 51 | pp->phy_node = phy_node; 52 | pp->phy_interface = phy_mode; 53 | - pp->use_inband_status = (phy_mode == PHY_INTERFACE_MODE_SGMII) && 54 | - fixed_phy; 55 | + pp->use_inband_status = autoneg_link; 56 | 57 | pp->clk = devm_clk_get(&pdev->dev, NULL); 58 | if (IS_ERR(pp->clk)) { 59 | -- 60 | 1.9.1 61 | 62 | -------------------------------------------------------------------------------- /patches/android/0001-These-patches-will-allow-the-Android-binder-driver-i.patch: -------------------------------------------------------------------------------- 1 | From db94061fc9d7ec0a8bb1aaf16c7372185b872214 Mon Sep 17 00:00:00 2001 2 | From: Joel Isaacson 3 | Date: Tue, 10 May 2016 08:13:29 +0000 4 | Subject: [PATCH 1/2] These patches will allow the Android binder driver ipc to 5 | be namespace aware. 6 | 7 | The changes are largely based on: 8 | 9 | http://comments.gmane.org/gmane.linux.kernel.containers/27240 10 | 11 | Only the "binder_proc" list has been converted which is sufficient to get basic 12 | namespace functionality. Many static variables are not yet namespace aware. 13 | The other static variables can be converted to be namespace aware without much 14 | difficulty in the same manner as "binder_proc". 15 | --- 16 | drivers/android/Kconfig | 1 + 17 | drivers/android/binder.c | 175 ++++++++++++++++++++++++++++++++------- 18 | drivers/staging/android/Kconfig | 13 +++ 19 | drivers/staging/android/Makefile | 5 ++ 20 | include/linux/ipc_namespace.h | 29 +++++++ 21 | ipc/namespace.c | 9 ++ 22 | ipc/util.c | 61 ++++++++++++++ 23 | ipc/util.h | 3 + 24 | 8 files changed, 266 insertions(+), 30 deletions(-) 25 | 26 | diff --git a/drivers/android/Kconfig b/drivers/android/Kconfig 27 | index bdfc6c6..a71bfef 100644 28 | --- a/drivers/android/Kconfig 29 | +++ b/drivers/android/Kconfig 30 | @@ -9,6 +9,7 @@ if ANDROID 31 | 32 | config ANDROID_BINDER_IPC 33 | bool "Android Binder IPC Driver" 34 | + select SYSVIPC 35 | depends on MMU 36 | default n 37 | ---help--- 38 | diff --git a/drivers/android/binder.c b/drivers/android/binder.c 39 | index 7d00b7a..92e0797 100644 40 | --- a/drivers/android/binder.c 41 | +++ b/drivers/android/binder.c 42 | @@ -36,6 +36,7 @@ 43 | #include 44 | #include 45 | #include 46 | +#include 47 | #include 48 | #include 49 | 50 | @@ -46,19 +47,101 @@ 51 | #include 52 | #include "binder_trace.h" 53 | 54 | +/* 55 | + * Patch applied from: 56 | + * http://comments.gmane.org/gmane.linux.kernel.containers/27240 57 | + * 58 | + * Using a private context manager for each binder namespace is sufficient 59 | + * to isolate between namespaces, because in binder all IPC must be realized 60 | + * via hanldes obtained from the context manager. 61 | + * 62 | + * TODO: currently, most debugfs data is not tracked per binder namespaces. 63 | + * Except for "procs" which are properly virtualized, everything else is 64 | + * global, including stats, logs, and dead nodes. 65 | + */ 66 | +struct binder_namespace { 67 | + struct kref kref; 68 | + 69 | + struct binder_node *context_mgr_node; 70 | + kuid_t context_mgr_uid; 71 | + int last_id; 72 | + 73 | + struct hlist_head procs; 74 | +}; 75 | + 76 | +static struct binder_namespace *create_binder_ns(void) 77 | +{ 78 | + struct binder_namespace *binder_ns; 79 | + 80 | + binder_ns = kzalloc(sizeof(struct binder_namespace), GFP_KERNEL); 81 | + if (binder_ns) { 82 | + kref_init(&binder_ns->kref); 83 | + binder_ns->context_mgr_uid = INVALID_UID; 84 | + INIT_HLIST_HEAD(&binder_ns->procs); 85 | + } 86 | + return binder_ns; 87 | +} 88 | + 89 | +static void free_binder_ns(struct kref *kref) 90 | +{ 91 | + kfree(container_of(kref, struct binder_namespace, kref)); 92 | +} 93 | + 94 | +static void get_binder_ns(struct binder_namespace *binder_ns) 95 | +{ 96 | + kref_get(&binder_ns->kref); 97 | +} 98 | + 99 | +static void put_binder_ns(struct binder_namespace *binder_ns) 100 | +{ 101 | + kref_put(&binder_ns->kref, free_binder_ns); 102 | +} 103 | + 104 | +/* 105 | + * Binder is an IPC mechanism, so tie its namespace to IPC_NS 106 | + * using the generic data pointer and per-ipc operations. 107 | + */ 108 | +static struct binder_namespace *current_binder_ns(void) 109 | +{ 110 | + return ipc_access_generic(current->nsproxy->ipc_ns); 111 | +} 112 | + 113 | +int binder_init_ns(struct ipc_namespace *ipcns) 114 | +{ 115 | + struct binder_namespace *binder_ns; 116 | + int ret = -ENOMEM; 117 | + 118 | + binder_ns = create_binder_ns(); 119 | + if (binder_ns) { 120 | + ipc_assign_generic(ipcns, binder_ns); 121 | + ret = 0; 122 | + } 123 | + return ret; 124 | +} 125 | + 126 | +void binder_exit_ns(struct ipc_namespace *ipcns) 127 | +{ 128 | + struct binder_namespace *binder_ns; 129 | + 130 | + binder_ns = ipc_access_generic(ipcns); 131 | + if (binder_ns) 132 | + put_binder_ns(binder_ns); 133 | +} 134 | + 135 | +struct peripc_operations binder_peripc_ops = { 136 | + .init = binder_init_ns, 137 | + .exit = binder_exit_ns, 138 | +}; 139 | + 140 | static DEFINE_MUTEX(binder_main_lock); 141 | static DEFINE_MUTEX(binder_deferred_lock); 142 | static DEFINE_MUTEX(binder_mmap_lock); 143 | 144 | -static HLIST_HEAD(binder_procs); 145 | static HLIST_HEAD(binder_deferred_list); 146 | static HLIST_HEAD(binder_dead_nodes); 147 | 148 | static struct dentry *binder_debugfs_dir_entry_root; 149 | static struct dentry *binder_debugfs_dir_entry_proc; 150 | -static struct binder_node *binder_context_mgr_node; 151 | -static kuid_t binder_context_mgr_uid = INVALID_UID; 152 | -static int binder_last_id; 153 | static struct workqueue_struct *binder_deferred_workqueue; 154 | 155 | #define BINDER_DEBUG_ENTRY(name) \ 156 | @@ -326,6 +409,8 @@ struct binder_proc { 157 | int ready_threads; 158 | long default_priority; 159 | struct dentry *debugfs_entry; 160 | + 161 | + struct binder_namespace *binder_ns; 162 | }; 163 | 164 | enum { 165 | @@ -909,7 +994,7 @@ static struct binder_node *binder_new_node(struct binder_proc *proc, 166 | binder_stats_created(BINDER_STAT_NODE); 167 | rb_link_node(&node->rb_node, parent, p); 168 | rb_insert_color(&node->rb_node, &proc->nodes); 169 | - node->debug_id = ++binder_last_id; 170 | + node->debug_id = ++proc->binder_ns->last_id; 171 | node->proc = proc; 172 | node->ptr = ptr; 173 | node->cookie = cookie; 174 | @@ -930,7 +1015,7 @@ static int binder_inc_node(struct binder_node *node, int strong, int internal, 175 | if (internal) { 176 | if (target_list == NULL && 177 | node->internal_strong_refs == 0 && 178 | - !(node == binder_context_mgr_node && 179 | + !(node == node->proc->binder_ns->context_mgr_node && 180 | node->has_strong_ref)) { 181 | pr_err("invalid inc strong node for %d\n", 182 | node->debug_id); 183 | @@ -1044,13 +1129,13 @@ static struct binder_ref *binder_get_ref_for_node(struct binder_proc *proc, 184 | if (new_ref == NULL) 185 | return NULL; 186 | binder_stats_created(BINDER_STAT_REF); 187 | - new_ref->debug_id = ++binder_last_id; 188 | + new_ref->debug_id = ++proc->binder_ns->last_id; 189 | new_ref->proc = proc; 190 | new_ref->node = node; 191 | rb_link_node(&new_ref->rb_node_node, parent, p); 192 | rb_insert_color(&new_ref->rb_node_node, &proc->refs_by_node); 193 | 194 | - new_ref->desc = (node == binder_context_mgr_node) ? 0 : 1; 195 | + new_ref->desc = (node == proc->binder_ns->context_mgr_node) ? 0 : 1; 196 | for (n = rb_first(&proc->refs_by_desc); n != NULL; n = rb_next(n)) { 197 | ref = rb_entry(n, struct binder_ref, rb_node_desc); 198 | if (ref->desc > new_ref->desc) 199 | @@ -1389,7 +1474,7 @@ static void binder_transaction(struct binder_proc *proc, 200 | } 201 | target_node = ref->node; 202 | } else { 203 | - target_node = binder_context_mgr_node; 204 | + target_node = proc->binder_ns->context_mgr_node; 205 | if (target_node == NULL) { 206 | return_error = BR_DEAD_REPLY; 207 | goto err_no_context_mgr_node; 208 | @@ -1451,7 +1536,7 @@ static void binder_transaction(struct binder_proc *proc, 209 | } 210 | binder_stats_created(BINDER_STAT_TRANSACTION_COMPLETE); 211 | 212 | - t->debug_id = ++binder_last_id; 213 | + t->debug_id = ++proc->binder_ns->last_id; 214 | e->debug_id = t->debug_id; 215 | 216 | if (reply) 217 | @@ -1784,10 +1869,10 @@ static int binder_thread_write(struct binder_proc *proc, 218 | if (get_user(target, (uint32_t __user *)ptr)) 219 | return -EFAULT; 220 | ptr += sizeof(uint32_t); 221 | - if (target == 0 && binder_context_mgr_node && 222 | + if (target == 0 && proc->binder_ns->context_mgr_node && 223 | (cmd == BC_INCREFS || cmd == BC_ACQUIRE)) { 224 | ref = binder_get_ref_for_node(proc, 225 | - binder_context_mgr_node); 226 | + proc->binder_ns->context_mgr_node); 227 | if (ref->desc != target) { 228 | binder_user_error("%d:%d tried to acquire reference to desc 0, got %d instead\n", 229 | proc->pid, thread->pid, 230 | @@ -2691,9 +2776,10 @@ static int binder_ioctl_set_ctx_mgr(struct file *filp) 231 | { 232 | int ret = 0; 233 | struct binder_proc *proc = filp->private_data; 234 | + struct binder_namespace *binder_ns = proc->binder_ns; 235 | kuid_t curr_euid = current_euid(); 236 | 237 | - if (binder_context_mgr_node != NULL) { 238 | + if (binder_ns->context_mgr_node != NULL) { 239 | pr_err("BINDER_SET_CONTEXT_MGR already set\n"); 240 | ret = -EBUSY; 241 | goto out; 242 | @@ -2701,27 +2787,27 @@ static int binder_ioctl_set_ctx_mgr(struct file *filp) 243 | ret = security_binder_set_context_mgr(proc->tsk); 244 | if (ret < 0) 245 | goto out; 246 | - if (uid_valid(binder_context_mgr_uid)) { 247 | - if (!uid_eq(binder_context_mgr_uid, curr_euid)) { 248 | + if (uid_valid(binder_ns->context_mgr_uid)) { 249 | + if (!uid_eq(binder_ns->context_mgr_uid, curr_euid)) { 250 | pr_err("BINDER_SET_CONTEXT_MGR bad uid %d != %d\n", 251 | from_kuid(&init_user_ns, curr_euid), 252 | from_kuid(&init_user_ns, 253 | - binder_context_mgr_uid)); 254 | + binder_ns->context_mgr_uid)); 255 | ret = -EPERM; 256 | goto out; 257 | } 258 | } else { 259 | - binder_context_mgr_uid = curr_euid; 260 | + binder_ns->context_mgr_uid = curr_euid; 261 | } 262 | - binder_context_mgr_node = binder_new_node(proc, 0, 0); 263 | - if (binder_context_mgr_node == NULL) { 264 | + binder_ns->context_mgr_node = binder_new_node(proc, 0, 0); 265 | + if (binder_ns->context_mgr_node == NULL) { 266 | ret = -ENOMEM; 267 | goto out; 268 | } 269 | - binder_context_mgr_node->local_weak_refs++; 270 | - binder_context_mgr_node->local_strong_refs++; 271 | - binder_context_mgr_node->has_strong_ref = 1; 272 | - binder_context_mgr_node->has_weak_ref = 1; 273 | + binder_ns->context_mgr_node->local_weak_refs++; 274 | + binder_ns->context_mgr_node->local_strong_refs++; 275 | + binder_ns->context_mgr_node->has_strong_ref = 1; 276 | + binder_ns->context_mgr_node->has_weak_ref = 1; 277 | out: 278 | return ret; 279 | } 280 | @@ -2942,10 +3028,15 @@ err_bad_arg: 281 | static int binder_open(struct inode *nodp, struct file *filp) 282 | { 283 | struct binder_proc *proc; 284 | + struct binder_namespace *binder_ns; 285 | 286 | binder_debug(BINDER_DEBUG_OPEN_CLOSE, "binder_open: %d:%d\n", 287 | current->group_leader->pid, current->pid); 288 | 289 | + binder_ns = current_binder_ns(); 290 | + if (binder_ns == NULL) 291 | + return -ENOMEM; 292 | + 293 | proc = kzalloc(sizeof(*proc), GFP_KERNEL); 294 | if (proc == NULL) 295 | return -ENOMEM; 296 | @@ -2955,10 +3046,13 @@ static int binder_open(struct inode *nodp, struct file *filp) 297 | init_waitqueue_head(&proc->wait); 298 | proc->default_priority = task_nice(current); 299 | 300 | + proc->binder_ns = binder_ns; 301 | + get_binder_ns(binder_ns); 302 | + 303 | binder_lock(__func__); 304 | 305 | binder_stats_created(BINDER_STAT_PROC); 306 | - hlist_add_head(&proc->proc_node, &binder_procs); 307 | + hlist_add_head(&proc->proc_node, &binder_ns->procs); 308 | proc->pid = current->group_leader->pid; 309 | INIT_LIST_HEAD(&proc->delivered_death); 310 | filp->private_data = proc; 311 | @@ -3062,6 +3156,7 @@ static int binder_node_release(struct binder_node *node, int refs) 312 | 313 | static void binder_deferred_release(struct binder_proc *proc) 314 | { 315 | + struct binder_namespace *binder_ns = proc->binder_ns; 316 | struct binder_transaction *t; 317 | struct rb_node *n; 318 | int threads, nodes, incoming_refs, outgoing_refs, buffers, 319 | @@ -3072,11 +3167,12 @@ static void binder_deferred_release(struct binder_proc *proc) 320 | 321 | hlist_del(&proc->proc_node); 322 | 323 | - if (binder_context_mgr_node && binder_context_mgr_node->proc == proc) { 324 | + if (binder_ns->context_mgr_node && 325 | + binder_ns->context_mgr_node->proc == proc) { 326 | binder_debug(BINDER_DEBUG_DEAD_BINDER, 327 | "%s: %d context_mgr_node gone\n", 328 | __func__, proc->pid); 329 | - binder_context_mgr_node = NULL; 330 | + binder_ns->context_mgr_node = NULL; 331 | } 332 | 333 | threads = 0; 334 | @@ -3155,6 +3251,7 @@ static void binder_deferred_release(struct binder_proc *proc) 335 | vfree(proc->buffer); 336 | } 337 | 338 | + put_binder_ns(proc->binder_ns); 339 | put_task_struct(proc->tsk); 340 | 341 | binder_debug(BINDER_DEBUG_OPEN_CLOSE, 342 | @@ -3535,10 +3632,14 @@ static void print_binder_proc_stats(struct seq_file *m, 343 | 344 | static int binder_state_show(struct seq_file *m, void *unused) 345 | { 346 | + struct binder_namespace *binder_ns = current_binder_ns(); 347 | struct binder_proc *proc; 348 | struct binder_node *node; 349 | int do_lock = !binder_debug_no_lock; 350 | 351 | + if (binder_ns == NULL) 352 | + return 0; 353 | + 354 | if (do_lock) 355 | binder_lock(__func__); 356 | 357 | @@ -3549,7 +3650,7 @@ static int binder_state_show(struct seq_file *m, void *unused) 358 | hlist_for_each_entry(node, &binder_dead_nodes, dead_node) 359 | print_binder_node(m, node); 360 | 361 | - hlist_for_each_entry(proc, &binder_procs, proc_node) 362 | + hlist_for_each_entry(proc, &binder_ns->procs, proc_node) 363 | print_binder_proc(m, proc, 1); 364 | if (do_lock) 365 | binder_unlock(__func__); 366 | @@ -3558,9 +3659,13 @@ static int binder_state_show(struct seq_file *m, void *unused) 367 | 368 | static int binder_stats_show(struct seq_file *m, void *unused) 369 | { 370 | + struct binder_namespace *binder_ns = current_binder_ns(); 371 | struct binder_proc *proc; 372 | int do_lock = !binder_debug_no_lock; 373 | 374 | + if (binder_ns == NULL) 375 | + return 0; 376 | + 377 | if (do_lock) 378 | binder_lock(__func__); 379 | 380 | @@ -3568,7 +3673,7 @@ static int binder_stats_show(struct seq_file *m, void *unused) 381 | 382 | print_binder_stats(m, "", &binder_stats); 383 | 384 | - hlist_for_each_entry(proc, &binder_procs, proc_node) 385 | + hlist_for_each_entry(proc, &binder_ns->procs, proc_node) 386 | print_binder_proc_stats(m, proc); 387 | if (do_lock) 388 | binder_unlock(__func__); 389 | @@ -3577,14 +3682,18 @@ static int binder_stats_show(struct seq_file *m, void *unused) 390 | 391 | static int binder_transactions_show(struct seq_file *m, void *unused) 392 | { 393 | + struct binder_namespace *binder_ns = current_binder_ns(); 394 | struct binder_proc *proc; 395 | int do_lock = !binder_debug_no_lock; 396 | 397 | + if (binder_ns == NULL) 398 | + return 0; 399 | + 400 | if (do_lock) 401 | binder_lock(__func__); 402 | 403 | seq_puts(m, "binder transactions:\n"); 404 | - hlist_for_each_entry(proc, &binder_procs, proc_node) 405 | + hlist_for_each_entry(proc, &binder_ns->procs, proc_node) 406 | print_binder_proc(m, proc, 0); 407 | if (do_lock) 408 | binder_unlock(__func__); 409 | @@ -3656,9 +3765,15 @@ static int __init binder_init(void) 410 | { 411 | int ret; 412 | 413 | + ret = register_peripc_ops(&binder_peripc_ops); 414 | + if (ret < 0) 415 | + return ret; 416 | + 417 | binder_deferred_workqueue = create_singlethread_workqueue("binder"); 418 | - if (!binder_deferred_workqueue) 419 | + if (!binder_deferred_workqueue) { 420 | + unregister_peripc_ops(&binder_peripc_ops); 421 | return -ENOMEM; 422 | + } 423 | 424 | binder_debugfs_dir_entry_root = debugfs_create_dir("binder", NULL); 425 | if (binder_debugfs_dir_entry_root) 426 | diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig 427 | index 42b1512..5927e79 100644 428 | --- a/drivers/staging/android/Kconfig 429 | +++ b/drivers/staging/android/Kconfig 430 | @@ -38,6 +38,19 @@ config ANDROID_LOW_MEMORY_KILLER 431 | scripts (/init.rc), and it defines priority values with minimum free memory size 432 | for each priority. 433 | 434 | +config ANDROID_INTF_ALARM_DEV 435 | + tristate "Android alarm driver" 436 | + depends on RTC_CLASS 437 | + default n 438 | + ---help--- 439 | + Provides non-wakeup and rtc backed wakeup alarms based on rtc or 440 | + elapsed realtime, and a non-wakeup alarm on the monotonic clock. 441 | + Also exports the alarm interface to user-space. 442 | + 443 | + This device really isn't needed for versions of Android greater than Lollipop with 444 | + recent Linux kernels. It duplicates the driver in order to run multiple images of 445 | + Android in containers. 446 | + 447 | config SYNC 448 | bool "Synchronization framework" 449 | default n 450 | diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile 451 | index c7b6c99..3c0c144 100644 452 | --- a/drivers/staging/android/Makefile 453 | +++ b/drivers/staging/android/Makefile 454 | @@ -8,3 +8,8 @@ obj-$(CONFIG_ANDROID_TIMED_GPIO) += timed_gpio.o 455 | obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o 456 | obj-$(CONFIG_SYNC) += sync.o sync_debug.o 457 | obj-$(CONFIG_SW_SYNC) += sw_sync.o 458 | + 459 | +obj-$(CONFIG_ANDROID_INTF_ALARM_DEV) += alarm-dev.o 460 | +obj-$(CONFIG_ANDROID_INTF_ALARM_DEV) += alarm-dev2.o 461 | +obj-$(CONFIG_ANDROID_INTF_ALARM_DEV) += alarm-dev3.o 462 | +obj-$(CONFIG_ANDROID_INTF_ALARM_DEV) += alarm-dev4.o 463 | diff --git a/include/linux/ipc_namespace.h b/include/linux/ipc_namespace.h 464 | index 1eee6bc..c655fb6 100644 465 | --- a/include/linux/ipc_namespace.h 466 | +++ b/include/linux/ipc_namespace.h 467 | @@ -60,8 +60,37 @@ struct ipc_namespace { 468 | struct user_namespace *user_ns; 469 | 470 | struct ns_common ns; 471 | + 472 | + /* allow others to piggyback on ipc_namesspaces */ 473 | + void *gen; /* for others' private stuff */ 474 | }; 475 | 476 | +/* 477 | + * To access to the per-ipc generic data: 478 | + * 1. (un)register ops with (un)register_peripc_operations() 479 | + * 2. call ipc_assign_generic() to put private data on the ipc_namespace 480 | + * 3. call ipc_access_generic() to access the private data 481 | + * 4. do not change the pointer during the lifetime of ipc_namespace 482 | + * 483 | + * Modeled after generic net-ns pointers (commit dec827d), simplified for 484 | + * a single user case for now: 485 | + * 5. only one caller can register at a time 486 | + * 6. caller must register at boot time (not to be used by modules) 487 | + */ 488 | +struct peripc_operations { 489 | + int (*init)(struct ipc_namespace *); 490 | + void (*exit)(struct ipc_namespace *); 491 | + }; 492 | + 493 | +static inline void ipc_assign_generic(struct ipc_namespace *ns, void *data) 494 | +{ ns->gen = data; } 495 | + 496 | +static inline void *ipc_access_generic(struct ipc_namespace *ns) 497 | +{ return ns->gen; } 498 | + 499 | +extern int register_peripc_ops(struct peripc_operations *ops); 500 | +extern void unregister_peripc_ops(struct peripc_operations *ops); 501 | + 502 | extern struct ipc_namespace init_ipc_ns; 503 | extern atomic_t nr_ipc_ns; 504 | 505 | diff --git a/ipc/namespace.c b/ipc/namespace.c 506 | index 068caf1..35bcd3f 100644 507 | --- a/ipc/namespace.c 508 | +++ b/ipc/namespace.c 509 | @@ -34,6 +34,14 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, 510 | ns->ns.ops = &ipcns_operations; 511 | 512 | atomic_set(&ns->count, 1); 513 | + 514 | + err = init_peripc_ns(ns); 515 | + if (err) { 516 | + exit_peripc_ns(ns); 517 | + kfree(ns); 518 | + return ERR_PTR(err); 519 | + } 520 | + 521 | err = mq_init_ns(ns); 522 | if (err) { 523 | ns_free_inum(&ns->ns); 524 | @@ -95,6 +103,7 @@ static void free_ipc_ns(struct ipc_namespace *ns) 525 | sem_exit_ns(ns); 526 | msg_exit_ns(ns); 527 | shm_exit_ns(ns); 528 | + exit_peripc_ns(ns); 529 | atomic_dec(&nr_ipc_ns); 530 | 531 | put_user_ns(ns->user_ns); 532 | diff --git a/ipc/util.c b/ipc/util.c 533 | index 798cad1..b50c992 100644 534 | --- a/ipc/util.c 535 | +++ b/ipc/util.c 536 | @@ -71,6 +71,67 @@ struct ipc_proc_iface { 537 | int (*show)(struct seq_file *, void *); 538 | }; 539 | 540 | +/* allow others to piggyback on ipc_namespace */ 541 | +static DEFINE_MUTEX(peripc_mutex); 542 | +static struct peripc_operations *peripc_ops; 543 | + 544 | +/* 545 | + * peripc_operations is a simplified pernet_operations: 546 | + * - allow only one entity to register 547 | + * - allow to register only at boot time (no modules) 548 | + * (these assumptions make the code much simpler) 549 | + */ 550 | + 551 | +static int init_peripc_count; 552 | + 553 | +/* caller hold peripc_mutex */ 554 | +int init_peripc_ns(struct ipc_namespace *ns) 555 | +{ 556 | + int ret = 0; 557 | + 558 | + if (peripc_ops && peripc_ops->init) 559 | + ret = peripc_ops->init(ns); 560 | + if (ret == 0) 561 | + init_peripc_count++; 562 | + return ret; 563 | +} 564 | + 565 | +/* caller hold peripc_mutex */ 566 | +void exit_peripc_ns(struct ipc_namespace *ns) 567 | +{ 568 | + if (peripc_ops && peripc_ops->exit) 569 | + peripc_ops->exit(ns); 570 | + init_peripc_count--; 571 | +} 572 | + 573 | +int register_peripc_ops(struct peripc_operations *ops) 574 | +{ 575 | + int ret = -EBUSY; 576 | + 577 | + mutex_lock(&peripc_mutex); 578 | + /* must be first register, and only init ipc_namespace exists */ 579 | + if (peripc_ops == NULL && init_peripc_count == 0) { 580 | + peripc_ops = ops; 581 | + ret = init_peripc_ns(&init_ipc_ns); 582 | + if (ret < 0) 583 | + peripc_ops = NULL; 584 | + } 585 | + mutex_unlock(&peripc_mutex); 586 | + return ret; 587 | +} 588 | + 589 | +void unregister_peripc_ops(struct peripc_operations *ops) 590 | +{ 591 | + mutex_lock(&peripc_mutex); 592 | + /* sanity: be same as registered, and no other ipc ns (beyond init) */ 593 | + BUG_ON(peripc_ops != ops); 594 | + BUG_ON(init_peripc_count != 1); 595 | + if (ops->exit) 596 | + exit_peripc_ns(&init_ipc_ns); 597 | + peripc_ops = NULL; 598 | + mutex_unlock(&peripc_mutex); 599 | +} 600 | + 601 | /** 602 | * ipc_init - initialise ipc subsystem 603 | * 604 | diff --git a/ipc/util.h b/ipc/util.h 605 | index 51f7ca5..a0f1891 100644 606 | --- a/ipc/util.h 607 | +++ b/ipc/util.h 608 | @@ -47,6 +47,9 @@ static inline void msg_exit_ns(struct ipc_namespace *ns) { } 609 | static inline void shm_exit_ns(struct ipc_namespace *ns) { } 610 | #endif 611 | 612 | +int init_peripc_ns(struct ipc_namespace *ns); 613 | +void exit_peripc_ns(struct ipc_namespace *ns); 614 | + 615 | struct ipc_rcu { 616 | struct rcu_head rcu; 617 | atomic_t refcount; 618 | -- 619 | 2.7.4 620 | 621 | -------------------------------------------------------------------------------- /patches/android/0002-This-patch-is-not-really-needed-for-Android-Lollipop.patch: -------------------------------------------------------------------------------- 1 | From 7371fb33c4648e1451e6d58ddcbbe3b765566477 Mon Sep 17 00:00:00 2001 2 | From: Joel Isaacson 3 | Date: Tue, 10 May 2016 08:24:37 +0000 4 | Subject: [PATCH 2/2] This patch is not really needed for Android Lollipop and 5 | onward. Newer Android's can use the "timerfd" driver 6 | 7 | I have reintroduced the denigrated "alarm" driver for backwards compatibility. 8 | 9 | Instead of making the driver namespace aware, I just brutally replicated (ln -s) the driver 10 | so each containerized Android has its own alarm driver. This patch has four duplicate 11 | alarm drivers. 12 | --- 13 | drivers/staging/android/alarm-dev.c | 447 +++++++++++++++++++++++++++ 14 | drivers/staging/android/alarm-dev2.c | 1 + 15 | drivers/staging/android/alarm-dev3.c | 1 + 16 | drivers/staging/android/alarm-dev4.c | 1 + 17 | drivers/staging/android/android_alarm.h | 41 +++ 18 | drivers/staging/android/uapi/android_alarm.h | 62 ++++ 19 | 6 files changed, 553 insertions(+) 20 | create mode 100644 drivers/staging/android/alarm-dev.c 21 | create mode 120000 drivers/staging/android/alarm-dev2.c 22 | create mode 120000 drivers/staging/android/alarm-dev3.c 23 | create mode 120000 drivers/staging/android/alarm-dev4.c 24 | create mode 100644 drivers/staging/android/android_alarm.h 25 | create mode 100644 drivers/staging/android/uapi/android_alarm.h 26 | 27 | diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c 28 | new file mode 100644 29 | index 0000000..67383ca 30 | --- /dev/null 31 | +++ b/drivers/staging/android/alarm-dev.c 32 | @@ -0,0 +1,447 @@ 33 | +/* drivers/rtc/alarm-dev.c 34 | + * 35 | + * Copyright (C) 2007-2009 Google, Inc. 36 | + * 37 | + * This software is licensed under the terms of the GNU General Public 38 | + * License version 2, as published by the Free Software Foundation, and 39 | + * may be copied, distributed, and modified under those terms. 40 | + * 41 | + * This program is distributed in the hope that it will be useful, 42 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 43 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 44 | + * GNU General Public License for more details. 45 | + * 46 | + */ 47 | + 48 | +#include 49 | +#include 50 | +#include 51 | +#include 52 | +#include 53 | +#include 54 | +#include 55 | +#include 56 | +#include 57 | +#include 58 | +#include "android_alarm.h" 59 | + 60 | +#define ANDROID_ALARM_PRINT_INFO (1U << 0) 61 | +#define ANDROID_ALARM_PRINT_IO (1U << 1) 62 | +#define ANDROID_ALARM_PRINT_INT (1U << 2) 63 | + 64 | +static int debug_mask = ANDROID_ALARM_PRINT_INFO; 65 | +module_param_named(debug_mask, debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP); 66 | + 67 | +#define alarm_dbg(debug_level_mask, fmt, ...) \ 68 | +do { \ 69 | + if (debug_mask & ANDROID_ALARM_PRINT_##debug_level_mask) \ 70 | + pr_info(fmt, ##__VA_ARGS__); \ 71 | +} while (0) 72 | + 73 | +#define ANDROID_ALARM_WAKEUP_MASK ( \ 74 | + ANDROID_ALARM_RTC_WAKEUP_MASK | \ 75 | + ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK) 76 | + 77 | +static int alarm_opened; 78 | +static DEFINE_SPINLOCK(alarm_slock); 79 | +static struct wakeup_source alarm_wake_lock; 80 | +static DECLARE_WAIT_QUEUE_HEAD(alarm_wait_queue); 81 | +static uint32_t alarm_pending; 82 | +static uint32_t alarm_enabled; 83 | +static uint32_t wait_pending; 84 | + 85 | +struct devalarm { 86 | + union { 87 | + struct hrtimer hrt; 88 | + struct alarm alrm; 89 | + } u; 90 | + enum android_alarm_type type; 91 | +}; 92 | + 93 | +static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT]; 94 | + 95 | +/** 96 | + * is_wakeup() - Checks to see if this alarm can wake the device 97 | + * @type: The type of alarm being checked 98 | + * 99 | + * Return: 1 if this is a wakeup alarm, otherwise 0 100 | + */ 101 | +static int is_wakeup(enum android_alarm_type type) 102 | +{ 103 | + return type == ANDROID_ALARM_RTC_WAKEUP || 104 | + type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP; 105 | +} 106 | + 107 | +static void devalarm_start(struct devalarm *alrm, ktime_t exp) 108 | +{ 109 | + if (is_wakeup(alrm->type)) 110 | + alarm_start(&alrm->u.alrm, exp); 111 | + else 112 | + hrtimer_start(&alrm->u.hrt, exp, HRTIMER_MODE_ABS); 113 | +} 114 | + 115 | +static int devalarm_try_to_cancel(struct devalarm *alrm) 116 | +{ 117 | + if (is_wakeup(alrm->type)) 118 | + return alarm_try_to_cancel(&alrm->u.alrm); 119 | + return hrtimer_try_to_cancel(&alrm->u.hrt); 120 | +} 121 | + 122 | +static void devalarm_cancel(struct devalarm *alrm) 123 | +{ 124 | + if (is_wakeup(alrm->type)) 125 | + alarm_cancel(&alrm->u.alrm); 126 | + else 127 | + hrtimer_cancel(&alrm->u.hrt); 128 | +} 129 | + 130 | +static void alarm_clear(enum android_alarm_type alarm_type) 131 | +{ 132 | + uint32_t alarm_type_mask = 1U << alarm_type; 133 | + unsigned long flags; 134 | + 135 | + spin_lock_irqsave(&alarm_slock, flags); 136 | + alarm_dbg(IO, "alarm %d clear\n", alarm_type); 137 | + devalarm_try_to_cancel(&alarms[alarm_type]); 138 | + if (alarm_pending) { 139 | + alarm_pending &= ~alarm_type_mask; 140 | + if (!alarm_pending && !wait_pending) 141 | + __pm_relax(&alarm_wake_lock); 142 | + } 143 | + alarm_enabled &= ~alarm_type_mask; 144 | + spin_unlock_irqrestore(&alarm_slock, flags); 145 | +} 146 | + 147 | +static void alarm_set(enum android_alarm_type alarm_type, 148 | + struct timespec *ts) 149 | +{ 150 | + uint32_t alarm_type_mask = 1U << alarm_type; 151 | + unsigned long flags; 152 | + 153 | + spin_lock_irqsave(&alarm_slock, flags); 154 | + alarm_dbg(IO, "alarm %d set %ld.%09ld\n", 155 | + alarm_type, ts->tv_sec, ts->tv_nsec); 156 | + alarm_enabled |= alarm_type_mask; 157 | + devalarm_start(&alarms[alarm_type], timespec_to_ktime(*ts)); 158 | + spin_unlock_irqrestore(&alarm_slock, flags); 159 | +} 160 | + 161 | +static int alarm_wait(void) 162 | +{ 163 | + unsigned long flags; 164 | + int rv = 0; 165 | + 166 | + spin_lock_irqsave(&alarm_slock, flags); 167 | + alarm_dbg(IO, "alarm wait\n"); 168 | + if (!alarm_pending && wait_pending) { 169 | + __pm_relax(&alarm_wake_lock); 170 | + wait_pending = 0; 171 | + } 172 | + spin_unlock_irqrestore(&alarm_slock, flags); 173 | + 174 | + rv = wait_event_interruptible(alarm_wait_queue, alarm_pending); 175 | + if (rv) 176 | + return rv; 177 | + 178 | + spin_lock_irqsave(&alarm_slock, flags); 179 | + rv = alarm_pending; 180 | + wait_pending = 1; 181 | + alarm_pending = 0; 182 | + spin_unlock_irqrestore(&alarm_slock, flags); 183 | + 184 | + return rv; 185 | +} 186 | + 187 | +static int alarm_set_rtc(struct timespec *ts) 188 | +{ 189 | + struct rtc_time new_rtc_tm; 190 | + struct rtc_device *rtc_dev; 191 | + unsigned long flags; 192 | + int rv = 0; 193 | + 194 | + rtc_time_to_tm(ts->tv_sec, &new_rtc_tm); 195 | + rtc_dev = alarmtimer_get_rtcdev(); 196 | + rv = do_settimeofday(ts); 197 | + if (rv < 0) 198 | + return rv; 199 | + if (rtc_dev) 200 | + rv = rtc_set_time(rtc_dev, &new_rtc_tm); 201 | + 202 | + spin_lock_irqsave(&alarm_slock, flags); 203 | + alarm_pending |= ANDROID_ALARM_TIME_CHANGE_MASK; 204 | + wake_up(&alarm_wait_queue); 205 | + spin_unlock_irqrestore(&alarm_slock, flags); 206 | + 207 | + return rv; 208 | +} 209 | + 210 | +static int alarm_get_time(enum android_alarm_type alarm_type, 211 | + struct timespec *ts) 212 | +{ 213 | + int rv = 0; 214 | + 215 | + switch (alarm_type) { 216 | + case ANDROID_ALARM_RTC_WAKEUP: 217 | + case ANDROID_ALARM_RTC: 218 | + getnstimeofday(ts); 219 | + break; 220 | + case ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP: 221 | + case ANDROID_ALARM_ELAPSED_REALTIME: 222 | + get_monotonic_boottime(ts); 223 | + break; 224 | + case ANDROID_ALARM_SYSTEMTIME: 225 | + ktime_get_ts(ts); 226 | + break; 227 | + default: 228 | + rv = -EINVAL; 229 | + } 230 | + return rv; 231 | +} 232 | + 233 | +static long alarm_do_ioctl(struct file *file, unsigned int cmd, 234 | + struct timespec *ts) 235 | +{ 236 | + int rv = 0; 237 | + unsigned long flags; 238 | + enum android_alarm_type alarm_type = ANDROID_ALARM_IOCTL_TO_TYPE(cmd); 239 | + 240 | + if (alarm_type >= ANDROID_ALARM_TYPE_COUNT) 241 | + return -EINVAL; 242 | + 243 | + if (ANDROID_ALARM_BASE_CMD(cmd) != ANDROID_ALARM_GET_TIME(0)) { 244 | + if ((file->f_flags & O_ACCMODE) == O_RDONLY) 245 | + return -EPERM; 246 | + if (file->private_data == NULL && 247 | + cmd != ANDROID_ALARM_SET_RTC) { 248 | + spin_lock_irqsave(&alarm_slock, flags); 249 | + if (alarm_opened) { 250 | + spin_unlock_irqrestore(&alarm_slock, flags); 251 | + return -EBUSY; 252 | + } 253 | + alarm_opened = 1; 254 | + file->private_data = (void *)1; 255 | + spin_unlock_irqrestore(&alarm_slock, flags); 256 | + } 257 | + } 258 | + 259 | + switch (ANDROID_ALARM_BASE_CMD(cmd)) { 260 | + case ANDROID_ALARM_CLEAR(0): 261 | + alarm_clear(alarm_type); 262 | + break; 263 | + case ANDROID_ALARM_SET(0): 264 | + alarm_set(alarm_type, ts); 265 | + break; 266 | + case ANDROID_ALARM_SET_AND_WAIT(0): 267 | + alarm_set(alarm_type, ts); 268 | + /* fall though */ 269 | + case ANDROID_ALARM_WAIT: 270 | + rv = alarm_wait(); 271 | + break; 272 | + case ANDROID_ALARM_SET_RTC: 273 | + rv = alarm_set_rtc(ts); 274 | + break; 275 | + case ANDROID_ALARM_GET_TIME(0): 276 | + rv = alarm_get_time(alarm_type, ts); 277 | + break; 278 | + 279 | + default: 280 | + rv = -EINVAL; 281 | + } 282 | + return rv; 283 | +} 284 | + 285 | +static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 286 | +{ 287 | + 288 | + struct timespec ts; 289 | + int rv; 290 | + 291 | + switch (ANDROID_ALARM_BASE_CMD(cmd)) { 292 | + case ANDROID_ALARM_SET_AND_WAIT(0): 293 | + case ANDROID_ALARM_SET(0): 294 | + case ANDROID_ALARM_SET_RTC: 295 | + if (copy_from_user(&ts, (void __user *)arg, sizeof(ts))) 296 | + return -EFAULT; 297 | + break; 298 | + } 299 | + 300 | + rv = alarm_do_ioctl(file, cmd, &ts); 301 | + if (rv) 302 | + return rv; 303 | + 304 | + switch (ANDROID_ALARM_BASE_CMD(cmd)) { 305 | + case ANDROID_ALARM_GET_TIME(0): 306 | + if (copy_to_user((void __user *)arg, &ts, sizeof(ts))) 307 | + return -EFAULT; 308 | + break; 309 | + } 310 | + 311 | + return 0; 312 | +} 313 | + 314 | +#ifdef CONFIG_COMPAT 315 | +static long alarm_compat_ioctl(struct file *file, unsigned int cmd, 316 | + unsigned long arg) 317 | +{ 318 | + 319 | + struct timespec ts; 320 | + int rv; 321 | + 322 | + switch (ANDROID_ALARM_BASE_CMD(cmd)) { 323 | + case ANDROID_ALARM_SET_AND_WAIT_COMPAT(0): 324 | + case ANDROID_ALARM_SET_COMPAT(0): 325 | + case ANDROID_ALARM_SET_RTC_COMPAT: 326 | + if (compat_get_timespec(&ts, (void __user *)arg)) 327 | + return -EFAULT; 328 | + /* fall through */ 329 | + case ANDROID_ALARM_GET_TIME_COMPAT(0): 330 | + cmd = ANDROID_ALARM_COMPAT_TO_NORM(cmd); 331 | + break; 332 | + } 333 | + 334 | + rv = alarm_do_ioctl(file, cmd, &ts); 335 | + if (rv) 336 | + return rv; 337 | + 338 | + switch (ANDROID_ALARM_BASE_CMD(cmd)) { 339 | + case ANDROID_ALARM_GET_TIME(0): /* NOTE: we modified cmd above */ 340 | + if (compat_put_timespec(&ts, (void __user *)arg)) 341 | + return -EFAULT; 342 | + break; 343 | + } 344 | + 345 | + return 0; 346 | +} 347 | +#endif 348 | + 349 | +static int alarm_open(struct inode *inode, struct file *file) 350 | +{ 351 | + file->private_data = NULL; 352 | + return 0; 353 | +} 354 | + 355 | +static int alarm_release(struct inode *inode, struct file *file) 356 | +{ 357 | + int i; 358 | + unsigned long flags; 359 | + 360 | + spin_lock_irqsave(&alarm_slock, flags); 361 | + if (file->private_data) { 362 | + for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++) { 363 | + uint32_t alarm_type_mask = 1U << i; 364 | + 365 | + if (alarm_enabled & alarm_type_mask) { 366 | + alarm_dbg(INFO, 367 | + "%s: clear alarm, pending %d\n", 368 | + __func__, 369 | + !!(alarm_pending & alarm_type_mask)); 370 | + alarm_enabled &= ~alarm_type_mask; 371 | + } 372 | + spin_unlock_irqrestore(&alarm_slock, flags); 373 | + devalarm_cancel(&alarms[i]); 374 | + spin_lock_irqsave(&alarm_slock, flags); 375 | + } 376 | + if (alarm_pending | wait_pending) { 377 | + if (alarm_pending) 378 | + alarm_dbg(INFO, "%s: clear pending alarms %x\n", 379 | + __func__, alarm_pending); 380 | + __pm_relax(&alarm_wake_lock); 381 | + wait_pending = 0; 382 | + alarm_pending = 0; 383 | + } 384 | + alarm_opened = 0; 385 | + } 386 | + spin_unlock_irqrestore(&alarm_slock, flags); 387 | + return 0; 388 | +} 389 | + 390 | +static void devalarm_triggered(struct devalarm *alarm) 391 | +{ 392 | + unsigned long flags; 393 | + uint32_t alarm_type_mask = 1U << alarm->type; 394 | + 395 | + alarm_dbg(INT, "%s: type %d\n", __func__, alarm->type); 396 | + spin_lock_irqsave(&alarm_slock, flags); 397 | + if (alarm_enabled & alarm_type_mask) { 398 | + __pm_wakeup_event(&alarm_wake_lock, 5000); /* 5secs */ 399 | + alarm_enabled &= ~alarm_type_mask; 400 | + alarm_pending |= alarm_type_mask; 401 | + wake_up(&alarm_wait_queue); 402 | + } 403 | + spin_unlock_irqrestore(&alarm_slock, flags); 404 | +} 405 | + 406 | +static enum hrtimer_restart devalarm_hrthandler(struct hrtimer *hrt) 407 | +{ 408 | + struct devalarm *devalrm = container_of(hrt, struct devalarm, u.hrt); 409 | + 410 | + devalarm_triggered(devalrm); 411 | + return HRTIMER_NORESTART; 412 | +} 413 | + 414 | +static enum alarmtimer_restart devalarm_alarmhandler(struct alarm *alrm, 415 | + ktime_t now) 416 | +{ 417 | + struct devalarm *devalrm = container_of(alrm, struct devalarm, u.alrm); 418 | + 419 | + devalarm_triggered(devalrm); 420 | + return ALARMTIMER_NORESTART; 421 | +} 422 | + 423 | + 424 | +static const struct file_operations alarm_fops = { 425 | + .owner = THIS_MODULE, 426 | + .unlocked_ioctl = alarm_ioctl, 427 | + .open = alarm_open, 428 | + .release = alarm_release, 429 | +#ifdef CONFIG_COMPAT 430 | + .compat_ioctl = alarm_compat_ioctl, 431 | +#endif 432 | +}; 433 | + 434 | +static struct miscdevice alarm_device = { 435 | + .minor = MISC_DYNAMIC_MINOR, 436 | + // .name = "alarm", 437 | + .name = KBUILD_MODNAME, 438 | + .fops = &alarm_fops, 439 | +}; 440 | + 441 | +static int __init alarm_dev_init(void) 442 | +{ 443 | + int err; 444 | + int i; 445 | + 446 | + err = misc_register(&alarm_device); 447 | + if (err) 448 | + return err; 449 | + 450 | + alarm_init(&alarms[ANDROID_ALARM_RTC_WAKEUP].u.alrm, 451 | + ALARM_REALTIME, devalarm_alarmhandler); 452 | + hrtimer_init(&alarms[ANDROID_ALARM_RTC].u.hrt, 453 | + CLOCK_REALTIME, HRTIMER_MODE_ABS); 454 | + alarm_init(&alarms[ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP].u.alrm, 455 | + ALARM_BOOTTIME, devalarm_alarmhandler); 456 | + hrtimer_init(&alarms[ANDROID_ALARM_ELAPSED_REALTIME].u.hrt, 457 | + CLOCK_BOOTTIME, HRTIMER_MODE_ABS); 458 | + hrtimer_init(&alarms[ANDROID_ALARM_SYSTEMTIME].u.hrt, 459 | + CLOCK_MONOTONIC, HRTIMER_MODE_ABS); 460 | + 461 | + for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++) { 462 | + alarms[i].type = i; 463 | + if (!is_wakeup(i)) 464 | + alarms[i].u.hrt.function = devalarm_hrthandler; 465 | + } 466 | + 467 | + wakeup_source_init(&alarm_wake_lock, "alarm"); 468 | + return 0; 469 | +} 470 | + 471 | +static void __exit alarm_dev_exit(void) 472 | +{ 473 | + misc_deregister(&alarm_device); 474 | + wakeup_source_trash(&alarm_wake_lock); 475 | +} 476 | + 477 | +module_init(alarm_dev_init); 478 | +module_exit(alarm_dev_exit); 479 | +MODULE_LICENSE("GPL"); 480 | diff --git a/drivers/staging/android/alarm-dev2.c b/drivers/staging/android/alarm-dev2.c 481 | new file mode 120000 482 | index 0000000..b599c19 483 | --- /dev/null 484 | +++ b/drivers/staging/android/alarm-dev2.c 485 | @@ -0,0 +1 @@ 486 | +alarm-dev.c 487 | \ No newline at end of file 488 | diff --git a/drivers/staging/android/alarm-dev3.c b/drivers/staging/android/alarm-dev3.c 489 | new file mode 120000 490 | index 0000000..b599c19 491 | --- /dev/null 492 | +++ b/drivers/staging/android/alarm-dev3.c 493 | @@ -0,0 +1 @@ 494 | +alarm-dev.c 495 | \ No newline at end of file 496 | diff --git a/drivers/staging/android/alarm-dev4.c b/drivers/staging/android/alarm-dev4.c 497 | new file mode 120000 498 | index 0000000..b599c19 499 | --- /dev/null 500 | +++ b/drivers/staging/android/alarm-dev4.c 501 | @@ -0,0 +1 @@ 502 | +alarm-dev.c 503 | \ No newline at end of file 504 | diff --git a/drivers/staging/android/android_alarm.h b/drivers/staging/android/android_alarm.h 505 | new file mode 100644 506 | index 0000000..495b20c 507 | --- /dev/null 508 | +++ b/drivers/staging/android/android_alarm.h 509 | @@ -0,0 +1,41 @@ 510 | +/* include/linux/android_alarm.h 511 | + * 512 | + * Copyright (C) 2006-2007 Google, Inc. 513 | + * 514 | + * This software is licensed under the terms of the GNU General Public 515 | + * License version 2, as published by the Free Software Foundation, and 516 | + * may be copied, distributed, and modified under those terms. 517 | + * 518 | + * This program is distributed in the hope that it will be useful, 519 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 520 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 521 | + * GNU General Public License for more details. 522 | + * 523 | + */ 524 | + 525 | +#ifndef _LINUX_ANDROID_ALARM_H 526 | +#define _LINUX_ANDROID_ALARM_H 527 | + 528 | +#include 529 | +#include 530 | + 531 | +#include "uapi/android_alarm.h" 532 | + 533 | +#ifdef CONFIG_COMPAT 534 | +#define ANDROID_ALARM_SET_COMPAT(type) ALARM_IOW(2, type, \ 535 | + struct compat_timespec) 536 | +#define ANDROID_ALARM_SET_AND_WAIT_COMPAT(type) ALARM_IOW(3, type, \ 537 | + struct compat_timespec) 538 | +#define ANDROID_ALARM_GET_TIME_COMPAT(type) ALARM_IOW(4, type, \ 539 | + struct compat_timespec) 540 | +#define ANDROID_ALARM_SET_RTC_COMPAT _IOW('a', 5, \ 541 | + struct compat_timespec) 542 | +#define ANDROID_ALARM_IOCTL_NR(cmd) (_IOC_NR(cmd) & ((1<<4)-1)) 543 | +#define ANDROID_ALARM_COMPAT_TO_NORM(cmd) \ 544 | + ALARM_IOW(ANDROID_ALARM_IOCTL_NR(cmd), \ 545 | + ANDROID_ALARM_IOCTL_TO_TYPE(cmd), \ 546 | + struct timespec) 547 | + 548 | +#endif 549 | + 550 | +#endif 551 | diff --git a/drivers/staging/android/uapi/android_alarm.h b/drivers/staging/android/uapi/android_alarm.h 552 | new file mode 100644 553 | index 0000000..aa013f6 554 | --- /dev/null 555 | +++ b/drivers/staging/android/uapi/android_alarm.h 556 | @@ -0,0 +1,62 @@ 557 | +/* drivers/staging/android/uapi/android_alarm.h 558 | + * 559 | + * Copyright (C) 2006-2007 Google, Inc. 560 | + * 561 | + * This software is licensed under the terms of the GNU General Public 562 | + * License version 2, as published by the Free Software Foundation, and 563 | + * may be copied, distributed, and modified under those terms. 564 | + * 565 | + * This program is distributed in the hope that it will be useful, 566 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of 567 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 568 | + * GNU General Public License for more details. 569 | + * 570 | + */ 571 | + 572 | +#ifndef _UAPI_LINUX_ANDROID_ALARM_H 573 | +#define _UAPI_LINUX_ANDROID_ALARM_H 574 | + 575 | +#include 576 | +#include 577 | + 578 | +enum android_alarm_type { 579 | + /* return code bit numbers or set alarm arg */ 580 | + ANDROID_ALARM_RTC_WAKEUP, 581 | + ANDROID_ALARM_RTC, 582 | + ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP, 583 | + ANDROID_ALARM_ELAPSED_REALTIME, 584 | + ANDROID_ALARM_SYSTEMTIME, 585 | + 586 | + ANDROID_ALARM_TYPE_COUNT, 587 | + 588 | + /* return code bit numbers */ 589 | + /* ANDROID_ALARM_TIME_CHANGE = 16 */ 590 | +}; 591 | + 592 | +enum android_alarm_return_flags { 593 | + ANDROID_ALARM_RTC_WAKEUP_MASK = 1U << ANDROID_ALARM_RTC_WAKEUP, 594 | + ANDROID_ALARM_RTC_MASK = 1U << ANDROID_ALARM_RTC, 595 | + ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP_MASK = 596 | + 1U << ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP, 597 | + ANDROID_ALARM_ELAPSED_REALTIME_MASK = 598 | + 1U << ANDROID_ALARM_ELAPSED_REALTIME, 599 | + ANDROID_ALARM_SYSTEMTIME_MASK = 1U << ANDROID_ALARM_SYSTEMTIME, 600 | + ANDROID_ALARM_TIME_CHANGE_MASK = 1U << 16 601 | +}; 602 | + 603 | +/* Disable alarm */ 604 | +#define ANDROID_ALARM_CLEAR(type) _IO('a', 0 | ((type) << 4)) 605 | + 606 | +/* Ack last alarm and wait for next */ 607 | +#define ANDROID_ALARM_WAIT _IO('a', 1) 608 | + 609 | +#define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size) 610 | +/* Set alarm */ 611 | +#define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec) 612 | +#define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec) 613 | +#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec) 614 | +#define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec) 615 | +#define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0))) 616 | +#define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4) 617 | + 618 | +#endif 619 | -- 620 | 2.7.4 621 | 622 | -------------------------------------------------------------------------------- /patches/patch-cpuidle-3.17-std.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c 2 | index 45371bb..4fd92e3 100644 3 | --- a/drivers/cpuidle/cpuidle-mvebu-v7.c 4 | +++ b/drivers/cpuidle/cpuidle-mvebu-v7.c 5 | @@ -50,18 +50,18 @@ static struct cpuidle_driver armadaxp_idle_driver = { 6 | .states[0] = ARM_CPUIDLE_WFI_STATE, 7 | .states[1] = { 8 | .enter = mvebu_v7_enter_idle, 9 | - .exit_latency = 10, 10 | + .exit_latency = 100, 11 | .power_usage = 50, 12 | - .target_residency = 100, 13 | + .target_residency = 1000, 14 | .flags = CPUIDLE_FLAG_TIME_VALID, 15 | .name = "MV CPU IDLE", 16 | .desc = "CPU power down", 17 | }, 18 | .states[2] = { 19 | .enter = mvebu_v7_enter_idle, 20 | - .exit_latency = 100, 21 | + .exit_latency = 1000, 22 | .power_usage = 5, 23 | - .target_residency = 1000, 24 | + .target_residency = 10000, 25 | .flags = CPUIDLE_FLAG_TIME_VALID | 26 | MVEBU_V7_FLAG_DEEP_IDLE, 27 | .name = "MV CPU DEEP IDLE", 28 | -------------------------------------------------------------------------------- /patches/patch-cpuidle-3.19-std.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c 2 | index 38e6861..3716a1f 100644 3 | --- a/drivers/cpuidle/cpuidle-mvebu-v7.c 4 | +++ b/drivers/cpuidle/cpuidle-mvebu-v7.c 5 | @@ -50,17 +50,17 @@ static struct cpuidle_driver armadaxp_idle_driver = { 6 | .states[0] = ARM_CPUIDLE_WFI_STATE, 7 | .states[1] = { 8 | .enter = mvebu_v7_enter_idle, 9 | - .exit_latency = 10, 10 | + .exit_latency = 100, 11 | .power_usage = 50, 12 | - .target_residency = 100, 13 | + .target_residency = 1000, 14 | .name = "MV CPU IDLE", 15 | .desc = "CPU power down", 16 | }, 17 | .states[2] = { 18 | .enter = mvebu_v7_enter_idle, 19 | - .exit_latency = 100, 20 | + .exit_latency = 1000, 21 | .power_usage = 5, 22 | - .target_residency = 1000, 23 | + .target_residency = 10000, 24 | .flags = MVEBU_V7_FLAG_DEEP_IDLE, 25 | .name = "MV CPU DEEP IDLE", 26 | .desc = "CPU and L2 Fabric power down", 27 | -------------------------------------------------------------------------------- /patches/patch-cpuidle-4.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/cpuidle/cpuidle-mvebu-v7.c b/drivers/cpuidle/cpuidle-mvebu-v7.c 2 | index 38e6861..3716a1f 100644 3 | --- a/drivers/cpuidle/cpuidle-mvebu-v7.c 4 | +++ b/drivers/cpuidle/cpuidle-mvebu-v7.c 5 | @@ -50,17 +50,17 @@ static struct cpuidle_driver armadaxp_idle_driver = { 6 | .states[0] = ARM_CPUIDLE_WFI_STATE, 7 | .states[1] = { 8 | .enter = mvebu_v7_enter_idle, 9 | - .exit_latency = 10, 10 | + .exit_latency = 100, 11 | .power_usage = 50, 12 | - .target_residency = 100, 13 | + .target_residency = 1000, 14 | .name = "MV CPU IDLE", 15 | .desc = "CPU power down", 16 | }, 17 | .states[2] = { 18 | .enter = mvebu_v7_enter_idle, 19 | - .exit_latency = 100, 20 | + .exit_latency = 1000, 21 | .power_usage = 5, 22 | - .target_residency = 1000, 23 | + .target_residency = 10000, 24 | .flags = MVEBU_V7_FLAG_DEEP_IDLE, 25 | .name = "MV CPU DEEP IDLE", 26 | .desc = "CPU and L2 Fabric power down", 27 | -------------------------------------------------------------------------------- /patches/patch-cve-2016-0728.patch: -------------------------------------------------------------------------------- 1 | commit 5c65d8a9989a89901b87ad13a06011a9a0e3d828 2 | Author: Yevgeny Pats 3 | Date: Mon Jan 11 12:05:28 2016 +0000 4 | 5 | KEYS: Fix keyring ref leak in join_session_keyring() 6 | 7 | If a thread is asked to join as a session keyring the keyring that's already 8 | set as its session, we leak a keyring reference. 9 | 10 | This can be tested with the following program: 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | int main(int argc, const char *argv[]) 18 | { 19 | int i = 0; 20 | key_serial_t serial; 21 | 22 | serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING, 23 | "leaked-keyring"); 24 | if (serial < 0) { 25 | perror("keyctl"); 26 | return -1; 27 | } 28 | 29 | if (keyctl(KEYCTL_SETPERM, serial, 30 | KEY_POS_ALL | KEY_USR_ALL) < 0) { 31 | perror("keyctl"); 32 | return -1; 33 | } 34 | 35 | for (i = 0; i < 100; i++) { 36 | serial = keyctl(KEYCTL_JOIN_SESSION_KEYRING, 37 | "leaked-keyring"); 38 | if (serial < 0) { 39 | perror("keyctl"); 40 | return -1; 41 | } 42 | } 43 | 44 | return 0; 45 | } 46 | 47 | If, after the program has run, there something like the following line in 48 | /proc/keys: 49 | 50 | 3f3d898f I--Q--- 100 perm 3f3f0000 0 0 keyring leaked-keyring: empty 51 | 52 | with a usage count of 100 * the number of times the program has been run, 53 | then the kernel is malfunctioning. If leaked-keyring has zero usages or 54 | has been garbage collected, then the problem is fixed. 55 | 56 | Reported-by: Yevgeny Pats 57 | Signed-off-by: David Howells 58 | 59 | diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c 60 | index a3f85d2a00bb..e6d50172872f 100644 61 | --- a/security/keys/process_keys.c 62 | +++ b/security/keys/process_keys.c 63 | @@ -794,6 +794,7 @@ long join_session_keyring(const char *name) 64 | ret = PTR_ERR(keyring); 65 | goto error2; 66 | } else if (keyring == new->session_keyring) { 67 | + key_put(keyring); 68 | ret = 0; 69 | goto error2; 70 | } 71 | -------------------------------------------------------------------------------- /patches/patch-enable-IO-coherency-3.17-std.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c 2 | index c31f4c0..252d86a 100644 3 | --- a/arch/arm/mach-mvebu/coherency.c 4 | +++ b/arch/arm/mach-mvebu/coherency.c 5 | @@ -400,7 +400,7 @@ static int coherency_type(void) 6 | 7 | int coherency_available(void) 8 | { 9 | - return coherency_type() != COHERENCY_FABRIC_TYPE_NONE; 10 | + return true; 11 | } 12 | 13 | int __init coherency_init(void) 14 | -------------------------------------------------------------------------------- /patches/patch-enable-IO-coherency-4.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/arm/mach-mvebu/coherency.c b/arch/arm/mach-mvebu/coherency.c 2 | index e46e9ea..78bee09 100644 3 | --- a/arch/arm/mach-mvebu/coherency.c 4 | +++ b/arch/arm/mach-mvebu/coherency.c 5 | @@ -208,7 +208,7 @@ static int coherency_type(void) 6 | 7 | int coherency_available(void) 8 | { 9 | - return coherency_type() != COHERENCY_FABRIC_TYPE_NONE; 10 | + return true; 11 | } 12 | 13 | int __init coherency_init(void) 14 | -------------------------------------------------------------------------------- /patches/patch-inband-status_1.patch: -------------------------------------------------------------------------------- 1 | The SF2 driver currently overrides speed settings for its port 2 | configured using a fixed PHY, this is both unnecessary and incorrect, 3 | because we keep feedback to the hardware parameters that we read from 4 | the PHY device, which in the case of a fixed PHY cannot possibly change 5 | speed. 6 | 7 | This is a required change to allow the fixed PHY code to allow 8 | registering a PHY with a link configured as DOWN by default and avoid 9 | some sort of circular dependency where we require the link_update 10 | callback to run to program the hardware, and we then utilize the fixed 11 | PHY parameters to program the hardware with the same settings. 12 | 13 | Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver") 14 | Signed-off-by: Florian Fainelli 15 | --- 16 | drivers/net/dsa/bcm_sf2.c | 18 +----------------- 17 | 1 file changed, 1 insertion(+), 17 deletions(-) 18 | diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c 19 | index 972982f8bea7..3297604f8216 100644 20 | --- a/drivers/net/dsa/bcm_sf2.c 21 | +++ b/drivers/net/dsa/bcm_sf2.c 22 | @@ -890,15 +890,11 @@ static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, 23 | struct fixed_phy_status *status) 24 | { 25 | struct bcm_sf2_priv *priv = ds_to_priv(ds); 26 | - u32 duplex, pause, speed; 27 | + u32 duplex, pause; 28 | u32 reg; 29 | 30 | duplex = core_readl(priv, CORE_DUPSTS); 31 | pause = core_readl(priv, CORE_PAUSESTS); 32 | - speed = core_readl(priv, CORE_SPDSTS); 33 | - 34 | - speed >>= (port * SPDSTS_SHIFT); 35 | - speed &= SPDSTS_MASK; 36 | 37 | status->link = 0; 38 | 39 | @@ -933,18 +929,6 @@ static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, 40 | reg &= ~LINK_STS; 41 | core_writel(priv, reg, CORE_STS_OVERRIDE_GMIIP_PORT(port)); 42 | 43 | - switch (speed) { 44 | - case SPDSTS_10: 45 | - status->speed = SPEED_10; 46 | - break; 47 | - case SPDSTS_100: 48 | - status->speed = SPEED_100; 49 | - break; 50 | - case SPDSTS_1000: 51 | - status->speed = SPEED_1000; 52 | - break; 53 | - } 54 | - 55 | if ((pause & (1 << port)) && 56 | (pause & (1 << (port + PAUSESTS_TX_PAUSE_SHIFT)))) { 57 | status->asym_pause = 1; 58 | -- 59 | 2.1.0 60 | 61 | -------------------------------------------------------------------------------- /patches/patch-inband-status_2.patch: -------------------------------------------------------------------------------- 1 | fixed_phy_register() currently hardcodes the fixed PHY link to 1, and 2 | expects to find a "speed" parameter to provide correct information 3 | towards the fixed PHY consumer. 4 | 5 | In a subsequent change, where we allow "managed" (e.g: (RS)GMII in-band 6 | status auto-negotiation) fixed PHYs, none of these parameters can be 7 | provided since they will be auto-negotiated, hence, we just provide a 8 | zero-initialized fixed_phy_status to fixed_phy_register() which makes it 9 | fail when we call fixed_phy_update_regs() since status.speed = 0 which 10 | makes us hit the "default" label and error out. 11 | 12 | Without this change, we would also see potentially inconsistent 13 | speed/duplex parameters for fixed PHYs when the link is DOWN. 14 | 15 | CC: netdev@vger.kernel.org 16 | CC: linux-kernel@vger.kernel.org 17 | Signed-off-by: Stas Sergeev 18 | [florian: add more background to why this is correct and desirable] 19 | Signed-off-by: Florian Fainelli 20 | --- 21 | drivers/net/phy/fixed_phy.c | 8 +++++--- 22 | 1 file changed, 5 insertions(+), 3 deletions(-) 23 | diff --git a/drivers/net/phy/fixed_phy.c b/drivers/net/phy/fixed_phy.c 24 | index 1960b46add65..479b93f9581c 100644 25 | --- a/drivers/net/phy/fixed_phy.c 26 | +++ b/drivers/net/phy/fixed_phy.c 27 | @@ -52,6 +52,10 @@ static int fixed_phy_update_regs(struct fixed_phy *fp) 28 | u16 lpagb = 0; 29 | u16 lpa = 0; 30 | 31 | + if (!fp->status.link) 32 | + goto done; 33 | + bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE; 34 | + 35 | if (fp->status.duplex) { 36 | bmcr |= BMCR_FULLDPLX; 37 | 38 | @@ -96,15 +100,13 @@ static int fixed_phy_update_regs(struct fixed_phy *fp) 39 | } 40 | } 41 | 42 | - if (fp->status.link) 43 | - bmsr |= BMSR_LSTATUS | BMSR_ANEGCOMPLETE; 44 | - 45 | if (fp->status.pause) 46 | lpa |= LPA_PAUSE_CAP; 47 | 48 | if (fp->status.asym_pause) 49 | lpa |= LPA_PAUSE_ASYM; 50 | 51 | +done: 52 | fp->regs[MII_PHYSID1] = 0; 53 | fp->regs[MII_PHYSID2] = 0; 54 | 55 | -- 56 | 2.1.0 57 | -------------------------------------------------------------------------------- /patches/patch-inband-status_3.patch: -------------------------------------------------------------------------------- 1 | Currently the PHY management type is selected by the MAC driver arbitrary. 2 | The decision is based on the presence of the "fixed-link" node and on a 3 | will of the driver's authors. 4 | This caused a regression recently, when mvneta driver suddenly started 5 | to use the in-band status for auto-negotiation on fixed links. 6 | It appears the auto-negotiation may not work when expected by the MAC driver. 7 | Sebastien Rannou explains: 8 | << Yes, I confirm that my HW does not generate an in-band status. AFAIK, it's 9 | a PHY that aggregates 4xSGMIIs to 1xQSGMII ; the MAC side of the PHY (with 10 | inband status) is connected to the switch through QSGMII, and in this context 11 | we are on the media side of the PHY. >> 12 | https://lkml.org/lkml/2015/7/10/206 13 | 14 | This patch introduces the new string property 'managed' that allows 15 | the user to set the management type explicitly. 16 | The supported values are: 17 | "auto" - default. Uses either MDIO or nothing, depending on the presence 18 | of the fixed-link node 19 | "in-band-status" - use in-band status 20 | 21 | Signed-off-by: Stas Sergeev 22 | 23 | CC: Rob Herring 24 | CC: Pawel Moll 25 | CC: Mark Rutland 26 | CC: Ian Campbell 27 | CC: Kumar Gala 28 | CC: Florian Fainelli 29 | CC: Grant Likely 30 | CC: devicetree@vger.kernel.org 31 | CC: linux-kernel@vger.kernel.org 32 | CC: netdev@vger.kernel.org 33 | --- 34 | Documentation/devicetree/bindings/net/ethernet.txt | 4 ++++ 35 | drivers/of/of_mdio.c | 19 +++++++++++++++++-- 36 | 2 files changed, 21 insertions(+), 2 deletions(-) 37 | diff --git a/Documentation/devicetree/bindings/net/ethernet.txt b/Documentation/devicetree/bindings/net/ethernet.txt 38 | index 41b3f3f864e8..5d88f37480b6 100644 39 | --- a/Documentation/devicetree/bindings/net/ethernet.txt 40 | +++ b/Documentation/devicetree/bindings/net/ethernet.txt 41 | @@ -25,7 +25,11 @@ The following properties are common to the Ethernet controllers: 42 | flow control thresholds. 43 | - tx-fifo-depth: the size of the controller's transmit fifo in bytes. This 44 | is used for components that can have configurable fifo sizes. 45 | +- managed: string, specifies the PHY management type. Supported values are: 46 | + "auto", "in-band-status". "auto" is the default, it usess MDIO for 47 | + management if fixed-link is not specified. 48 | 49 | Child nodes of the Ethernet controller are typically the individual PHY devices 50 | connected via the MDIO bus (sometimes the MDIO bus controller is separate). 51 | They are described in the phy.txt file in this same directory. 52 | +For non-MDIO PHY management see fixed-link.txt. 53 | diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c 54 | index fdc60db60829..7c8c23cc6896 100644 55 | --- a/drivers/of/of_mdio.c 56 | +++ b/drivers/of/of_mdio.c 57 | @@ -266,7 +266,8 @@ EXPORT_SYMBOL(of_phy_attach); 58 | bool of_phy_is_fixed_link(struct device_node *np) 59 | { 60 | struct device_node *dn; 61 | - int len; 62 | + int len, err; 63 | + const char *managed; 64 | 65 | /* New binding */ 66 | dn = of_get_child_by_name(np, "fixed-link"); 67 | @@ -275,6 +276,10 @@ bool of_phy_is_fixed_link(struct device_node *np) 68 | return true; 69 | } 70 | 71 | + err = of_property_read_string(np, "managed", &managed); 72 | + if (err == 0 && strcmp(managed, "auto") != 0) 73 | + return true; 74 | + 75 | /* Old binding */ 76 | if (of_get_property(np, "fixed-link", &len) && 77 | len == (5 * sizeof(__be32))) 78 | @@ -289,8 +294,18 @@ int of_phy_register_fixed_link(struct device_node *np) 79 | struct fixed_phy_status status = {}; 80 | struct device_node *fixed_link_node; 81 | const __be32 *fixed_link_prop; 82 | - int len; 83 | + int len, err; 84 | struct phy_device *phy; 85 | + const char *managed; 86 | + 87 | + err = of_property_read_string(np, "managed", &managed); 88 | + if (err == 0) { 89 | + if (strcmp(managed, "in-band-status") == 0) { 90 | + /* status is zeroed, namely its .link member */ 91 | + phy = fixed_phy_register(PHY_POLL, &status, np); 92 | + return IS_ERR(phy) ? PTR_ERR(phy) : 0; 93 | + } 94 | + } 95 | 96 | /* New binding */ 97 | fixed_link_node = of_get_child_by_name(np, "fixed-link"); 98 | -- 99 | 2.1.0 100 | 101 | -------------------------------------------------------------------------------- /patches/patch-inband-status_4.patch: -------------------------------------------------------------------------------- 1 | The commit 898b2970e2c9 ("mvneta: implement SGMII-based in-band link state 2 | signaling") implemented the link parameters auto-negotiation unconditionally. 3 | Unfortunately it appears that some HW that implements SGMII protocol, 4 | doesn't generate the inband status, so it is not possible to auto-negotiate 5 | anything with such HW. 6 | 7 | This patch enables the auto-negotiation only if explicitly requested with 8 | the 'managed' DT property. 9 | 10 | This patch fixes the following regression: 11 | https://lkml.org/lkml/2015/7/8/865 12 | 13 | Signed-off-by: Stas Sergeev 14 | 15 | CC: Thomas Petazzoni 16 | CC: netdev@vger.kernel.org 17 | CC: linux-kernel@vger.kernel.org 18 | --- 19 | drivers/net/ethernet/marvell/mvneta.c | 9 +++++---- 20 | 1 file changed, 5 insertions(+), 4 deletions(-) 21 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c 22 | index 370e20ed224c..e4fb172d91a6 100644 23 | --- a/drivers/net/ethernet/marvell/mvneta.c 24 | +++ b/drivers/net/ethernet/marvell/mvneta.c 25 | @@ -3029,8 +3029,8 @@ static int mvneta_probe(struct platform_device *pdev) 26 | const char *dt_mac_addr; 27 | char hw_mac_addr[ETH_ALEN]; 28 | const char *mac_from; 29 | + const char *managed; 30 | int phy_mode; 31 | - int fixed_phy = 0; 32 | int err; 33 | 34 | /* Our multiqueue support is not complete, so for now, only 35 | @@ -3064,7 +3064,6 @@ static int mvneta_probe(struct platform_device *pdev) 36 | dev_err(&pdev->dev, "cannot register fixed PHY\n"); 37 | goto err_free_irq; 38 | } 39 | - fixed_phy = 1; 40 | 41 | /* In the case of a fixed PHY, the DT node associated 42 | * to the PHY is the Ethernet MAC DT node. 43 | @@ -3088,8 +3087,10 @@ static int mvneta_probe(struct platform_device *pdev) 44 | pp = netdev_priv(dev); 45 | pp->phy_node = phy_node; 46 | pp->phy_interface = phy_mode; 47 | - pp->use_inband_status = (phy_mode == PHY_INTERFACE_MODE_SGMII) && 48 | - fixed_phy; 49 | + 50 | + err = of_property_read_string(dn, "managed", &managed); 51 | + pp->use_inband_status = (err == 0 && 52 | + strcmp(managed, "in-band-status") == 0); 53 | 54 | pp->clk = devm_clk_get(&pdev->dev, NULL); 55 | if (IS_ERR(pp->clk)) { 56 | -- 57 | 2.1.0 58 | -------------------------------------------------------------------------------- /patches/patch-mvneta-DMA-buffer-unmapping.patch: -------------------------------------------------------------------------------- 1 | This patch fixes a regression introduced by the commit a84e32894191 2 | ("net: mvneta: fix refilling for Rx DMA buffers"). Due to this commit 3 | the newly allocated Rx buffers are DMA-unmapped in place of those passed 4 | to the networking stack. Obviously, this causes data corruptions. 5 | 6 | This patch fixes the issue by ensuring that the right Rx buffers are 7 | DMA-unmapped. 8 | 9 | Reported-by: Oren Laskin 10 | Signed-off-by: Simon Guinot 11 | Fixes: a84e32894191 ("net: mvneta: fix refilling for Rx DMA buffers") 12 | Cc: # v3.8+ 13 | --- 14 | drivers/net/ethernet/marvell/mvneta.c | 4 +++- 15 | 1 file changed, 3 insertions(+), 1 deletion(-) 16 | 17 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c 18 | index 62e48bc0cb23..03e052a1cf5a 100644 19 | --- a/drivers/net/ethernet/marvell/mvneta.c 20 | +++ b/drivers/net/ethernet/marvell/mvneta.c 21 | @@ -1479,6 +1479,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, 22 | struct mvneta_rx_desc *rx_desc = mvneta_rxq_next_desc_get(rxq); 23 | struct sk_buff *skb; 24 | unsigned char *data; 25 | + dma_addr_t phys_addr; 26 | u32 rx_status; 27 | int rx_bytes, err; 28 | 29 | @@ -1486,6 +1487,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, 30 | rx_status = rx_desc->status; 31 | rx_bytes = rx_desc->data_size - (ETH_FCS_LEN + MVNETA_MH_SIZE); 32 | data = (unsigned char *)rx_desc->buf_cookie; 33 | + phys_addr = rx_desc->buf_phys_addr; 34 | 35 | if (!mvneta_rxq_desc_is_first_last(rx_status) || 36 | (rx_status & MVNETA_RXD_ERR_SUMMARY)) { 37 | @@ -1534,7 +1536,7 @@ static int mvneta_rx(struct mvneta_port *pp, int rx_todo, 38 | if (!skb) 39 | goto err_drop_frame; 40 | 41 | - dma_unmap_single(dev->dev.parent, rx_desc->buf_phys_addr, 42 | + dma_unmap_single(dev->dev.parent, phys_addr, 43 | MVNETA_RX_BUF_SIZE(pp->pkt_size), DMA_FROM_DEVICE); 44 | 45 | rcvd_pkts++; 46 | -- 47 | 2.1.4 48 | -------------------------------------------------------------------------------- /patches/patch-revert-mvneta-init-nego.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c 2 | index ce5f7f9..2db6532 100644 3 | --- a/drivers/net/ethernet/marvell/mvneta.c 4 | +++ b/drivers/net/ethernet/marvell/mvneta.c 5 | @@ -100,8 +100,6 @@ 6 | #define MVNETA_TXQ_CMD 0x2448 7 | #define MVNETA_TXQ_DISABLE_SHIFT 8 8 | #define MVNETA_TXQ_ENABLE_MASK 0x000000ff 9 | -#define MVNETA_GMAC_CLOCK_DIVIDER 0x24f4 10 | -#define MVNETA_GMAC_1MS_CLOCK_ENABLE BIT(31) 11 | #define MVNETA_ACC_MODE 0x2500 12 | #define MVNETA_CPU_MAP(cpu) (0x2540 + ((cpu) << 2)) 13 | #define MVNETA_CPU_RXQ_ACCESS_ALL_MASK 0x000000ff 14 | @@ -124,7 +122,6 @@ 15 | #define MVNETA_TX_INTR_MASK_ALL (0xff << 0) 16 | #define MVNETA_RX_INTR_MASK(nr_rxqs) (((1 << nr_rxqs) - 1) << 8) 17 | #define MVNETA_RX_INTR_MASK_ALL (0xff << 8) 18 | -#define MVNETA_MISCINTR_INTR_MASK BIT(31) 19 | 20 | #define MVNETA_INTR_OLD_CAUSE 0x25a8 21 | #define MVNETA_INTR_OLD_MASK 0x25ac 22 | @@ -168,7 +165,6 @@ 23 | #define MVNETA_GMAC_MAX_RX_SIZE_MASK 0x7ffc 24 | #define MVNETA_GMAC0_PORT_ENABLE BIT(0) 25 | #define MVNETA_GMAC_CTRL_2 0x2c08 26 | -#define MVNETA_GMAC2_INBAND_AN_ENABLE BIT(0) 27 | #define MVNETA_GMAC2_PCS_ENABLE BIT(3) 28 | #define MVNETA_GMAC2_PORT_RGMII BIT(4) 29 | #define MVNETA_GMAC2_PORT_RESET BIT(6) 30 | @@ -184,11 +180,9 @@ 31 | #define MVNETA_GMAC_AUTONEG_CONFIG 0x2c0c 32 | #define MVNETA_GMAC_FORCE_LINK_DOWN BIT(0) 33 | #define MVNETA_GMAC_FORCE_LINK_PASS BIT(1) 34 | -#define MVNETA_GMAC_INBAND_AN_ENABLE BIT(2) 35 | #define MVNETA_GMAC_CONFIG_MII_SPEED BIT(5) 36 | #define MVNETA_GMAC_CONFIG_GMII_SPEED BIT(6) 37 | #define MVNETA_GMAC_AN_SPEED_EN BIT(7) 38 | -#define MVNETA_GMAC_AN_FLOW_CTRL_EN BIT(11) 39 | #define MVNETA_GMAC_CONFIG_FULL_DUPLEX BIT(12) 40 | #define MVNETA_GMAC_AN_DUPLEX_EN BIT(13) 41 | #define MVNETA_MIB_COUNTERS_BASE 0x3080 42 | @@ -310,7 +304,6 @@ struct mvneta_port { 43 | unsigned int link; 44 | unsigned int duplex; 45 | unsigned int speed; 46 | - int use_inband_status:1; 47 | }; 48 | 49 | /* The mvneta_tx_desc and mvneta_rx_desc structures describe the 50 | @@ -1001,20 +994,6 @@ static void mvneta_defaults_set(struct mvneta_port *pp) 51 | val &= ~MVNETA_PHY_POLLING_ENABLE; 52 | mvreg_write(pp, MVNETA_UNIT_CONTROL, val); 53 | 54 | - if (pp->use_inband_status) { 55 | - val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG); 56 | - val &= ~(MVNETA_GMAC_FORCE_LINK_PASS | 57 | - MVNETA_GMAC_FORCE_LINK_DOWN | 58 | - MVNETA_GMAC_AN_FLOW_CTRL_EN); 59 | - val |= MVNETA_GMAC_INBAND_AN_ENABLE | 60 | - MVNETA_GMAC_AN_SPEED_EN | 61 | - MVNETA_GMAC_AN_DUPLEX_EN; 62 | - mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); 63 | - val = mvreg_read(pp, MVNETA_GMAC_CLOCK_DIVIDER); 64 | - val |= MVNETA_GMAC_1MS_CLOCK_ENABLE; 65 | - mvreg_write(pp, MVNETA_GMAC_CLOCK_DIVIDER, val); 66 | - } 67 | - 68 | mvneta_set_ucast_table(pp, -1); 69 | mvneta_set_special_mcast_table(pp, -1); 70 | mvneta_set_other_mcast_table(pp, -1); 71 | @@ -2064,28 +2043,6 @@ static irqreturn_t mvneta_isr(int irq, void *dev_id) 72 | return IRQ_HANDLED; 73 | } 74 | 75 | -static int mvneta_fixed_link_update(struct mvneta_port *pp, 76 | - struct phy_device *phy) 77 | -{ 78 | - struct fixed_phy_status status; 79 | - struct fixed_phy_status changed = {}; 80 | - u32 gmac_stat = mvreg_read(pp, MVNETA_GMAC_STATUS); 81 | - 82 | - status.link = !!(gmac_stat & MVNETA_GMAC_LINK_UP); 83 | - if (gmac_stat & MVNETA_GMAC_SPEED_1000) 84 | - status.speed = SPEED_1000; 85 | - else if (gmac_stat & MVNETA_GMAC_SPEED_100) 86 | - status.speed = SPEED_100; 87 | - else 88 | - status.speed = SPEED_10; 89 | - status.duplex = !!(gmac_stat & MVNETA_GMAC_FULL_DUPLEX); 90 | - changed.link = 1; 91 | - changed.speed = 1; 92 | - changed.duplex = 1; 93 | - fixed_phy_update_state(phy, &status, &changed); 94 | - return 0; 95 | -} 96 | - 97 | /* NAPI handler 98 | * Bits 0 - 7 of the causeRxTx register indicate that are transmitted 99 | * packets on the corresponding TXQ (Bit 0 is for TX queue 1). 100 | @@ -2106,18 +2063,8 @@ static int mvneta_poll(struct napi_struct *napi, int budget) 101 | } 102 | 103 | /* Read cause register */ 104 | - cause_rx_tx = mvreg_read(pp, MVNETA_INTR_NEW_CAUSE); 105 | - if (cause_rx_tx & MVNETA_MISCINTR_INTR_MASK) { 106 | - u32 cause_misc = mvreg_read(pp, MVNETA_INTR_MISC_CAUSE); 107 | - 108 | - mvreg_write(pp, MVNETA_INTR_MISC_CAUSE, 0); 109 | - if (pp->use_inband_status && (cause_misc & 110 | - (MVNETA_CAUSE_PHY_STATUS_CHANGE | 111 | - MVNETA_CAUSE_LINK_CHANGE | 112 | - MVNETA_CAUSE_PSC_SYNC_CHANGE))) { 113 | - mvneta_fixed_link_update(pp, pp->phy_dev); 114 | - } 115 | - } 116 | + cause_rx_tx = mvreg_read(pp, MVNETA_INTR_NEW_CAUSE) & 117 | + (MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number)); 118 | 119 | /* Release Tx descriptors */ 120 | if (cause_rx_tx & MVNETA_TX_INTR_MASK_ALL) { 121 | @@ -2162,9 +2109,7 @@ static int mvneta_poll(struct napi_struct *napi, int budget) 122 | napi_complete(napi); 123 | local_irq_save(flags); 124 | mvreg_write(pp, MVNETA_INTR_NEW_MASK, 125 | - MVNETA_RX_INTR_MASK(rxq_number) | 126 | - MVNETA_TX_INTR_MASK(txq_number) | 127 | - MVNETA_MISCINTR_INTR_MASK); 128 | + MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number)); 129 | local_irq_restore(flags); 130 | } 131 | 132 | @@ -2428,13 +2373,7 @@ static void mvneta_start_dev(struct mvneta_port *pp) 133 | 134 | /* Unmask interrupts */ 135 | mvreg_write(pp, MVNETA_INTR_NEW_MASK, 136 | - MVNETA_RX_INTR_MASK(rxq_number) | 137 | - MVNETA_TX_INTR_MASK(txq_number) | 138 | - MVNETA_MISCINTR_INTR_MASK); 139 | - mvreg_write(pp, MVNETA_INTR_MISC_MASK, 140 | - MVNETA_CAUSE_PHY_STATUS_CHANGE | 141 | - MVNETA_CAUSE_LINK_CHANGE | 142 | - MVNETA_CAUSE_PSC_SYNC_CHANGE); 143 | + MVNETA_RX_INTR_MASK(rxq_number) | MVNETA_TX_INTR_MASK(txq_number)); 144 | 145 | phy_start(pp->phy_dev); 146 | netif_tx_start_all_queues(pp->dev); 147 | @@ -2584,7 +2523,9 @@ static void mvneta_adjust_link(struct net_device *ndev) 148 | val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG); 149 | val &= ~(MVNETA_GMAC_CONFIG_MII_SPEED | 150 | MVNETA_GMAC_CONFIG_GMII_SPEED | 151 | - MVNETA_GMAC_CONFIG_FULL_DUPLEX); 152 | + MVNETA_GMAC_CONFIG_FULL_DUPLEX | 153 | + MVNETA_GMAC_AN_SPEED_EN | 154 | + MVNETA_GMAC_AN_DUPLEX_EN); 155 | 156 | if (phydev->duplex) 157 | val |= MVNETA_GMAC_CONFIG_FULL_DUPLEX; 158 | @@ -2613,24 +2554,12 @@ static void mvneta_adjust_link(struct net_device *ndev) 159 | 160 | if (status_change) { 161 | if (phydev->link) { 162 | - if (!pp->use_inband_status) { 163 | - u32 val = mvreg_read(pp, 164 | - MVNETA_GMAC_AUTONEG_CONFIG); 165 | - val &= ~MVNETA_GMAC_FORCE_LINK_DOWN; 166 | - val |= MVNETA_GMAC_FORCE_LINK_PASS; 167 | - mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, 168 | - val); 169 | - } 170 | + u32 val = mvreg_read(pp, MVNETA_GMAC_AUTONEG_CONFIG); 171 | + val |= (MVNETA_GMAC_FORCE_LINK_PASS | 172 | + MVNETA_GMAC_FORCE_LINK_DOWN); 173 | + mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, val); 174 | mvneta_port_up(pp); 175 | } else { 176 | - if (!pp->use_inband_status) { 177 | - u32 val = mvreg_read(pp, 178 | - MVNETA_GMAC_AUTONEG_CONFIG); 179 | - val &= ~MVNETA_GMAC_FORCE_LINK_PASS; 180 | - val |= MVNETA_GMAC_FORCE_LINK_DOWN; 181 | - mvreg_write(pp, MVNETA_GMAC_AUTONEG_CONFIG, 182 | - val); 183 | - } 184 | mvneta_port_down(pp); 185 | } 186 | phy_print_status(phydev); 187 | @@ -2976,9 +2905,6 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode) 188 | return -EINVAL; 189 | } 190 | 191 | - if (pp->use_inband_status) 192 | - ctrl |= MVNETA_GMAC2_INBAND_AN_ENABLE; 193 | - 194 | /* Cancel Port Reset */ 195 | ctrl &= ~MVNETA_GMAC2_PORT_RESET; 196 | mvreg_write(pp, MVNETA_GMAC_CTRL_2, ctrl); 197 | @@ -3003,7 +2929,6 @@ static int mvneta_probe(struct platform_device *pdev) 198 | char hw_mac_addr[ETH_ALEN]; 199 | const char *mac_from; 200 | int phy_mode; 201 | - int fixed_phy = 0; 202 | int err; 203 | 204 | /* Our multiqueue support is not complete, so for now, only 205 | @@ -3037,7 +2962,6 @@ static int mvneta_probe(struct platform_device *pdev) 206 | dev_err(&pdev->dev, "cannot register fixed PHY\n"); 207 | goto err_free_irq; 208 | } 209 | - fixed_phy = 1; 210 | 211 | /* In the case of a fixed PHY, the DT node associated 212 | * to the PHY is the Ethernet MAC DT node. 213 | @@ -3061,8 +2985,6 @@ static int mvneta_probe(struct platform_device *pdev) 214 | pp = netdev_priv(dev); 215 | pp->phy_node = phy_node; 216 | pp->phy_interface = phy_mode; 217 | - pp->use_inband_status = (phy_mode == PHY_INTERFACE_MODE_SGMII) && 218 | - fixed_phy; 219 | 220 | pp->clk = devm_clk_get(&pdev->dev, NULL); 221 | if (IS_ERR(pp->clk)) { 222 | @@ -3140,12 +3062,6 @@ static int mvneta_probe(struct platform_device *pdev) 223 | 224 | platform_set_drvdata(pdev, pp->dev); 225 | 226 | - if (pp->use_inband_status) { 227 | - struct phy_device *phy = of_phy_find_device(dn); 228 | - 229 | - mvneta_fixed_link_update(pp, phy); 230 | - } 231 | - 232 | return 0; 233 | 234 | err_free_stats: 235 | -------------------------------------------------------------------------------- /patches/patch-x86-perf-add-lbr-filter-support-for-slm.patch: -------------------------------------------------------------------------------- 1 | diff --git a/arch/x86/events/intel/core.c b/arch/x86/events/intel/core.c 2 | index 931c13a..14d27e3 100644 3 | --- a/arch/x86/events/intel/core.c 4 | +++ b/arch/x86/events/intel/core.c 5 | @@ -3581,7 +3581,7 @@ __init int intel_pmu_init(void) 6 | memcpy(hw_cache_extra_regs, slm_hw_cache_extra_regs, 7 | sizeof(hw_cache_extra_regs)); 8 | 9 | - intel_pmu_lbr_init_atom(); 10 | + intel_pmu_lbr_init_slm(); 11 | 12 | x86_pmu.event_constraints = intel_slm_event_constraints; 13 | x86_pmu.pebs_constraints = intel_slm_pebs_event_constraints; 14 | diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c 15 | index ad26ca7..317e29e 100644 16 | --- a/arch/x86/events/intel/lbr.c 17 | +++ b/arch/x86/events/intel/lbr.c 18 | @@ -1058,6 +1058,24 @@ void __init intel_pmu_lbr_init_atom(void) 19 | pr_cont("8-deep LBR, "); 20 | } 21 | 22 | +/* slm */ 23 | +void __init intel_pmu_lbr_init_slm(void) 24 | +{ 25 | + x86_pmu.lbr_nr = 8; 26 | + x86_pmu.lbr_tos = MSR_LBR_TOS; 27 | + x86_pmu.lbr_from = MSR_LBR_CORE_FROM; 28 | + x86_pmu.lbr_to = MSR_LBR_CORE_TO; 29 | + 30 | + x86_pmu.lbr_sel_mask = LBR_SEL_MASK; 31 | + x86_pmu.lbr_sel_map = nhm_lbr_sel_map; 32 | + 33 | + /* 34 | + * SW branch filter usage: 35 | + * - compensate for lack of HW filter 36 | + */ 37 | + pr_cont("8-deep LBR, "); 38 | +} 39 | + 40 | /* Knights Landing */ 41 | void intel_pmu_lbr_init_knl(void) 42 | { 43 | diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h 44 | index 8b78481..7d62a02 100644 45 | --- a/arch/x86/events/perf_event.h 46 | +++ b/arch/x86/events/perf_event.h 47 | @@ -909,6 +909,8 @@ void intel_pmu_lbr_init_nhm(void); 48 | 49 | void intel_pmu_lbr_init_atom(void); 50 | 51 | +void intel_pmu_lbr_init_slm(void); 52 | + 53 | void intel_pmu_lbr_init_snb(void); 54 | 55 | void intel_pmu_lbr_init_hsw(void); 56 | -- 57 | 2.5.0 58 | 59 | -------------------------------------------------------------------------------- /patches/patch_aufs.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | ################################################### 6 | ## Patch the Linux source tree with AUFS support ## 7 | ################################################### 8 | 9 | # Target Kernel Version 10 | VERSION=$(grep '^VERSION\s*=' Makefile | cut -d= -f2 | sed 's/\s//g') 11 | PATCHLEVEL=$(grep '^PATCHLEVEL\s*=' Makefile | cut -d= -f2 | sed 's/\s//g') 12 | KVER=${KVER:-$VERSION.$PATCHLEVEL} 13 | # Temporary Location 14 | #TMPGIT=`mktemp -d` 15 | GIT=patches/aufs-aufs3-standalone 16 | GIT_URL=git://git.code.sf.net/p/aufs/aufs3-standalone 17 | BINPREFIX=aufs3- 18 | 19 | if [ "x$VERSION" = "x4" ]; then 20 | GIT=patches/aufs-aufs4-standalone 21 | GIT_URL=git://github.com/sfjro/aufs4-standalone.git 22 | BINPREFIX=aufs4- 23 | fi 24 | 25 | # Clone AUFS repo 26 | if [ ! -d $GIT ]; then 27 | which git || (apt-get update && apt-get install -y git) 28 | git clone -n $GIT_URL $GIT 29 | fi 30 | 31 | # Checkout AUFS branch 32 | pushd $GIT 33 | git checkout origin/aufs$KVER 34 | popd 35 | 36 | # Copy in files 37 | cp -r $GIT/{Documentation,fs} ./ 38 | cp $GIT/include/uapi/linux/aufs_type.h ./include/uapi/linux/aufs_type.h 39 | 40 | # Apply patches 41 | cat $GIT/${BINPREFIX}{base,kbuild,loopback,mmap,standalone}.patch | patch -p1 42 | 43 | # Clean Up 44 | #rm -rf $GIT 45 | 46 | # Enable module 47 | grep -q CONFIG_AUFS_BDEV_LOOP .config || echo CONFIG_AUFS_BDEV_LOOP=y >> .config 48 | grep -q CONFIG_AUFS_BRANCH_MAX_1023 .config || echo CONFIG_AUFS_BRANCH_MAX_1023=y >> .config 49 | grep -q CONFIG_AUFS_FHSM .config || echo CONFIG_AUFS_FHSM=y >> .config 50 | grep -q CONFIG_AUFS_FS .config || echo CONFIG_AUFS_FS=m >> .config 51 | grep -q CONFIG_AUFS_RDU .config || echo CONFIG_AUFS_RDU=y >> .config 52 | grep -q CONFIG_AUFS_SBILIST .config || echo CONFIG_AUFS_SBILIST=y >> .config 53 | grep -q CONFIG_AUFS_XATTR .config || echo CONFIG_AUFS_XATTR=y >> .config 54 | 55 | printf "Patched Kernel $KVER in $(cwd) with AUFS support!" 56 | -------------------------------------------------------------------------------- /patches/patch_mvneta_fix_tx_coalesce.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | mkdir -p patches 6 | if [ ! -f patches/0001-net-mvneta-fix-TX-coalesce-interrupt-mode.patch ]; then 7 | wget https://raw.githubusercontent.com/scaleway/kernel-tools/master/patches/0001-net-mvneta-fix-TX-coalesce-interrupt-mode.patch -O patches/0001-net-mvneta-fix-TX-coalesce-interrupt-mode.patch 8 | fi 9 | patch -p1 < patches/0001-net-mvneta-fix-TX-coalesce-interrupt-mode.patch 10 | -------------------------------------------------------------------------------- /rules.mk: -------------------------------------------------------------------------------- 1 | KERNEL_VERSION = $(shell (test -f include/config/kernel.release || $(MAKE) include/config/kernel.release &>/dev/null); cat include/config/kernel.release) 2 | ARCH_CONFIG ?= mvebu_v7 3 | J ?= -j $(CONCURRENCY_LEVEL) 4 | ARTIFACTS_TO_COPY ?= include/config/kernel.release Module.symvers modules.builtin modules.order System.map 5 | 6 | 7 | all: 8 | @echo "This Makefile is used inside Docker" 9 | 10 | 11 | .PHONY: all enter leave oldconfig olddefconfig menuconfig $(ARCH_CONFIG)_defconfig dtbs build ccache_stats shell defconfig uImage diff uImage-appended 12 | 13 | 14 | print-%: 15 | @echo $* = $($*) 16 | 17 | 18 | enter: 19 | $(ENTER_COMMAND) 20 | cp /tmp/.config .config 21 | 22 | 23 | leave: 24 | cp .config /tmp/.config 25 | 26 | 27 | oldconfig olddefconfig menuconfig $(ARCH_CONFIG)_defconfig: apply-patches 28 | $(MAKE) $@ 29 | 30 | 31 | /usr/bin/dtc: 32 | wget http://ftp.fr.debian.org/debian/pool/main/d/device-tree-compiler/device-tree-compiler_1.4.0+dfsg-1_amd64.deb -O /tmp/dtc.deb 33 | dpkg -i /tmp/dtc.deb 34 | rm -f /tmp/dtc.deb 35 | 36 | 37 | apply-patches: 38 | @if [ -f patches-apply.sh -a ! -f patches-applied ]; then \ 39 | echo /bin/bash -xe patches-apply.sh; \ 40 | /bin/bash -xe patches-apply.sh || exit 1; \ 41 | printf "\narch/arm/boot/dts/*.dts\nbuild/\nrules.mk\n" >> .git/info/exclude || true; \ 42 | touch patches-applied; \ 43 | fi 44 | 45 | 46 | build_armv7l: 47 | @mv build/build.txt build/build-prev.txt || true 48 | $(MAKE) -f rules.mk uImage dtbs build_info 2>&1 | tee build/build.txt 49 | 50 | 51 | build_x86_64: 52 | @mv build/build.txt build/build-prev.txt || true 53 | $(MAKE) -f rules.mk bzImage build_info 2>&1 | tee build/build.txt 54 | 55 | build_aarch64: 56 | @mv build/build.txt build/build-prev.txt || true 57 | $(MAKE) -f rules.mk vmlinux build_info 2>&1 | tee build/build.txt 58 | 59 | 60 | build: build_$(KERNEL_ARCH) 61 | 62 | 63 | dtbs: /usr/bin/dtc apply-patches 64 | -printf "\narch/arm/boot/dts/*.dts\nbuild/\n" >> .git/info/exclude || true 65 | sed -i "s/armada-xp-db.dtb/scaleway-c1.dtb/g" arch/arm/boot/dts/Makefile 66 | git update-index --assume-unchanged arch/arm/boot/dts/Makefile 67 | $(MAKE) dtbs 68 | mkdir -p build/dtbs 69 | cp arch/arm/boot/dts/scaleway-*.dtb build/dtbs 70 | 71 | 72 | ccache_stats: 73 | ccache -s 74 | 75 | 76 | shell: 77 | bash 78 | 79 | 80 | defconfig: $(ARCH_CONFIG)_defconfig 81 | 82 | bzImage: apply-patches 83 | make $(J) bzImage 84 | make $(J) modules 85 | make headers_install INSTALL_HDR_PATH=build 86 | cd build/ && tar cf include.tar include 87 | make modules_install INSTALL_MOD_PATH=build INSTALL_MOD_STRIP=1 88 | cd build/ && tar cf lib.tar lib 89 | make install INSTALL_PATH=build 90 | for file in $(ARTIFACTS_TO_COPY); do cp $$file build/; done 91 | echo $(KERNEL_VERSION) 92 | #find . -name "*Image*" 93 | cp arch/x86_64/boot/bzImage build/bzImage-$(KERNEL_VERSION) 94 | cp -f build/bzImage-$(KERNEL_VERSION) build/bzImage 95 | 96 | 97 | uImage: apply-patches 98 | make $(J) uImage 99 | make $(J) modules 100 | make headers_install INSTALL_HDR_PATH=build 101 | cd build/ && tar cf include.tar include 102 | make modules_install INSTALL_MOD_PATH=build INSTALL_MOD_STRIP=1 103 | cd build/ && tar cf lib.tar lib 104 | make uinstall INSTALL_PATH=build 105 | for file in $(ARTIFACTS_TO_COPY); do cp $$file build/; done 106 | echo $(KERNEL_VERSION) 107 | cp arch/arm/boot/uImage build/uImage-$(KERNEL_VERSION) 108 | cp -f build/uImage-$(KERNEL_VERSION) build/uImage 109 | cp arch/arm/boot/Image build/Image-$(KERNEL_VERSION) 110 | cp -f build/Image-$(KERNEL_VERSION) build/Image 111 | cp arch/arm/boot/zImage build/zImage-$(KERNEL_VERSION) 112 | cp -f build/zImage-$(KERNEL_VERSION) build/zImage 113 | cp -f build/config-$(KERNEL_VERSION) build/config 114 | 115 | vmlinux: apply-patches 116 | make $(J) Image.gz modules 117 | make headers_install INSTALL_HDR_PATH=build 118 | cd build/ && tar cf include.tar include 119 | make modules_install INSTALL_MOD_PATH=build INSTALL_MOD_STRIP=1 120 | cd build/ && tar cf lib.tar lib 121 | make install INSTALL_PATH=build 122 | for file in $(ARTIFACTS_TO_COPY); do cp $$file build/; done 123 | echo $(KERNEL_VERSION) 124 | cp vmlinux build/vmlinux-$(KERNEL_VERSION) 125 | cp -f build/config-$(KERNEL_VERSION) build/config 126 | 127 | 128 | build_info: 129 | @echo "=== $(KERNEL_FULL) - built on `date`" 130 | @echo "=== gcc version" 131 | gcc --version 132 | @echo "=== file listing" 133 | find build -type f -ls 134 | @echo "=== sizes" 135 | du -sh build/* 136 | du -sh build 137 | 138 | 139 | diff: 140 | cp .config .bkpconfig 141 | $(MAKE) $(ARCH_CONFIG)_defconfig 142 | mv .config .defconfig 143 | mv .bkpconfig .config 144 | diff <(<.defconfig grep "^[^#]" | sort) <(<.config grep "^[^#]" | sort) 145 | 146 | 147 | uImage-appended: apply-patches 148 | cat build/zImage build/scaleway-c1.dtb > build/zImage-c1-dts-appended-$(KERNEL_VERSION) 149 | cp -f build/zImage-c1-dts-appended-$(KERNEL_VERSION) build/zImage-c1-dts-appended 150 | 151 | mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux-$(KERNEL_VERSION)" -d build/zImage-c1-dts-appended-$(KERNEL_VERSION) uImage-c1-dts-appended 152 | mv uImage-c1-dts-appended build/uImage-c1-dts-appended-$(KERNEL_VERSION) 153 | cp -f build/uImage-c1-dts-appended-$(KERNEL_VERSION) build/uImage-c1-dts-appended 154 | -------------------------------------------------------------------------------- /tools/.gitignore: -------------------------------------------------------------------------------- 1 | docker-checkconfig.sh 2 | lxc-checkconfig.sh 3 | -------------------------------------------------------------------------------- /tools/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/tools/.gitkeep -------------------------------------------------------------------------------- /tools/configs/aarch64-mainline.conf: -------------------------------------------------------------------------------- 1 | CONFIG_BLK_DEV_NBD m 2 | CONFIG_EXT4_FS y 3 | CONFIG_FIXED_PHY y 4 | CONFIG_DEVTMPFS y 5 | CONFIG_VLAN_8021Q m 6 | CONFIG_CGROUPS y,! # useful for docker, systemd etc 7 | CONFIG_NET y 8 | CONFIG_SYSFS y 9 | CONFIG_PROC_FS y 10 | CONFIG_CGROUP_FREEZER y,! 11 | CONFIG_CGROUP_DEVICE y,! 12 | CONFIG_CGROUP_CPUACCT y,! 13 | CONFIG_CGROUP_PERF y,! 14 | CONFIG_CGROUP_SCHED y,! 15 | CONFIG_BLK_CGROUP y,! 16 | CONFIG_MV_XOR n # buggy in mainline kernels 17 | CONFIG_NF_CONNTRACK y,m 18 | 19 | # Removed in 4.3 20 | #CONFIG_NET_CLS_CGROUP y,! 21 | #CONFIG_NETPRIO_CGROUP y,! 22 | #CONFIG_CGROUP_MEM_RES_CTLR y,! 23 | #CONFIG_CGROUP_MEM_RES_CTLR_SWAP y,! 24 | #CONFIG_CGROUP_MEM_RES_CTLR_KMEM y,! 25 | 26 | #CONFIG_AUDIT n 27 | #CONFIG_AUTOFS4_FS y,m,! 28 | #CONFIG_BRIDGE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 29 | #CONFIG_IP_NF_TARGET_MASQUERADE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 30 | #CONFIG_IP_NF_IPTABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 31 | #CONFIG_IP_MULTIPLE_TABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 32 | #CONFIG_NETFILTER_NETLINK_ACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 33 | #CONFIG_NETFILTER_XT_MATCH_NFACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 34 | #CONFIG_NETFILTER_XT_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 35 | #CONFIG_NETFILTER_XT_TARGET_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 36 | #CONFIG_NETFILTER_XT_MATCH_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 37 | #CONFIG_DUMMY n 38 | #CONFIG_FHANDLE y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=001809282918f273d372f1ee09d10b783c18a474 39 | #CONFIG_SCHEDSTATS y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 40 | #CONFIG_SCHED_DEBUG y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 41 | #CONFIG_NLS_UTF8 y # Ensure that we support UTF8 filenames. 42 | #CONFIG_BT y,! # Bluez (optional): Needed if bluez used as bluetooth stack 43 | #CONFIG_BT_RFCOMM y,! # Bluez (optional): Needed if bluez used as bluetooth stack 44 | #CONFIG_BT_HCIUART y,! # Bluez (optional): Needed if bluez used as bluetooth stack 45 | #CONFIG_BT_HCIUART_H4 y,! # Bluez (optional): Needed if bluez used as bluetooth stack 46 | #CONFIG_BT_MSM_SLEEP n,! # Bluez (optional): Causes problems with bluez thus disabling is recommended. 47 | #CONFIG_HIDRAW y,m,! # optional: Support HID devices 48 | #CONFIG_UNIX y # UNIX sockets option is required to run Mer 49 | #CONFIG_SYSVIPC y # Inter Process Communication option is required to run Mer 50 | #CONFIG_EXT4_FS y,m,! # Mer uses ext4 as rootfs by default 51 | #CONFIG_FANOTIFY y,! # optional, required for systemd readahead. 52 | #CONFIG_HOTPLUG y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 53 | #CONFIG_INOTIFY_USER y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 54 | #CONFIG_IPV6 y,m,! # systemd: http://cgit.freedesktop.org/systemd/systemd/tree/README#n37 55 | #CONFIG_RTC_DRV_CMOS y,! # optional, but highly recommended 56 | #CONFIG_SIGNALFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 57 | #CONFIG_TIMERFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 58 | #CONFIG_EPOLL y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 59 | #CONFIG_SYSFS_DEPRECATED n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 60 | #CONFIG_TMPFS_POSIX_ACL y,! # systemd (optional): strongly recommended, if you want pam_systemd.so to setup your "seats". http://cgit.freedesktop.org/systemd/systemd/commit/README?id=77b6e19458f37cfde127ec6aa9494c0ac45ad890 61 | #CONFIG_TMPFS_XATTR y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 62 | #CONFIG_SECCOMP y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f28cbd0382ca53baa99803bbc907a469fbf68128 63 | #CONFIG_TUN y,m,! # ofono: http://git.kernel.org/?p=network/ofono/ofono.git;a=blob;f=README;h=413d789e5f9e96024986f5116d3c8aff0c9f15b8;hb=HEAD#l28 64 | #CONFIG_UEVENT_HELPER_PATH "", ! # should be empty, if you want to use systemd without initramfs. Also systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 65 | #CONFIG_FW_LOADER_USER_HELPER n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 66 | #CONFIG_VT y # Required for virtual consoles 67 | #CONFIG_LBDAF y,! # ext4 filesystem requires this in order to support filesysetms with huge_file feature, which is enabled by default by mke2fs.ext4 68 | #CONFIG_WATCHDOG_NOWAYOUT y,! # If device uses watchdogs with dsme (https://github.com/nemomobile/dsme), this option should be enabled or watchdog does not protect the device in case dsme crashes. 69 | #CONFIG_CHECKPOINT_RESTORE y,! # rich-core-dumper (https://github.com/mer-tools/sp-rich-core/) needs this to collect all data for environment recreation. 70 | -------------------------------------------------------------------------------- /tools/configs/armv7l-lsp.conf: -------------------------------------------------------------------------------- 1 | #CONFIG_ARCH_MVEBU y # mvebu architecture 2 | CONFIG_BLK_DEV_NBD y # required to boot on C1 3 | CONFIG_EXT4_FS y # required to boot on C1 4 | #CONFIG_FIXED_PHY y # required to boot on C1 ? 5 | CONFIG_IP_PNP y # required to boot on C1 6 | CONFIG_IP_PNP_DHCP y # required to boot on C1 7 | #CONFIG_MVMDIO y # required to boot on C1 8 | CONFIG_DEVTMPFS y # required to boot on C1 9 | CONFIG_VLAN_8021Q y # required to boot on C1 10 | CONFIG_WIRELESS n # useless on C1 11 | CONFIG_WLAN n # useless on C1 12 | CONFIG_CGROUPS y,! # useful for docker, systemd etc 13 | CONFIG_NET y 14 | CONFIG_SYSFS y 15 | CONFIG_PROC_FS y 16 | CONFIG_CGROUP_FREEZER y,! 17 | CONFIG_CGROUP_DEVICE y,! 18 | CONFIG_CGROUP_CPUACCT y,! 19 | CONFIG_CGROUP_MEM_RES_CTLR y,! 20 | CONFIG_CGROUP_MEM_RES_CTLR_SWAP y,! 21 | CONFIG_CGROUP_MEM_RES_CTLR_KMEM y,! 22 | CONFIG_CGROUP_PERF y,! 23 | CONFIG_CGROUP_SCHED y,! 24 | CONFIG_BLK_CGROUP y,! 25 | CONFIG_NET_CLS_CGROUP y,! 26 | CONFIG_NETPRIO_CGROUP y,! 27 | 28 | #CONFIG_AUDIT n 29 | #CONFIG_AUTOFS4_FS y,m,! 30 | #CONFIG_BRIDGE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 31 | #CONFIG_IP_NF_TARGET_MASQUERADE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 32 | #CONFIG_IP_NF_IPTABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 33 | #CONFIG_IP_MULTIPLE_TABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 34 | #CONFIG_NETFILTER_NETLINK_ACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 35 | #CONFIG_NETFILTER_XT_MATCH_NFACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 36 | #CONFIG_NETFILTER_XT_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 37 | #CONFIG_NETFILTER_XT_TARGET_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 38 | #CONFIG_NETFILTER_XT_MATCH_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 39 | #CONFIG_DUMMY n 40 | #CONFIG_FHANDLE y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=001809282918f273d372f1ee09d10b783c18a474 41 | #CONFIG_SCHEDSTATS y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 42 | #CONFIG_SCHED_DEBUG y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 43 | #CONFIG_NLS_UTF8 y # Ensure that we support UTF8 filenames. 44 | #CONFIG_BT y,! # Bluez (optional): Needed if bluez used as bluetooth stack 45 | #CONFIG_BT_RFCOMM y,! # Bluez (optional): Needed if bluez used as bluetooth stack 46 | #CONFIG_BT_HCIUART y,! # Bluez (optional): Needed if bluez used as bluetooth stack 47 | #CONFIG_BT_HCIUART_H4 y,! # Bluez (optional): Needed if bluez used as bluetooth stack 48 | #CONFIG_BT_MSM_SLEEP n,! # Bluez (optional): Causes problems with bluez thus disabling is recommended. 49 | #CONFIG_HIDRAW y,m,! # optional: Support HID devices 50 | #CONFIG_UNIX y # UNIX sockets option is required to run Mer 51 | #CONFIG_SYSVIPC y # Inter Process Communication option is required to run Mer 52 | #CONFIG_EXT4_FS y,m,! # Mer uses ext4 as rootfs by default 53 | #CONFIG_FANOTIFY y,! # optional, required for systemd readahead. 54 | #CONFIG_HOTPLUG y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 55 | #CONFIG_INOTIFY_USER y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 56 | #CONFIG_IPV6 y,m,! # systemd: http://cgit.freedesktop.org/systemd/systemd/tree/README#n37 57 | #CONFIG_RTC_DRV_CMOS y,! # optional, but highly recommended 58 | #CONFIG_SIGNALFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 59 | #CONFIG_TIMERFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 60 | #CONFIG_EPOLL y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 61 | #CONFIG_SYSFS_DEPRECATED n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 62 | #CONFIG_TMPFS_POSIX_ACL y,! # systemd (optional): strongly recommended, if you want pam_systemd.so to setup your "seats". http://cgit.freedesktop.org/systemd/systemd/commit/README?id=77b6e19458f37cfde127ec6aa9494c0ac45ad890 63 | #CONFIG_TMPFS_XATTR y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 64 | #CONFIG_SECCOMP y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f28cbd0382ca53baa99803bbc907a469fbf68128 65 | #CONFIG_TUN y,m,! # ofono: http://git.kernel.org/?p=network/ofono/ofono.git;a=blob;f=README;h=413d789e5f9e96024986f5116d3c8aff0c9f15b8;hb=HEAD#l28 66 | #CONFIG_UEVENT_HELPER_PATH "", ! # should be empty, if you want to use systemd without initramfs. Also systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 67 | #CONFIG_FW_LOADER_USER_HELPER n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 68 | #CONFIG_VT y # Required for virtual consoles 69 | #CONFIG_LBDAF y,! # ext4 filesystem requires this in order to support filesysetms with huge_file feature, which is enabled by default by mke2fs.ext4 70 | #CONFIG_WATCHDOG_NOWAYOUT y,! # If device uses watchdogs with dsme (https://github.com/nemomobile/dsme), this option should be enabled or watchdog does not protect the device in case dsme crashes. 71 | #CONFIG_CHECKPOINT_RESTORE y,! # rich-core-dumper (https://github.com/mer-tools/sp-rich-core/) needs this to collect all data for environment recreation. -------------------------------------------------------------------------------- /tools/configs/armv7l-mainline.conf: -------------------------------------------------------------------------------- 1 | CONFIG_ARCH_MVEBU y # mvebu architecture 2 | CONFIG_BLK_DEV_NBD y # required to boot on C1 3 | CONFIG_EXT4_FS y # required to boot on C1 4 | CONFIG_FIXED_PHY y # required to boot on C1 5 | CONFIG_IP_PNP y # required to boot on C1 6 | CONFIG_IP_PNP_DHCP y # required to boot on C1 7 | CONFIG_MVMDIO y # required to boot on C1 8 | CONFIG_DEVTMPFS y # required to boot on C1 9 | CONFIG_VLAN_8021Q y # required to boot on C1 10 | CONFIG_WIRELESS n # useless on C1 11 | CONFIG_WLAN n # useless on C1 12 | CONFIG_CGROUPS y,! # useful for docker, systemd etc 13 | CONFIG_NET y 14 | CONFIG_SYSFS y 15 | CONFIG_PROC_FS y 16 | CONFIG_CGROUP_FREEZER y,! 17 | CONFIG_CGROUP_DEVICE y,! 18 | CONFIG_CGROUP_CPUACCT y,! 19 | CONFIG_CGROUP_PERF y,! 20 | CONFIG_CGROUP_SCHED y,! 21 | CONFIG_BLK_CGROUP y,! 22 | CONFIG_MV_XOR n # buggy in mainline kernels 23 | CONFIG_NF_CONNTRACK y,m 24 | 25 | # Removed in 4.3 26 | #CONFIG_NET_CLS_CGROUP y,! 27 | #CONFIG_NETPRIO_CGROUP y,! 28 | #CONFIG_CGROUP_MEM_RES_CTLR y,! 29 | #CONFIG_CGROUP_MEM_RES_CTLR_SWAP y,! 30 | #CONFIG_CGROUP_MEM_RES_CTLR_KMEM y,! 31 | 32 | #CONFIG_AUDIT n 33 | #CONFIG_AUTOFS4_FS y,m,! 34 | #CONFIG_BRIDGE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 35 | #CONFIG_IP_NF_TARGET_MASQUERADE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 36 | #CONFIG_IP_NF_IPTABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 37 | #CONFIG_IP_MULTIPLE_TABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 38 | #CONFIG_NETFILTER_NETLINK_ACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 39 | #CONFIG_NETFILTER_XT_MATCH_NFACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 40 | #CONFIG_NETFILTER_XT_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 41 | #CONFIG_NETFILTER_XT_TARGET_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 42 | #CONFIG_NETFILTER_XT_MATCH_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 43 | #CONFIG_DUMMY n 44 | #CONFIG_FHANDLE y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=001809282918f273d372f1ee09d10b783c18a474 45 | #CONFIG_SCHEDSTATS y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 46 | #CONFIG_SCHED_DEBUG y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 47 | #CONFIG_NLS_UTF8 y # Ensure that we support UTF8 filenames. 48 | #CONFIG_BT y,! # Bluez (optional): Needed if bluez used as bluetooth stack 49 | #CONFIG_BT_RFCOMM y,! # Bluez (optional): Needed if bluez used as bluetooth stack 50 | #CONFIG_BT_HCIUART y,! # Bluez (optional): Needed if bluez used as bluetooth stack 51 | #CONFIG_BT_HCIUART_H4 y,! # Bluez (optional): Needed if bluez used as bluetooth stack 52 | #CONFIG_BT_MSM_SLEEP n,! # Bluez (optional): Causes problems with bluez thus disabling is recommended. 53 | #CONFIG_HIDRAW y,m,! # optional: Support HID devices 54 | #CONFIG_UNIX y # UNIX sockets option is required to run Mer 55 | #CONFIG_SYSVIPC y # Inter Process Communication option is required to run Mer 56 | #CONFIG_EXT4_FS y,m,! # Mer uses ext4 as rootfs by default 57 | #CONFIG_FANOTIFY y,! # optional, required for systemd readahead. 58 | #CONFIG_HOTPLUG y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 59 | #CONFIG_INOTIFY_USER y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 60 | #CONFIG_IPV6 y,m,! # systemd: http://cgit.freedesktop.org/systemd/systemd/tree/README#n37 61 | #CONFIG_RTC_DRV_CMOS y,! # optional, but highly recommended 62 | #CONFIG_SIGNALFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 63 | #CONFIG_TIMERFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 64 | #CONFIG_EPOLL y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 65 | #CONFIG_SYSFS_DEPRECATED n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 66 | #CONFIG_TMPFS_POSIX_ACL y,! # systemd (optional): strongly recommended, if you want pam_systemd.so to setup your "seats". http://cgit.freedesktop.org/systemd/systemd/commit/README?id=77b6e19458f37cfde127ec6aa9494c0ac45ad890 67 | #CONFIG_TMPFS_XATTR y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 68 | #CONFIG_SECCOMP y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f28cbd0382ca53baa99803bbc907a469fbf68128 69 | #CONFIG_TUN y,m,! # ofono: http://git.kernel.org/?p=network/ofono/ofono.git;a=blob;f=README;h=413d789e5f9e96024986f5116d3c8aff0c9f15b8;hb=HEAD#l28 70 | #CONFIG_UEVENT_HELPER_PATH "", ! # should be empty, if you want to use systemd without initramfs. Also systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 71 | #CONFIG_FW_LOADER_USER_HELPER n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 72 | #CONFIG_VT y # Required for virtual consoles 73 | #CONFIG_LBDAF y,! # ext4 filesystem requires this in order to support filesysetms with huge_file feature, which is enabled by default by mke2fs.ext4 74 | #CONFIG_WATCHDOG_NOWAYOUT y,! # If device uses watchdogs with dsme (https://github.com/nemomobile/dsme), this option should be enabled or watchdog does not protect the device in case dsme crashes. 75 | #CONFIG_CHECKPOINT_RESTORE y,! # rich-core-dumper (https://github.com/mer-tools/sp-rich-core/) needs this to collect all data for environment recreation. 76 | -------------------------------------------------------------------------------- /tools/configs/defconfig.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/tools/configs/defconfig.conf -------------------------------------------------------------------------------- /tools/configs/versatile.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/tools/configs/versatile.conf -------------------------------------------------------------------------------- /tools/configs/x86_64-external.conf: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tools/configs/x86_64-mainline.conf: -------------------------------------------------------------------------------- 1 | CONFIG_ARCH_MVEBU n # mvebu architecture 2 | CONFIG_BLK_DEV_NBD y # required to boot on C1 3 | CONFIG_EXT4_FS y # required to boot on C1 4 | CONFIG_FIXED_PHY y # required to boot on C1 5 | CONFIG_IP_PNP y # required to boot on C1 6 | CONFIG_IP_PNP_DHCP y # required to boot on C1 7 | CONFIG_MVMDIO y # required to boot on C1 8 | CONFIG_DEVTMPFS y # required to boot on C1 9 | CONFIG_VLAN_8021Q y # required to boot on C1 10 | CONFIG_WIRELESS n # useless on C1 11 | CONFIG_WLAN n # useless on C1 12 | CONFIG_CGROUPS y,! # useful for docker, systemd etc 13 | CONFIG_NET y 14 | CONFIG_SYSFS y 15 | CONFIG_PROC_FS y 16 | CONFIG_CGROUP_FREEZER y,! 17 | CONFIG_CGROUP_DEVICE y,! 18 | CONFIG_CGROUP_CPUACCT y,! 19 | CONFIG_CGROUP_MEM_RES_CTLR y,! 20 | CONFIG_CGROUP_MEM_RES_CTLR_SWAP y,! 21 | CONFIG_CGROUP_MEM_RES_CTLR_KMEM y,! 22 | CONFIG_CGROUP_PERF y,! 23 | CONFIG_CGROUP_SCHED y,! 24 | CONFIG_BLK_CGROUP y,! 25 | CONFIG_NET_CLS_CGROUP y,! 26 | CONFIG_NETPRIO_CGROUP y,! 27 | CONFIG_MV_XOR n # buggy in mainline kernels 28 | CONFIG_NF_CONNTRACK y,m 29 | 30 | #CONFIG_AUDIT n 31 | #CONFIG_AUTOFS4_FS y,m,! 32 | #CONFIG_BRIDGE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 33 | #CONFIG_IP_NF_TARGET_MASQUERADE y,m,! # connman (optional): support tethering, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=19fe7cad485afa6a7a5cc4aa75615ce8b7b8d376 34 | #CONFIG_IP_NF_IPTABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 35 | #CONFIG_IP_MULTIPLE_TABLES y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 36 | #CONFIG_NETFILTER_NETLINK_ACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 37 | #CONFIG_NETFILTER_XT_MATCH_NFACCT y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=41f37125887cb9208da2441e350e1e3324c17ee6 38 | #CONFIG_NETFILTER_XT_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 39 | #CONFIG_NETFILTER_XT_TARGET_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 40 | #CONFIG_NETFILTER_XT_MATCH_CONNMARK y,m,! # connman (optional): for routing and statistic support in sessions, http://git.kernel.org/cgit/network/connman/connman.git/commit/README?id=115cb9cbd3cdda00784e58a4ea12b42d128732b4 41 | #CONFIG_DUMMY n 42 | #CONFIG_FHANDLE y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=001809282918f273d372f1ee09d10b783c18a474 43 | #CONFIG_SCHEDSTATS y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 44 | #CONFIG_SCHED_DEBUG y,! # systemd-bootchart (optional): http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f1c24fea94e19cf2108abbeed1d36ded7102ab98 45 | #CONFIG_NLS_UTF8 y # Ensure that we support UTF8 filenames. 46 | #CONFIG_BT y,! # Bluez (optional): Needed if bluez used as bluetooth stack 47 | #CONFIG_BT_RFCOMM y,! # Bluez (optional): Needed if bluez used as bluetooth stack 48 | #CONFIG_BT_HCIUART y,! # Bluez (optional): Needed if bluez used as bluetooth stack 49 | #CONFIG_BT_HCIUART_H4 y,! # Bluez (optional): Needed if bluez used as bluetooth stack 50 | #CONFIG_BT_MSM_SLEEP n,! # Bluez (optional): Causes problems with bluez thus disabling is recommended. 51 | #CONFIG_HIDRAW y,m,! # optional: Support HID devices 52 | #CONFIG_UNIX y # UNIX sockets option is required to run Mer 53 | #CONFIG_SYSVIPC y # Inter Process Communication option is required to run Mer 54 | #CONFIG_EXT4_FS y,m,! # Mer uses ext4 as rootfs by default 55 | #CONFIG_FANOTIFY y,! # optional, required for systemd readahead. 56 | #CONFIG_HOTPLUG y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 57 | #CONFIG_INOTIFY_USER y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 58 | #CONFIG_IPV6 y,m,! # systemd: http://cgit.freedesktop.org/systemd/systemd/tree/README#n37 59 | #CONFIG_RTC_DRV_CMOS y,! # optional, but highly recommended 60 | #CONFIG_SIGNALFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 61 | #CONFIG_TIMERFD y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 62 | #CONFIG_EPOLL y # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 63 | #CONFIG_SYSFS_DEPRECATED n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 64 | #CONFIG_TMPFS_POSIX_ACL y,! # systemd (optional): strongly recommended, if you want pam_systemd.so to setup your "seats". http://cgit.freedesktop.org/systemd/systemd/commit/README?id=77b6e19458f37cfde127ec6aa9494c0ac45ad890 65 | #CONFIG_TMPFS_XATTR y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 66 | #CONFIG_SECCOMP y,! # systemd (optional): strongly recommended, http://cgit.freedesktop.org/systemd/systemd/commit/README?id=f28cbd0382ca53baa99803bbc907a469fbf68128 67 | #CONFIG_TUN y,m,! # ofono: http://git.kernel.org/?p=network/ofono/ofono.git;a=blob;f=README;h=413d789e5f9e96024986f5116d3c8aff0c9f15b8;hb=HEAD#l28 68 | #CONFIG_UEVENT_HELPER_PATH "", ! # should be empty, if you want to use systemd without initramfs. Also systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 69 | #CONFIG_FW_LOADER_USER_HELPER n # systemd: http://cgit.freedesktop.org/systemd/systemd/commit/README?id=713bc0cfa477ca1df8769041cb3dbc83c10eace2 70 | #CONFIG_VT y # Required for virtual consoles 71 | #CONFIG_LBDAF y,! # ext4 filesystem requires this in order to support filesysetms with huge_file feature, which is enabled by default by mke2fs.ext4 72 | #CONFIG_WATCHDOG_NOWAYOUT y,! # If device uses watchdogs with dsme (https://github.com/nemomobile/dsme), this option should be enabled or watchdog does not protect the device in case dsme crashes. 73 | #CONFIG_CHECKPOINT_RESTORE y,! # rich-core-dumper (https://github.com/mer-tools/sp-rich-core/) needs this to collect all data for environment recreation. 74 | -------------------------------------------------------------------------------- /tools/verify_kernel_config.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | # Mer Kernel config specification checker 3 | # http://wiki.merproject.org/wiki/Adaptation_Guide 4 | 5 | # CONFIG must be set to one of the permitted values "," seperated and 6 | # multiple values permitted 7 | 8 | # y = set and enabled 9 | # m = set and module 10 | # n = must be unset (commented out) 11 | # 12 | # "value" = must be set to "value" 13 | # /regexp/ = "value" which matches regexp 14 | # 15 | # ! = Failure will be warned, not errored 16 | 17 | # Known issues with the basic parser: 18 | # * # in regexps or strings cause issues if there's no trailing # 19 | # * can't have "," in /regexp/ 20 | 21 | use Text::ParseWords; 22 | use strict; 23 | use Term::ANSIColor; 24 | use File::Basename; 25 | 26 | my $debug = 0; 27 | my %config; 28 | 29 | # Parse input argument 30 | my $type = shift; 31 | my $file = shift; 32 | 33 | if (!$type or !$file) { 34 | print "Usage: ./verify_kernel_config.pl \n"; 35 | print "types: lxc nfs-rootfs\n"; 36 | exit; 37 | } 38 | 39 | # Read according to check type 40 | 41 | my $input = dirname($0)."/configs/$type.conf"; 42 | open (my $DATA, "<", $input) || die "Error: type $type does not exist!"; 43 | 44 | while (<$DATA>) { 45 | next if /^\s*(#.*)?$/ ; # skip comments and blank lines 46 | chomp; 47 | 48 | my ($conf, $allowed) = split(' ', $_, 2); 49 | 50 | # Remove and capture any trailing comment (dubious matching here 51 | # since comments in a "" or // will be removed too) 52 | my $comment; 53 | if ($allowed =~ s/(#\s*)(.*)?$//) { 54 | $comment = $2 if $2; 55 | } 56 | 57 | # http://perldoc.perl.org/Text/ParseWords.html 58 | my @allowed = parse_line(",", 1, $allowed); 59 | 60 | my $warning; 61 | # Strip leading/trailing space for each value and check for warnings 62 | foreach (@allowed) { 63 | s/^\s+|\s+$//g; 64 | $warning = 1 if $_ eq "!" ; 65 | } 66 | 67 | # Each CONFIG_* has an array of allowed values, a comment and a flag 68 | # to say it's only a warning (in which case we print the comment) 69 | $config{$conf} = {allowed => \@allowed, 70 | comment => $comment, 71 | warning => $warning }; 72 | } 73 | 74 | print "\nScanning\n" if $debug; 75 | open (my $FILE, "<", $file) || die "Error: file $file does not exist !!"; 76 | while (<$FILE>) { 77 | next if /^\s*(#.*)?$/ ; # skip comments and blank lines 78 | chomp; 79 | my ($conf, $value) = split('=', $_, 2); 80 | 81 | # Only check CONFIG_* values we know about 82 | next unless $config{$conf}; 83 | 84 | my $c = $config{$conf}; 85 | 86 | print "$conf matched, checking..." if $debug; 87 | $c->{"value"} = $value; # Store the value for later reporting 88 | 89 | my $allowed = $c->{"allowed"}; 90 | for my $allow (@$allowed) { 91 | if (substr($allow,1,1) eq '/') { # regexps 92 | print "Do a regex match : \"$value\" =~ $allow\n" if $debug; 93 | 94 | } elsif (substr($allow,1,1) eq '"') { # strings 95 | print "Do a string match : $allow == $value\n" if $debug; 96 | if ($value eq $allow) {$c->{"valid"} = 1; } 97 | 98 | } else { # plain y/m values 99 | print "match y/m : $value == $allow\n" if $debug; 100 | if ($value eq $allow) {$c->{"valid"} = 1; } 101 | } 102 | } 103 | if ($c->{"valid"}) { print "OK\n" if $debug;} 104 | } 105 | 106 | print "Results\n" if $debug; 107 | my $fatal = 0; 108 | for my $conf (keys %config) { 109 | my $c = $config{$conf}; 110 | 111 | if (! $c->{"valid"}) { # Check for 'n' case 112 | foreach my $allow (@{$c->{"allowed"}}) { 113 | if (("$allow" eq "n") and ! $c->{"value"}) { 114 | $c->{"valid"} = 1; 115 | } 116 | } 117 | } 118 | 119 | # Now report 120 | if (! $c->{"valid"}) { 121 | print defined($c->{"warning"}) ? colored("WARNING: ", 'bright_yellow') : colored("ERROR: ", 'bright_red'); 122 | print colored("$conf", 'bright_white') , " is invalid, "; 123 | if ($c->{"value"}) { 124 | print "Value is: ". $c->{"value"} .", "; 125 | } else { 126 | print "It is unset, "; 127 | } 128 | print "Allowed values : ".join(", ", @{$c->{"allowed"}}) ."\n"; 129 | if (! $c->{"warning"}) { 130 | $fatal = 1; 131 | } 132 | } 133 | } 134 | exit $fatal; 135 | -------------------------------------------------------------------------------- /x86_64/4.10.8-apparmor/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/x86_64/4.10.8-apparmor/patch.sh -------------------------------------------------------------------------------- /x86_64/4.10.8-debug/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # patch -p1 < patches/patch-x86-perf-add-lbr-filter-support-for-slm.patch 4 | -------------------------------------------------------------------------------- /x86_64/4.10.8-docker/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | KVER=4.10 /bin/bash -x patches/patch_aufs.bash 4 | -------------------------------------------------------------------------------- /x86_64/4.10.8-fedora/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | -------------------------------------------------------------------------------- /x86_64/4.10.8-rancher/4.8.14-fedora/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | -------------------------------------------------------------------------------- /x86_64/4.10.8-rancher/include.mk: -------------------------------------------------------------------------------- 1 | KERNEL_TYPE ?= external 2 | -------------------------------------------------------------------------------- /x86_64/4.10.8-rancher/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/x86_64/4.10.8-rancher/patch.sh -------------------------------------------------------------------------------- /x86_64/4.10.8-std/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/x86_64/4.10.8-std/patch.sh -------------------------------------------------------------------------------- /x86_64/4.4.38-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | -------------------------------------------------------------------------------- /x86_64/4.4.57-std/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/x86_64/4.4.57-std/patch.sh -------------------------------------------------------------------------------- /x86_64/4.4.59-std/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/x86_64/4.4.59-std/patch.sh -------------------------------------------------------------------------------- /x86_64/4.4.70-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | KVER=4.4 /bin/bash -x patches/patch_aufs.bash 4 | -------------------------------------------------------------------------------- /x86_64/4.8.14-apparmor/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #patch -p1 < patches/patch-cve-2016-0728.patch 4 | #patch -p1 < patches/patch-enable-IO-coherency-4.0.patch 5 | #git update-index --assume-unchanged arch/arm/mach-mvebu/coherency.c 6 | #patch -p1 < patches/patch-cpuidle-4.0.patch 7 | 8 | # sgmii mvneta 9 | #patch -p1 < patches/patch-inband-status_1.patch 10 | #patch -p1 < patches/patch-inband-status_2.patch 11 | #patch -p1 < patches/patch-inband-status_3.patch 12 | #patch -p1 < patches/patch-inband-status_4.patch 13 | #patch -p1 < patches/patch-mvneta-DMA-buffer-unmapping.patch 14 | -------------------------------------------------------------------------------- /x86_64/4.8.14-debug/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # patch -p1 < patches/patch-x86-perf-add-lbr-filter-support-for-slm.patch 4 | -------------------------------------------------------------------------------- /x86_64/4.8.14-docker/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | KVER=4.8 /bin/bash -x patches/patch_aufs.bash 4 | -------------------------------------------------------------------------------- /x86_64/4.8.14-fedora/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | -------------------------------------------------------------------------------- /x86_64/4.8.14-rancher/include.mk: -------------------------------------------------------------------------------- 1 | KERNEL_TYPE ?= external 2 | -------------------------------------------------------------------------------- /x86_64/4.8.14-rancher/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/x86_64/4.8.14-rancher/patch.sh -------------------------------------------------------------------------------- /x86_64/4.8.14-std/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | -------------------------------------------------------------------------------- /x86_64/4.9.20-docker/patch.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | KVER=4.9 /bin/bash -x patches/patch_aufs.bash 4 | -------------------------------------------------------------------------------- /x86_64/4.9.20-std/patch.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/scaleway/kernel-tools/06d675954c6f113feb96ca9e3f5f0f1c00f8c353/x86_64/4.9.20-std/patch.sh -------------------------------------------------------------------------------- /x86_64/README.md: -------------------------------------------------------------------------------- 1 | # `x86_64` kernel images 2 | 3 | ## Supported architectures: 4 | 5 | * `x86_64` hosts 6 | * `x86_64` virtual machines (perfect with Vagrant) 7 | * `qemu-system-x86_64` 8 | * Online.net' Dedibox servers 9 | * Travis builds 10 | * `boot2docker`-based testing 11 | -------------------------------------------------------------------------------- /x86_64/include.mk: -------------------------------------------------------------------------------- 1 | DOCKER_ENV ?= -e LOADADDR=0x8000 \ 2 | -e CONCURRENCY_LEVEL=$(CONCURRENCY_LEVEL) \ 3 | -e KERNEL_ARCH=$(KERNEL_ARCH) \ 4 | -e KBUILD_BUILD_USER=$(KBUILD_BUILD_USER) \ 5 | -e KBUILD_BUILD_HOST=$(KBUILD_BUILD_HOST) \ 6 | -e LOCALVERSION=$(LOCALVERSION) 7 | 8 | DOCKER_VOLUMES ?= -v $(PWD)/$(KERNEL)/.config:/tmp/.config \ 9 | -v $(PWD)/dist/$(KERNEL_FULL):$(LINUX_PATH)/build/ \ 10 | -v $(CCACHE_DIR):/ccache \ 11 | -v $(PWD)/patches:$(LINUX_PATH)/patches:rw \ 12 | -v $(PWD)/$(KERNEL)/patch.sh:$(LINUX_PATH)/patches-apply.sh:ro \ 13 | -v $(PWD)/rules.mk:$(LINUX_PATH)/rules.mk:ro 14 | 15 | qemu: 16 | @echo "No implemented." 17 | @exit 1 18 | --------------------------------------------------------------------------------