diff options
-rw-r--r-- | mk/image.mk | 36 | ||||
-rw-r--r-- | mk/linux-ver.mk | 26 | ||||
-rwxr-xr-x | scripts/gen_initramfs_list.sh | 328 | ||||
-rw-r--r-- | target/linux/Config.in.kernelversion | 27 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/alpha-remove-coff.patch (renamed from target/linux/patches/4.14.200/alpha-remove-coff.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/arm-nommu.patch (renamed from target/linux/patches/4.14.200/arm-nommu.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/arm-thumb2.patch (renamed from target/linux/patches/4.14.200/arm-thumb2.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/h8300.patch (renamed from target/linux/patches/4.14.200/h8300.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/initramfs-nosizelimit.patch (renamed from target/linux/patches/4.14.200/initramfs-nosizelimit.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/microblaze-sigaltstack.patch (renamed from target/linux/patches/4.14.200/microblaze-sigaltstack.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/or1k-more-ram.patch (renamed from target/linux/patches/4.14.200/or1k-more-ram.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/startup.patch (renamed from target/linux/patches/4.14.200/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.14.221/vdso2.patch (renamed from target/linux/patches/4.14.200/vdso2.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.151/0001-Revert-ARC-entry-fix-potential-EFA-clobber-when-TIF_.patch | 66 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/arc.patch (renamed from target/linux/patches/4.19.151/arc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/darwin-dtc.patch (renamed from target/linux/patches/4.19.151/darwin-dtc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/darwin-file2alias.patch (renamed from target/linux/patches/4.19.151/darwin-file2alias.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/fec-coldfire.patch (renamed from target/linux/patches/4.19.151/fec-coldfire.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/or1k-more-ram.patch (renamed from target/linux/patches/4.19.151/or1k-more-ram.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/relocs.patch (renamed from target/linux/patches/4.19.151/relocs.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/startup.patch (renamed from target/linux/patches/4.19.151/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.19.176/vdso2.patch (renamed from target/linux/patches/4.19.151/vdso2.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/coldfire-sighandler.patch (renamed from target/linux/patches/4.4.238/coldfire-sighandler.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/crisv32.patch (renamed from target/linux/patches/4.4.238/crisv32.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/crisv32_ethernet_driver.patch (renamed from target/linux/patches/4.4.238/crisv32_ethernet_driver.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/h8300.patch (renamed from target/linux/patches/4.4.238/h8300.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/initramfs-nosizelimit.patch (renamed from target/linux/patches/4.4.238/initramfs-nosizelimit.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/ld-or1k.patch (renamed from target/linux/patches/4.4.238/ld-or1k.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/macsonic.patch (renamed from target/linux/patches/4.4.238/macsonic.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/mips-xz.patch (renamed from target/linux/patches/4.4.238/mips-xz.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/patch-realtime (renamed from target/linux/patches/4.4.238/patch-realtime) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/startup.patch (renamed from target/linux/patches/4.4.238/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/use-libgcc-for-sh.patch (renamed from target/linux/patches/4.4.238/use-libgcc-for-sh.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.4.257/versatile-nommu.patch (renamed from target/linux/patches/4.4.238/versatile-nommu.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/alpha-remove-coff.patch (renamed from target/linux/patches/4.9.238/alpha-remove-coff.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/arm-nommu.patch (renamed from target/linux/patches/4.9.238/arm-nommu.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/arm-thumb2.patch (renamed from target/linux/patches/4.9.238/arm-thumb2.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/crisv32_ethernet_driver.patch (renamed from target/linux/patches/4.9.238/crisv32_ethernet_driver.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/h8300.patch (renamed from target/linux/patches/4.9.238/h8300.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/hppa-remove-debug.patch (renamed from target/linux/patches/4.9.238/hppa-remove-debug.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/initramfs-nosizelimit.patch (renamed from target/linux/patches/4.9.238/initramfs-nosizelimit.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/ld-or1k.patch (renamed from target/linux/patches/4.9.238/ld-or1k.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/macsonic.patch (renamed from target/linux/patches/4.9.238/macsonic.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/microblaze-sigaltstack.patch (renamed from target/linux/patches/4.9.238/microblaze-sigaltstack.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/or1k-more-ram.patch (renamed from target/linux/patches/4.9.238/or1k-more-ram.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/patch-realtime (renamed from target/linux/patches/4.9.238/patch-realtime) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/sh2.patch (renamed from target/linux/patches/4.9.238/sh2.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/startup.patch (renamed from target/linux/patches/4.9.238/startup.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/4.9.257/vdso2.patch (renamed from target/linux/patches/4.9.238/vdso2.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.17/arc.patch (renamed from target/linux/patches/5.4.92/arc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.17/darwin-dtc.patch (renamed from target/linux/patches/5.4.92/darwin-dtc.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.17/darwin-file2alias.patch (renamed from target/linux/patches/5.4.92/darwin-file2alias.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.17/dtc-noyaml.patch (renamed from target/linux/patches/5.4.92/dtc-noyaml.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.17/or1k-more-ram.patch (renamed from target/linux/patches/5.4.92/or1k-more-ram.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.17/relocs.patch (renamed from target/linux/patches/5.4.92/relocs.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.10.17/startup.patch | 34 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/arc.patch | 12 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/arm-thumb2.patch (renamed from target/linux/patches/5.4.92/arm-thumb2.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/darwin-dtc.patch | 26 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/darwin-file2alias.patch | 14 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/dtc-noyaml.patch | 16 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/or1k-more-ram.patch | 12 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/relocs.patch | 2698 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/sh4.patch (renamed from target/linux/patches/5.4.92/sh4.patch) | 0 | ||||
-rw-r--r-- | target/linux/patches/5.4.99/startup.patch (renamed from target/linux/patches/5.4.92/startup.patch) | 0 |
65 files changed, 3179 insertions, 116 deletions
diff --git a/mk/image.mk b/mk/image.mk index 1cd343701..72c7cdaa7 100644 --- a/mk/image.mk +++ b/mk/image.mk @@ -161,8 +161,7 @@ ${FW_DIR}/${ROOTFSUSERTARBALL}: ${TARGET_DIR}/.adk $(CPIO) --quiet -o -Hustar --owner=0:0 | $(XZ) -c >$@ ${STAGING_TARGET_DIR}/${INITRAMFS}_list: ${TARGET_DIR}/.adk -ifeq ($(ADK_TARGET_LINUX_KERNEL_NEW),y) - PATH='${HOST_PATH}' $(BASH) ${LINUX_DIR}/usr/gen_initramfs_list.sh -u squash -g squash \ + PATH='${HOST_PATH}' $(BASH) ${ADK_TOPDIR}/scripts/gen_initramfs_list.sh -u squash -g squash \ ${TARGET_DIR}/ >$@ ( \ echo "nod /dev/console 0644 0 0 c 5 1"; \ @@ -186,32 +185,6 @@ ifeq ($(ADK_TARGET_LINUX_KERNEL_NEW),y) echo "nod /dev/ttyUL0 0660 0 0 c 204 187"; \ echo "nod /dev/ttyUL1 0660 0 0 c 204 188"; \ ) >>$@ -else - PATH='${HOST_PATH}' $(BASH) ${LINUX_DIR}/scripts/gen_initramfs_list.sh -u squash -g squash \ - ${TARGET_DIR}/ >$@ - ( \ - echo "nod /dev/console 0644 0 0 c 5 1"; \ - echo "nod /dev/tty 0644 0 0 c 5 0"; \ - for i in 0 1 2 3 4; do \ - echo "nod /dev/tty$$i 0644 0 0 c 4 $$$$i"; \ - done; \ - echo "nod /dev/null 0644 0 0 c 1 3"; \ - echo "nod /dev/ram 0655 0 0 b 1 1"; \ - echo "nod /dev/ttyS0 0660 0 0 c 4 64"; \ - echo "nod /dev/ttyS1 0660 0 0 c 4 65"; \ - echo "nod /dev/ttyB0 0660 0 0 c 11 0"; \ - echo "nod /dev/ttyB1 0660 0 0 c 11 1"; \ - echo "nod /dev/ttyAMA0 0660 0 0 c 204 64"; \ - echo "nod /dev/ttyAMA1 0660 0 0 c 204 65"; \ - echo "nod /dev/ttySC0 0660 0 0 c 204 8"; \ - echo "nod /dev/ttySC1 0660 0 0 c 204 9"; \ - echo "nod /dev/ttySC2 0660 0 0 c 204 10"; \ - echo "nod /dev/ttyBF0 0660 0 0 c 204 64"; \ - echo "nod /dev/ttyBF1 0660 0 0 c 204 65"; \ - echo "nod /dev/ttyUL0 0660 0 0 c 204 187"; \ - echo "nod /dev/ttyUL1 0660 0 0 c 204 188"; \ - ) >>$@ -endif ${FW_DIR}/${INITRAMFS}: ${STAGING_TARGET_DIR}/${INITRAMFS}_list ${LINUX_DIR}/usr/gen_init_cpio ${STAGING_TARGET_DIR}/${INITRAMFS}_list | \ @@ -269,6 +242,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMP_XZ),y) echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_XZ=y" >> ${LINUX_DIR}/.config + echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config echo "CONFIG_INITRAMFS_COMPRESSION_XZ=y" >> ${LINUX_DIR}/.config echo "CONFIG_XZ_DEC_X86=n" >> ${LINUX_DIR}/.config echo "CONFIG_XZ_DEC_POWERPC=n" >> ${LINUX_DIR}/.config @@ -285,6 +259,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMP_LZ4),y) echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZ4=y" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config + echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config echo "CONFIG_INITRAMFS_COMPRESSION_LZ4=y" >> ${LINUX_DIR}/.config endif ifeq ($(ADK_LINUX_KERNEL_COMP_LZMA),y) @@ -294,6 +269,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMP_LZMA),y) echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZMA=y" >> ${LINUX_DIR}/.config + echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config echo "CONFIG_INITRAMFS_COMPRESSION_LZMA=y" >> ${LINUX_DIR}/.config endif ifeq ($(ADK_LINUX_KERNEL_COMP_LZO),y) @@ -303,6 +279,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMP_LZO),y) echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZO=y" >> ${LINUX_DIR}/.config + echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config echo "CONFIG_INITRAMFS_COMPRESSION_LZO=y" >> ${LINUX_DIR}/.config endif ifeq ($(ADK_LINUX_KERNEL_COMP_GZIP),y) @@ -312,6 +289,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMP_GZIP),y) echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_GZIP=y" >> ${LINUX_DIR}/.config + echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config echo "CONFIG_INITRAMFS_COMPRESSION_GZIP=y" >> ${LINUX_DIR}/.config endif ifeq ($(ADK_LINUX_KERNEL_COMP_BZIP2),y) @@ -321,6 +299,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMP_BZIP2),y) echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_BZIP2=y" >> ${LINUX_DIR}/.config + echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config echo "CONFIG_INITRAMFS_COMPRESSION_BZIP2=y" >> ${LINUX_DIR}/.config endif ifeq ($(ADK_LINUX_KERNEL_COMPRESS_NONE),y) @@ -330,6 +309,7 @@ ifeq ($(ADK_LINUX_KERNEL_COMPRESS_NONE),y) echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config echo "CONFIG_RD_GZIP=n" >> ${LINUX_DIR}/.config + echo "CONFIG_RD_ZSTD=n" >> ${LINUX_DIR}/.config endif @-rm $(LINUX_DIR)/usr/initramfs_data.cpio* 2>/dev/null env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \ diff --git a/mk/linux-ver.mk b/mk/linux-ver.mk index a6b69dc0a..c57b9211f 100644 --- a/mk/linux-ver.mk +++ b/mk/linux-ver.mk @@ -15,35 +15,41 @@ KERNEL_FILE_VER:= $(ADK_TARGET_LINUX_KERNEL_GIT) KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(ADK_TARGET_LINUX_KERNEL_GIT_VER)-$(KERNEL_RELEASE) endif +ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_5_10),y) +KERNEL_FILE_VER:= 5.10.17 +KERNEL_RELEASE:= 1 +KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) +KERNEL_HASH:= e84e623ce8bb2446ec026b62eafa3b18480aa6fb6ae9c86cd8f18651324d4814 +endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_5_4),y) -KERNEL_FILE_VER:= 5.4.92 +KERNEL_FILE_VER:= 5.4.99 KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) -KERNEL_HASH:= c0937ff98824c4b14cfea68a04340e0beb3c00f1cc02984daf2f3bdf542394fd +KERNEL_HASH:= 5bdad12c69253d30d836dd51e0b2a9a04a6749cc6b4b2412561a1efcb1351a27 endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_4_19),y) -KERNEL_FILE_VER:= 4.19.151 +KERNEL_FILE_VER:= 4.19.176 KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) -KERNEL_HASH:= c7b134c6d45f77df0909c225300e64379d7f9d69abd9ad73ff6a289aa2b6a36e +KERNEL_HASH:= e1c3b8d21ba31bd5c50bb3b2a741f62958eb2a116bf13fa0e14f1656c4826073 endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_4_14),y) -KERNEL_FILE_VER:= 4.14.200 +KERNEL_FILE_VER:= 4.14.221 KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) -KERNEL_HASH:= 5d404a0224a34b5379f1871cc46825487d557c2660459d2b5c3cd4871d699a38 +KERNEL_HASH:= ce2254075ff4846f13380c1cf4bec1e351e5996a7dd109c200e222e49fd2c7e9 endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_4_9),y) -KERNEL_FILE_VER:= 4.9.238 +KERNEL_FILE_VER:= 4.9.257 KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) -KERNEL_HASH:= b1eaf60b771ec4df0546d2b7539e164355008ea2f680a0642ae430e9cb134a3f +KERNEL_HASH:= 95e780fffc81de8217a31a3e6e212b69643f5344e9ba0dabaa6e426126f6d64f endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_4_4),y) -KERNEL_FILE_VER:= 4.4.238 +KERNEL_FILE_VER:= 4.4.257 KERNEL_RELEASE:= 1 KERNEL_VERSION:= $(KERNEL_FILE_VER)-$(KERNEL_RELEASE) -KERNEL_HASH:= 067814035c17e77dee84076dcc06a95eb675344cd926b7b79a16b80fee593364 +KERNEL_HASH:= 3e067c5625b6a1201325c45c9b9e75f87e768cfbb9426f5f173dee73dc234b5a endif ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_3_16),y) KERNEL_FILE_VER:= 3.16.81 diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh new file mode 100755 index 000000000..2bbac73e6 --- /dev/null +++ b/scripts/gen_initramfs_list.sh @@ -0,0 +1,328 @@ +#!/bin/sh +# Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org> +# Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org> +# +# Released under the terms of the GNU GPL +# +# Generate a cpio packed initramfs. It uses gen_init_cpio to generate +# the cpio archive, and then compresses it. +# The script may also be used to generate the inputfile used for gen_init_cpio +# This script assumes that gen_init_cpio is located in usr/ directory + +# error out on errors +set -e + +usage() { +cat << EOF +Usage: +$0 [-o <file>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ... + -o <file> Create compressed initramfs file named <file> using + gen_init_cpio and compressor depending on the extension + -u <uid> User ID to map to user ID 0 (root). + <uid> is only meaningful if <cpio_source> is a + directory. "squash" forces all files to uid 0. + -g <gid> Group ID to map to group ID 0 (root). + <gid> is only meaningful if <cpio_source> is a + directory. "squash" forces all files to gid 0. + <cpio_source> File list or directory for cpio archive. + If <cpio_source> is a .cpio file it will be used + as direct input to initramfs. + -d Output the default cpio list. + +All options except -o and -l may be repeated and are interpreted +sequentially and immediately. -u and -g states are preserved across +<cpio_source> options so an explicit "-u 0 -g 0" is required +to reset the root/group mapping. +EOF +} + +# awk style field access +# $1 - field number; rest is argument string +field() { + shift $1 ; echo $1 +} + +list_default_initramfs() { + # echo usr/kinit/kinit + : +} + +default_initramfs() { + cat <<-EOF >> ${output} + # This is a very simple, default initramfs + + dir /dev 0755 0 0 + nod /dev/console 0600 0 0 c 5 1 + dir /root 0700 0 0 + # file /kinit usr/kinit/kinit 0755 0 0 + # slink /init kinit 0755 0 0 + EOF +} + +filetype() { + local argv1="$1" + + # symlink test must come before file test + if [ -L "${argv1}" ]; then + echo "slink" + elif [ -f "${argv1}" ]; then + echo "file" + elif [ -d "${argv1}" ]; then + echo "dir" + elif [ -b "${argv1}" -o -c "${argv1}" ]; then + echo "nod" + elif [ -p "${argv1}" ]; then + echo "pipe" + elif [ -S "${argv1}" ]; then + echo "sock" + else + echo "invalid" + fi + return 0 +} + +list_print_mtime() { + : +} + +print_mtime() { + local my_mtime="0" + + if [ -e "$1" ]; then + my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1) + fi + + echo "# Last modified: ${my_mtime}" >> ${output} + echo "" >> ${output} +} + +list_parse() { + if [ -L "$1" ]; then + return + fi + echo "$1" | sed 's/:/\\:/g; s/$/ \\/' +} + +# for each file print a line in following format +# <filetype> <name> <path to file> <octal mode> <uid> <gid> +# for links, devices etc the format differs. See gen_init_cpio for details +parse() { + local location="$1" + local name="/${location#${srcdir}}" + # change '//' into '/' + name=$(echo "$name" | sed -e 's://*:/:g') + local mode="$2" + local uid="$3" + local gid="$4" + local ftype=$(filetype "${location}") + # remap uid/gid to 0 if necessary + [ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0 + [ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0 + local str="${mode} ${uid} ${gid}" + + [ "${ftype}" = "invalid" ] && return 0 + [ "${location}" = "${srcdir}" ] && return 0 + + case "${ftype}" in + "file") + str="${ftype} ${name} ${location} ${str}" + ;; + "nod") + local dev="`LC_ALL=C ls -l "${location}"`" + local maj=`field 5 ${dev}` + local min=`field 6 ${dev}` + maj=${maj%,} + + [ -b "${location}" ] && dev="b" || dev="c" + + str="${ftype} ${name} ${str} ${dev} ${maj} ${min}" + ;; + "slink") + local target=`readlink "${location}"` + str="${ftype} ${name} ${target} ${str}" + ;; + *) + str="${ftype} ${name} ${str}" + ;; + esac + + echo "${str}" >> ${output} + + return 0 +} + +unknown_option() { + printf "ERROR: unknown option \"$arg\"\n" >&2 + printf "If the filename validly begins with '-', " >&2 + printf "then it must be prefixed\n" >&2 + printf "by './' so that it won't be interpreted as an option." >&2 + printf "\n" >&2 + usage >&2 + exit 1 +} + +list_header() { + : +} + +header() { + printf "\n#####################\n# $1\n" >> ${output} +} + +# process one directory (incl sub-directories) +dir_filelist() { + ${dep_list}header "$1" + + srcdir=$(echo "$1" | sed -e 's://*:/:g') + dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort) + + # If $dirlist is only one line, then the directory is empty + if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then + ${dep_list}print_mtime "$1" + + echo "${dirlist}" | \ + while read x; do + ${dep_list}parse ${x} + done + fi +} + +# if only one file is specified and it is .cpio file then use it direct as fs +# if a directory is specified then add all files in given direcotry to fs +# if a regular file is specified assume it is in gen_initramfs format +input_file() { + source="$1" + if [ -f "$1" ]; then + ${dep_list}header "$1" + is_cpio="$(echo "$1" | sed 's/^.*\.cpio\(\..*\)\{0,1\}/cpio/')" + if [ $2 -eq 0 -a ${is_cpio} = "cpio" ]; then + cpio_file=$1 + echo "$1" | grep -q '^.*\.cpio\..*' && is_cpio_compressed="compressed" + [ ! -z ${dep_list} ] && echo "$1" + return 0 + fi + if [ -z ${dep_list} ]; then + print_mtime "$1" >> ${output} + cat "$1" >> ${output} + else + echo "$1 \\" + cat "$1" | while read type dir file perm ; do + if [ "$type" = "file" ]; then + echo "$file \\"; + fi + done + fi + elif [ -d "$1" ]; then + dir_filelist "$1" + else + echo " ${prog}: Cannot open '$1'" >&2 + exit 1 + fi +} + +prog=$0 +root_uid=0 +root_gid=0 +dep_list= +cpio_file= +cpio_list= +output="/dev/stdout" +output_file="" +is_cpio_compressed= +compr="gzip -n -9 -f" + +arg="$1" +case "$arg" in + "-l") # files included in initramfs - used by kbuild + dep_list="list_" + echo "deps_initramfs := $0 \\" + shift + ;; + "-o") # generate compressed cpio image named $1 + shift + output_file="$1" + cpio_list="$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)" + output=${cpio_list} + echo "$output_file" | grep -q "\.gz$" \ + && [ -x "`which gzip 2> /dev/null`" ] \ + && compr="gzip -n -9 -f" + echo "$output_file" | grep -q "\.bz2$" \ + && [ -x "`which bzip2 2> /dev/null`" ] \ + && compr="bzip2 -9 -f" + echo "$output_file" | grep -q "\.lzma$" \ + && [ -x "`which lzma 2> /dev/null`" ] \ + && compr="lzma -9 -f" + echo "$output_file" | grep -q "\.xz$" \ + && [ -x "`which xz 2> /dev/null`" ] \ + && compr="xz --check=crc32 --lzma2=dict=1MiB" + echo "$output_file" | grep -q "\.lzo$" \ + && [ -x "`which lzop 2> /dev/null`" ] \ + && compr="lzop -9 -f" + echo "$output_file" | grep -q "\.lz4$" \ + && [ -x "`which lz4 2> /dev/null`" ] \ + && compr="lz4 -l -9 -f" + echo "$output_file" | grep -q "\.cpio$" && compr="cat" + shift + ;; +esac +while [ $# -gt 0 ]; do + arg="$1" + shift + case "$arg" in + "-u") # map $1 to uid=0 (root) + root_uid="$1" + [ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0) + shift + ;; + "-g") # map $1 to gid=0 (root) + root_gid="$1" + [ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0) + shift + ;; + "-d") # display default initramfs list + default_list="$arg" + ${dep_list}default_initramfs + ;; + "-h") + usage + exit 0 + ;; + *) + case "$arg" in + "-"*) + unknown_option + ;; + *) # input file/dir - process it + input_file "$arg" "$#" + ;; + esac + ;; + esac +done + +# If output_file is set we will generate cpio archive and compress it +# we are careful to delete tmp files +if [ ! -z ${output_file} ]; then + if [ -z ${cpio_file} ]; then + timestamp= + if test -n "$KBUILD_BUILD_TIMESTAMP"; then + timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)" + if test -n "$timestamp"; then + timestamp="-t $timestamp" + fi + fi + cpio_tfile="$(mktemp ${TMPDIR:-/tmp}/cpiofile.XXXXXX)" + usr/gen_init_cpio $timestamp ${cpio_list} > ${cpio_tfile} + else + cpio_tfile=${cpio_file} + fi + rm ${cpio_list} + if [ "${is_cpio_compressed}" = "compressed" ]; then + cat ${cpio_tfile} > ${output_file} + else + (cat ${cpio_tfile} | ${compr} - > ${output_file}) \ + || (rm -f ${output_file} ; false) + fi + [ -z ${cpio_file} ] && rm ${cpio_tfile} +fi +exit 0 diff --git a/target/linux/Config.in.kernelversion b/target/linux/Config.in.kernelversion index bd090841f..48fccb105 100644 --- a/target/linux/Config.in.kernelversion +++ b/ |