diff options
Diffstat (limited to 'target/linux/x86/base-files')
6 files changed, 124 insertions, 0 deletions
diff --git a/target/linux/x86/base-files/etc/config/network b/target/linux/x86/base-files/etc/config/network new file mode 100644 index 0000000..c9953a0 --- /dev/null +++ b/target/linux/x86/base-files/etc/config/network @@ -0,0 +1,26 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option type bridge + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 + option ip6assign 60 + +config interface wan + option ifname eth1 + option proto dhcp + +config interface wan6 + option ifname eth1 + option proto dhcpv6 + +config globals globals + option ula_prefix auto diff --git a/target/linux/x86/base-files/etc/inittab b/target/linux/x86/base-files/etc/inittab new file mode 100644 index 0000000..ca90fd8 --- /dev/null +++ b/target/linux/x86/base-files/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K shutdown +ttyS0::askfirst:/bin/ash --login +tty1::askfirst:/bin/ash --login diff --git a/target/linux/x86/base-files/lib/preinit/15_essential_fs_x86 b/target/linux/x86/base-files/lib/preinit/15_essential_fs_x86 new file mode 100644 index 0000000..5d54530 --- /dev/null +++ b/target/linux/x86/base-files/lib/preinit/15_essential_fs_x86 @@ -0,0 +1,8 @@ +#!/bin/sh +# Copyright (C) 2006-2010 OpenWrt.org +# Copyright (C) 2010 Vertical Communications + +do_mount_procfs() { + mount -o noatime -t proc none /proc +} + diff --git a/target/linux/x86/base-files/lib/preinit/20_check_iso b/target/linux/x86/base-files/lib/preinit/20_check_iso new file mode 100644 index 0000000..beff6eb --- /dev/null +++ b/target/linux/x86/base-files/lib/preinit/20_check_iso @@ -0,0 +1,5 @@ +check_for_iso() { + grep -qE '/dev/root.*iso9660' /proc/mounts && ramoverlay +} + +boot_hook_add preinit_mount_root check_for_iso diff --git a/target/linux/x86/base-files/lib/preinit/79_move_config b/target/linux/x86/base-files/lib/preinit/79_move_config new file mode 100644 index 0000000..1d4873d --- /dev/null +++ b/target/linux/x86/base-files/lib/preinit/79_move_config @@ -0,0 +1,15 @@ +#!/bin/sh +# Copyright (C) 2012-2015 OpenWrt.org + +move_config() { + . /lib/upgrade/platform.sh + + if platform_export_bootpart; then + mount -t ext4 -o rw,noatime "$BOOTPART" /mnt + mv -f /mnt/sysupgrade.tgz / + umount /mnt + fi +} + +boot_hook_add preinit_mount_root move_config + diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000..73ab5ef --- /dev/null +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -0,0 +1,66 @@ +platform_export_bootpart() { + local cmdline uuid disk + + if read cmdline < /proc/cmdline; then + case "$cmdline" in + *block2mtd=*) + disk="${cmdline##*block2mtd=}" + disk="${disk%%,*}" + ;; + *root=*) + disk="${cmdline##*root=}" + disk="${disk%% *}" + ;; + esac + + case "$disk" in + PARTUUID=[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]-02) + uuid="${disk#PARTUUID=}" + uuid="${uuid%-02}" + for disk in /dev/[hsv]d[a-z]; do + set -- $(dd if=$disk bs=1 skip=440 count=4 2>/dev/null | hexdump -v -e '4/1 "%02x "') + if [ "$4$3$2$1" = "$uuid" ]; then + export BOOTPART="${disk}1" + return 0 + fi + done + ;; + /dev/*) + export BOOTPART="${disk%[0-9]}1" + return 0 + ;; + esac + fi + + return 1 +} + +platform_check_image() { + [ "$#" -gt 1 ] && return 1 + + case "$(get_magic_word "$1")" in + eb48|eb63) return 0;; + *) + echo "Invalid image type" + return 1 + ;; + esac +} + +platform_copy_config() { + if [ -b "$BOOTPART" ]; then + mount -t ext4 -o rw,noatime "$BOOTPART" /mnt + cp -af "$CONF_TAR" /mnt/ + umount /mnt + fi +} + +platform_do_upgrade() { + platform_export_bootpart + + if [ -b "${BOOTPART%[0-9]}" ]; then + sync + get_image "$@" | dd of="${BOOTPART%[0-9]}" bs=4096 conv=fsync + sleep 1 + fi +} |