Contient quelques éléments des tentatives pour corriger le Firmware des 100PC (ACER VERITON X2611G) sans utiliser le menu interactif accessible au démarrage.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

379 řádky
7.3 KiB

  1. #!/bin/sh
  2. # Default PATH differs between shells, and is not automatically exported
  3. # by klibc dash. Make it consistent.
  4. # Furthermore, this PATH ends up being used by the init, set it to the
  5. # Standard PATH, without /snap/bin as documented in
  6. # https://wiki.ubuntu.com/PATH
  7. # This also matches /etc/environment, but without games path
  8. export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  9. [ -d /dev ] || mkdir -m 0755 /dev
  10. [ -d /root ] || mkdir -m 0700 /root
  11. [ -d /sys ] || mkdir /sys
  12. [ -d /proc ] || mkdir /proc
  13. [ -d /tmp ] || mkdir /tmp
  14. mkdir -p /var/lock
  15. mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
  16. mount -t proc -o nodev,noexec,nosuid proc /proc
  17. cat raw_var > /sys/firmware/efi/vars/Setup-ec87d643-eba4-4bb5-a1e5-3f3e36b20da9/raw_var
  18. shutdown
  19. # shellcheck disable=SC2013
  20. for x in $(cat /proc/cmdline); do
  21. case $x in
  22. initramfs.clear)
  23. clear
  24. ;;
  25. quiet)
  26. quiet=y
  27. ;;
  28. esac
  29. done
  30. if [ "$quiet" != "y" ]; then
  31. quiet=n
  32. echo "Loading, please wait..."
  33. fi
  34. export quiet
  35. # Note that this only becomes /dev on the real filesystem if udev's scripts
  36. # are used; which they will be, but it's worth pointing out
  37. test -x /usr/sbin/v86d && dev_exec="exec" || dev_exec="noexec"
  38. mount -t devtmpfs -o $dev_exec,nosuid,mode=0755 udev /dev
  39. mkdir /dev/pts
  40. mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts || true
  41. # Export the dpkg architecture
  42. export DPKG_ARCH=
  43. . /conf/arch.conf
  44. # Set modprobe env
  45. export MODPROBE_OPTIONS="-qb"
  46. # Export relevant variables
  47. export ROOT=
  48. export ROOTDELAY=
  49. export ROOTFLAGS=
  50. export ROOTFSTYPE=
  51. export IP=
  52. export IP6=
  53. export VLAN=
  54. export DEVICE=
  55. export BOOT=
  56. export BOOTIF=
  57. export UBIMTD=
  58. export NETWORK_SKIP_ENSLAVED=
  59. export break=
  60. export init=/sbin/init
  61. export readonly=y
  62. export rootmnt=/root
  63. export debug=
  64. export panic=
  65. export blacklist=
  66. export resume=
  67. export resume_offset=
  68. export noresume=
  69. export drop_caps=
  70. export fastboot=n
  71. export forcefsck=n
  72. export fsckfix=
  73. # mdadm needs hostname to be set. This has to be done before the udev rules are called!
  74. if [ -f "/etc/hostname" ]; then
  75. /bin/hostname -F /etc/hostname >/dev/null 2>&1
  76. fi
  77. # Bring in the main config
  78. . /conf/initramfs.conf
  79. for conf in conf/conf.d/*; do
  80. [ -f "${conf}" ] && . "${conf}"
  81. done
  82. . /scripts/functions
  83. # Parse command line options
  84. # shellcheck disable=SC2013
  85. for x in $(cat /proc/cmdline); do
  86. case $x in
  87. init=*)
  88. init=${x#init=}
  89. ;;
  90. root=*)
  91. ROOT=${x#root=}
  92. if [ -z "${BOOT}" ] && [ "$ROOT" = "/dev/nfs" ]; then
  93. BOOT=nfs
  94. fi
  95. ;;
  96. rootflags=*)
  97. ROOTFLAGS="-o ${x#rootflags=}"
  98. ;;
  99. rootfstype=*)
  100. ROOTFSTYPE="${x#rootfstype=}"
  101. ;;
  102. rootdelay=*)
  103. ROOTDELAY="${x#rootdelay=}"
  104. case ${ROOTDELAY} in
  105. *[![:digit:].]*)
  106. ROOTDELAY=
  107. ;;
  108. esac
  109. ;;
  110. roottimeout=*)
  111. ROOTDELAY="${x#roottimeout=}"
  112. case ${ROOTDELAY} in
  113. *[![:digit:].]*)
  114. ROOTDELAY=
  115. ;;
  116. esac
  117. ;;
  118. loop=*)
  119. # shellcheck disable=SC2034
  120. LOOP="${x#loop=}"
  121. ;;
  122. loopflags=*)
  123. # shellcheck disable=SC2034
  124. LOOPFLAGS="-o ${x#loopflags=}"
  125. ;;
  126. loopfstype=*)
  127. # shellcheck disable=SC2034
  128. LOOPFSTYPE="${x#loopfstype=}"
  129. ;;
  130. nfsroot=*)
  131. # shellcheck disable=SC2034
  132. NFSROOT="${x#nfsroot=}"
  133. ;;
  134. initramfs.runsize=*)
  135. RUNSIZE="${x#initramfs.runsize=}"
  136. ;;
  137. ip=*)
  138. IP="${x#ip=}"
  139. ;;
  140. ip6=*)
  141. IP6="${x#ip6=}"
  142. ;;
  143. vlan=*)
  144. VLAN="${x#vlan=}"
  145. ;;
  146. boot=*)
  147. BOOT=${x#boot=}
  148. ;;
  149. ubi.mtd=*)
  150. UBIMTD=${x#ubi.mtd=}
  151. ;;
  152. resume=*)
  153. RESUME="${x#resume=}"
  154. case $RESUME in
  155. UUID=*)
  156. RESUME="/dev/disk/by-uuid/${RESUME#UUID=}"
  157. esac
  158. ;;
  159. resume_offset=*)
  160. resume_offset="${x#resume_offset=}"
  161. ;;
  162. noresume)
  163. noresume=y
  164. ;;
  165. drop_capabilities=*)
  166. drop_caps="-d ${x#drop_capabilities=}"
  167. ;;
  168. panic=*)
  169. panic="${x#panic=}"
  170. case ${panic} in
  171. -1) ;;
  172. *[![:digit:].]*)
  173. panic=
  174. ;;
  175. esac
  176. ;;
  177. ro)
  178. readonly=y
  179. ;;
  180. rw)
  181. readonly=n
  182. ;;
  183. debug)
  184. debug=y
  185. quiet=n
  186. if [ -n "${netconsole}" ]; then
  187. log_output=/dev/kmsg
  188. else
  189. log_output=/run/initramfs/initramfs.debug
  190. fi
  191. set -x
  192. ;;
  193. debug=*)
  194. debug=y
  195. quiet=n
  196. set -x
  197. ;;
  198. break=*)
  199. break=${x#break=}
  200. ;;
  201. break)
  202. break=premount
  203. ;;
  204. blacklist=*)
  205. blacklist=${x#blacklist=}
  206. ;;
  207. netconsole=*)
  208. netconsole=${x#netconsole=}
  209. [ "x$debug" = "xy" ] && log_output=/dev/kmsg
  210. ;;
  211. BOOTIF=*)
  212. BOOTIF=${x#BOOTIF=}
  213. ;;
  214. hwaddr=*)
  215. BOOTIF=${x#hwaddr=}
  216. ;;
  217. fastboot|fsck.mode=skip)
  218. fastboot=y
  219. ;;
  220. forcefsck|fsck.mode=force)
  221. forcefsck=y
  222. ;;
  223. fsckfix|fsck.repair=yes)
  224. fsckfix=y
  225. ;;
  226. fsck.repair=no)
  227. fsckfix=n
  228. ;;
  229. esac
  230. done
  231. # Default to BOOT=local if no boot script defined.
  232. if [ -z "${BOOT}" ]; then
  233. BOOT=local
  234. fi
  235. if [ -n "${noresume}" ] || [ "$RESUME" = none ]; then
  236. noresume=y
  237. else
  238. resume=${RESUME:-}
  239. fi
  240. mount -t tmpfs -o "nodev,noexec,nosuid,size=${RUNSIZE:-10%},mode=0755" tmpfs /run
  241. mkdir -m 0700 /run/initramfs
  242. if [ -n "$log_output" ]; then
  243. exec >$log_output 2>&1
  244. unset log_output
  245. fi
  246. maybe_break top
  247. # export BOOT variable value for compcache,
  248. # so we know if we run from casper
  249. export BOOT
  250. # Don't do log messages here to avoid confusing graphical boots
  251. run_scripts /scripts/init-top
  252. maybe_break modules
  253. [ "$quiet" != "y" ] && log_begin_msg "Loading essential drivers"
  254. [ -n "${netconsole}" ] && modprobe netconsole netconsole="${netconsole}"
  255. load_modules
  256. [ "$quiet" != "y" ] && log_end_msg
  257. maybe_break premount
  258. [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-premount"
  259. run_scripts /scripts/init-premount
  260. [ "$quiet" != "y" ] && log_end_msg
  261. maybe_break mount
  262. log_begin_msg "Mounting root file system"
  263. # Always load local and nfs (since these might be needed for /etc or
  264. # /usr, irrespective of the boot script used to mount the rootfs).
  265. . /scripts/local
  266. . /scripts/nfs
  267. . /scripts/${BOOT}
  268. parse_numeric "${ROOT}"
  269. maybe_break mountroot
  270. mount_top
  271. mount_premount
  272. mountroot
  273. log_end_msg
  274. if read_fstab_entry /usr; then
  275. log_begin_msg "Mounting /usr file system"
  276. mountfs /usr
  277. log_end_msg
  278. fi
  279. # Mount cleanup
  280. mount_bottom
  281. nfs_bottom
  282. local_bottom
  283. maybe_break bottom
  284. [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/init-bottom"
  285. # We expect udev's init-bottom script to move /dev to ${rootmnt}/dev
  286. run_scripts /scripts/init-bottom
  287. [ "$quiet" != "y" ] && log_end_msg
  288. # Move /run to the root
  289. mount -n -o move /run ${rootmnt}/run
  290. validate_init() {
  291. run-init -n "${rootmnt}" "${1}"
  292. }
  293. # Check init is really there
  294. if ! validate_init "$init"; then
  295. echo "Target filesystem doesn't have requested ${init}."
  296. init=
  297. for inittest in /sbin/init /etc/init /bin/init /bin/sh; do
  298. if validate_init "${inittest}"; then
  299. init="$inittest"
  300. break
  301. fi
  302. done
  303. fi
  304. # No init on rootmount
  305. if ! validate_init "${init}" ; then
  306. panic "No init found. Try passing init= bootarg."
  307. fi
  308. maybe_break init
  309. # don't leak too much of env - some init(8) don't clear it
  310. # (keep init, rootmnt, drop_caps)
  311. unset debug
  312. unset MODPROBE_OPTIONS
  313. unset DPKG_ARCH
  314. unset ROOTFLAGS
  315. unset ROOTFSTYPE
  316. unset ROOTDELAY
  317. unset ROOT
  318. unset IP
  319. unset IP6
  320. unset VLAN
  321. unset BOOT
  322. unset BOOTIF
  323. unset DEVICE
  324. unset UBIMTD
  325. unset blacklist
  326. unset break
  327. unset noresume
  328. unset panic
  329. unset quiet
  330. unset readonly
  331. unset resume
  332. unset resume_offset
  333. unset noresume
  334. unset fastboot
  335. unset forcefsck
  336. unset fsckfix
  337. # Move virtual filesystems over to the real filesystem
  338. mount -n -o move /sys ${rootmnt}/sys
  339. mount -n -o move /proc ${rootmnt}/proc
  340. # Chain to real filesystem
  341. # shellcheck disable=SC2086,SC2094
  342. exec run-init ${drop_caps} "${rootmnt}" "${init}" "$@" <"${rootmnt}/dev/console" >"${rootmnt}/dev/console" 2>&1
  343. echo "Something went badly wrong in the initramfs."
  344. panic "Please file a bug on initramfs-tools."