Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) # Copyright (C) Martin Schlemmer <azarah@nosferatu.za.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) # Copyright (C) 2006 Sam Ravnborg <sam@ravnborg.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) # Released under the terms of the GNU GPL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) # Generate a cpio packed initramfs. It uses gen_init_cpio to generate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) # the cpio archive.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) # This script assumes that gen_init_cpio is located in usr/ directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) # error out on errors
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) set -e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) usage() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) cat << EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) Usage:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) $0 [-o <file>] [-l <dep_list>] [-u <uid>] [-g <gid>] {-d | <cpio_source>} ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 	-o <file>      Create initramfs file named <file> by using gen_init_cpio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 	-l <dep_list>  Create dependency list named <dep_list>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	-u <uid>       User ID to map to user ID 0 (root).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 		       <uid> is only meaningful if <cpio_source> is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 		       directory.  "squash" forces all files to uid 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	-g <gid>       Group ID to map to group ID 0 (root).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 		       <gid> is only meaningful if <cpio_source> is a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 		       directory.  "squash" forces all files to gid 0.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 	<cpio_source>  File list or directory for cpio archive.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 		       If <cpio_source> is a .cpio file it will be used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 		       as direct input to initramfs.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) All options except -o and -l may be repeated and are interpreted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) sequentially and immediately.  -u and -g states are preserved across
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) <cpio_source> options so an explicit "-u 0 -g 0" is required
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) to reset the root/group mapping.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) EOF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) # awk style field access
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) # $1 - field number; rest is argument string
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) field() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	shift $1 ; echo $1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) filetype() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	local argv1="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	# symlink test must come before file test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	if [ -L "${argv1}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 		echo "slink"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	elif [ -f "${argv1}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		echo "file"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	elif [ -d "${argv1}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		echo "dir"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	elif [ -b "${argv1}" -o -c "${argv1}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		echo "nod"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	elif [ -p "${argv1}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		echo "pipe"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	elif [ -S "${argv1}" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		echo "sock"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 		echo "invalid"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) print_mtime() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	local my_mtime="0"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	if [ -e "$1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		my_mtime=$(find "$1" -printf "%T@\n" | sort -r | head -n 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	echo "# Last modified: ${my_mtime}" >> $cpio_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	echo "" >> $cpio_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) list_parse() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	if [ -z "$dep_list" -o -L "$1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 		return
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	echo "$1" | sed 's/:/\\:/g; s/$/ \\/' >> $dep_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) # for each file print a line in following format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) # <filetype> <name> <path to file> <octal mode> <uid> <gid>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) # for links, devices etc the format differs. See gen_init_cpio for details
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) parse() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	local location="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	local name="/${location#${srcdir}}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	# change '//' into '/'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	name=$(echo "$name" | sed -e 's://*:/:g')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	local mode="$2"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	local uid="$3"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	local gid="$4"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	local ftype=$(filetype "${location}")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	# remap uid/gid to 0 if necessary
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	[ "$root_uid" = "squash" ] && uid=0 || [ "$uid" -eq "$root_uid" ] && uid=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	[ "$root_gid" = "squash" ] && gid=0 || [ "$gid" -eq "$root_gid" ] && gid=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	local str="${mode} ${uid} ${gid}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	[ "${ftype}" = "invalid" ] && return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	[ "${location}" = "${srcdir}" ] && return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	case "${ftype}" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		"file")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			str="${ftype} ${name} ${location} ${str}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		"nod")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			local dev="`LC_ALL=C ls -l "${location}"`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			local maj=`field 5 ${dev}`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 			local min=`field 6 ${dev}`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			maj=${maj%,}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			[ -b "${location}" ] && dev="b" || dev="c"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			str="${ftype} ${name} ${str} ${dev} ${maj} ${min}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		"slink")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 			local target=`readlink "${location}"`
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 			str="${ftype} ${name} ${target} ${str}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			str="${ftype} ${name} ${str}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	echo "${str}" >> $cpio_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	return 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) unknown_option() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	printf "ERROR: unknown option \"$arg\"\n" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	printf "If the filename validly begins with '-', " >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	printf "then it must be prefixed\n" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	printf "by './' so that it won't be interpreted as an option." >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	printf "\n" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	usage >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) header() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	printf "\n#####################\n# $1\n" >> $cpio_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) # process one directory (incl sub-directories)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) dir_filelist() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	header "$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	srcdir=$(echo "$1" | sed -e 's://*:/:g')
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	# If $dirlist is only one line, then the directory is empty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	if [  "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 		print_mtime "$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 		echo "${dirlist}" | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		while read x; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 			list_parse $x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 			parse $x
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) input_file() {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	source="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	if [ -f "$1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 		# If a regular file is specified, assume it is in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 		# gen_init_cpio format
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 		header "$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 		print_mtime "$1" >> $cpio_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 		cat "$1"         >> $cpio_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		if [ -n "$dep_list" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		        echo "$1 \\"  >> $dep_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 			cat "$1" | while read type dir file perm ; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 				if [ "$type" = "file" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 					echo "$file \\" >> $dep_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 				fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 			done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	elif [ -d "$1" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		# If a directory is specified then add all files in it to fs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 		dir_filelist "$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 		echo "  ${prog}: Cannot open '$1'" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) prog=$0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) root_uid=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) root_gid=0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) dep_list=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) cpio_list=$(mktemp ${TMPDIR:-/tmp}/cpiolist.XXXXXX)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) output="/dev/stdout"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) trap "rm -f $cpio_list" EXIT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) while [ $# -gt 0 ]; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	arg="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	case "$arg" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		"-l")	# files included in initramfs - used by kbuild
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 			dep_list="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 			echo "deps_initramfs := \\" > $dep_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 			shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		"-o")	# generate cpio image named $1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			output="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		"-u")	# map $1 to uid=0 (root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 			root_uid="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 			[ "$root_uid" = "-1" ] && root_uid=$(id -u || echo 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 			shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		"-g")	# map $1 to gid=0 (root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 			root_gid="$1"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 			[ "$root_gid" = "-1" ] && root_gid=$(id -g || echo 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 			shift
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		"-h")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 			usage
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 			exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 		*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 			case "$arg" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 				"-"*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 					unknown_option
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 					;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 				*)	# input file/dir - process it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 					input_file "$arg"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 					;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 			esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 	esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) # If output_file is set we will generate cpio archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) # we are careful to delete tmp files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) timestamp=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) if test -n "$KBUILD_BUILD_TIMESTAMP"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 	timestamp="$(date -d"$KBUILD_BUILD_TIMESTAMP" +%s || :)"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	if test -n "$timestamp"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 		timestamp="-t $timestamp"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) usr/gen_init_cpio $timestamp $cpio_list > $output