Updated to work on 21.02.0
This commit is contained in:
parent
725caf2919
commit
3d02057bb6
36
README.md
36
README.md
@ -5,12 +5,15 @@ It's a script to build a customized
|
||||
firmware image using
|
||||
[ImageBuilder](https://openwrt.org/docs/guide-user/additional-software/imagebuilder).
|
||||
|
||||
If the generated image is flashed on a device it will try to automatically set up
|
||||
If the generated image is flashed on a device it will try to
|
||||
automatically set up
|
||||
[extroot](https://openwrt.org/docs/guide-user/additional-software/extroot_configuration)
|
||||
on **any (!)** storage device plugged into the USB port (`/dev/sda`). Keep in
|
||||
mind that **this will erase any inserted storage device while the
|
||||
router is in the initial setup phase**! Unfortunately there's little
|
||||
that can be done at that point to ask the user for confirmation.
|
||||
on **any (!)** storage device plugged into the USB port (`/dev/sda`),
|
||||
including your working extroot pendrive if you plug it in only later
|
||||
in the boot process. Keep in mind that **this will erase any inserted
|
||||
storage device while the router is in the initial setup phase**!
|
||||
Unfortunately there's little that can be done at that point to ask the
|
||||
user for confirmation.
|
||||
|
||||
# Why
|
||||
|
||||
@ -28,17 +31,19 @@ You can read more about the underlying technology on the OpenWRT wiki: see e.g.
|
||||
page, or the page that lists some other
|
||||
[ImageBuilder frontends](https://openwrt.org/docs/guide-developer/imagebuilder_frontends).
|
||||
|
||||
As for the actual mechanism: custom scripts are baked into the boot process of the
|
||||
flashed firmware. If the extroot overlay is properly set up, then these scripts get hidden by it;
|
||||
i.e. they will only run when the extroot has failed to mount early in the boot.
|
||||
As for the actual mechanism: custom scripts are baked into the boot
|
||||
process of the flashed firmware. If the extroot overlay is properly
|
||||
set up, then these scripts get hidden by it; i.e. they will only run
|
||||
when the extroot has failed to mount early in the boot process.
|
||||
|
||||
### Building
|
||||
|
||||
OpenWRT's ImageBuilder only works on Linux x86_64. To build a firmware, issue the following command:
|
||||
`./build.sh architecture variant device-profile`, e.g.:
|
||||
|
||||
* `./build.sh ar71xx generic tplink_tl-wr1043nd-v1`
|
||||
* `./build.sh ath79 generic tplink_tl-wr1043nd-v1`
|
||||
* `./build.sh ath79 generic tplink_archer-c6-v2`
|
||||
* `./build.sh ath79 generic tplink_tl-wdr4300-v1`
|
||||
|
||||
Results will be under `build/openwrt-imagebuilder-${release}-${architecture}-${variant}.Linux-x86_64/bin/`.
|
||||
|
||||
@ -93,11 +98,12 @@ probably want to customize this script here and there; search for
|
||||
|
||||
Most importantly, **set up a password and maybe an ssh key**.
|
||||
|
||||
At the time of writing it only supports a few `ar71xx` routers out of the box,
|
||||
but it's easy to extend it. Support for a new router entails looking up
|
||||
some led names for setLedAttribute for the user feedback through the blinking of
|
||||
the leds. It should work fine without that, but it will be less convenient to
|
||||
interact with your router in the initial setup phase.
|
||||
At the time of writing it only supports a few `ath79` routers out of
|
||||
the box, but it's easy to extend it. Support for a new router entails
|
||||
looking up some led names for `setLedAttribute` so that there's
|
||||
feedback to the user through the blinking of the leds. It should work
|
||||
fine without that, but it will be less convenient to interact with
|
||||
your router in the initial setup phase.
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
@ -105,7 +111,7 @@ interact with your router in the initial setup phase.
|
||||
|
||||
You should consult the [OpenWRT documentation](https://openwrt.org/docs/guide-user/start).
|
||||
The produced firmware files should be somewhere around
|
||||
```build/openwrt-imagebuilder-17.01.4-ar71xx-generic.Linux-x86_64/bin/ar71xx```.
|
||||
```./build/openwrt-imagebuilder-21.02.0-ath79-generic.Linux-x86_64/bin/targets/ath79/generic/```.
|
||||
|
||||
In short:
|
||||
|
||||
|
9
build.sh
9
build.sh
@ -12,7 +12,7 @@ BUILD=`readlink -f $BUILD`
|
||||
###
|
||||
### chose a release
|
||||
###
|
||||
RELEASE="19.07.6"
|
||||
RELEASE="21.02.0"
|
||||
|
||||
IMGBUILDER_NAME="openwrt-imagebuilder-${RELEASE}-${TARGET_ARCHITECTURE}-${TARGET_VARIANT}.Linux-x86_64"
|
||||
IMGBUILDER_DIR="${BUILD}/${IMGBUILDER_NAME}"
|
||||
@ -26,8 +26,9 @@ IMGBUILDERURL="https://downloads.openwrt.org/releases/${RELEASE}/targets/${TARGE
|
||||
|
||||
if [ -z ${TARGET_DEVICE} ]; then
|
||||
echo "Usage: $0 architecture variant device-profile"
|
||||
echo " e.g.: $0 ar71xx generic tplink_tl-wr1043nd-v1"
|
||||
echo " e.g.: $0 ath79 generic tplink_tl-wr1043nd-v1"
|
||||
echo " $0 ath79 generic tplink_archer-c6-v2"
|
||||
echo " $0 ath79 generic tplink_tl-wdr4300-v1"
|
||||
echo " $0 bcm53xx generic dlink-dir-885l"
|
||||
echo " (this last one will not work without editing build.sh, details: https://github.com/attila-lendvai/openwrt-auto-extroot/pull/15#issuecomment-405847440)"
|
||||
echo " to get a list of supported devices issue a 'make info' in the OpenWRT image builder directory:"
|
||||
@ -36,8 +37,8 @@ if [ -z ${TARGET_DEVICE} ]; then
|
||||
fi
|
||||
|
||||
# the absolute minimum for extroot to work at all (i.e. when the disk is already set up, for example by hand).
|
||||
# this list may be smaller and/or different for your router, but it works with my ar71xx.
|
||||
PREINSTALLED_PACKAGES="block-mount kmod-usb2 kmod-usb-storage kmod-fs-ext4"
|
||||
# this list may be smaller and/or different for your router, but it works with my ath79.
|
||||
PREINSTALLED_PACKAGES="block-mount kmod-fs-ext4 kmod-usb-storage"
|
||||
|
||||
# some kernel modules may also be needed for your hardware
|
||||
#PREINSTALLED_PACKAGES+=" kmod-usb-uhci kmod-usb-ohci"
|
||||
|
@ -10,33 +10,34 @@ rootUUID=05d615b3-bef8-460c-9a23-52db8d09e000
|
||||
dataUUID=05d615b3-bef8-460c-9a23-52db8d09e001
|
||||
swapUUID=05d615b3-bef8-460c-9a23-52db8d09e002
|
||||
|
||||
if [ -f /lib/ar71xx.sh ]; then
|
||||
. /lib/ar71xx.sh
|
||||
. /lib/functions.sh
|
||||
|
||||
# let's attempt to define some defaults...
|
||||
autoprovisionUSBLed="tp-link:green:usb"
|
||||
autoprovisionStatusLed="tp-link:green:qss"
|
||||
# let's attempt to define some defaults...
|
||||
autoprovisionUSBLed="green:usb"
|
||||
autoprovisionStatusLed="green:qss"
|
||||
|
||||
echo Board name is [$(board_name)]
|
||||
|
||||
# CUSTOMIZE
|
||||
case $(board_name) in
|
||||
*tl-wr1043nd*)
|
||||
autoprovisionUSBLed="green:usb"
|
||||
autoprovisionStatusLed="green:qss"
|
||||
;;
|
||||
*tl-mr3020*)
|
||||
autoprovisionUSBLed="green:wps"
|
||||
autoprovisionStatusLed="green:wlan"
|
||||
;;
|
||||
*tl-wr2543n*)
|
||||
autoprovisionUSBLed="green:wps"
|
||||
autoprovisionStatusLed="green:wlan5g"
|
||||
;;
|
||||
*tl-wdr4300*)
|
||||
autoprovisionUSBLed="green:wlan2g"
|
||||
autoprovisionStatusLed="green:wlan5g"
|
||||
;;
|
||||
esac
|
||||
|
||||
# CUSTOMIZE
|
||||
case $(ar71xx_board_name) in
|
||||
"tl-wr1043nd")
|
||||
autoprovisionUSBLed="tp-link:green:usb"
|
||||
autoprovisionStatusLed="tp-link:green:qss"
|
||||
;;
|
||||
"tl-mr3020")
|
||||
autoprovisionUSBLed="tp-link:green:wps"
|
||||
autoprovisionStatusLed="tp-link:green:wlan"
|
||||
;;
|
||||
"tl-wr2543n")
|
||||
autoprovisionUSBLed="tp-link:green:wps"
|
||||
autoprovisionStatusLed="tp-link:green:wlan5g"
|
||||
;;
|
||||
"tl-wdr4300")
|
||||
autoprovisionUSBLed="tp-link:blue:wan"
|
||||
autoprovisionStatusLed="tp-link:blue:qss"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
log()
|
||||
{
|
||||
|
@ -73,8 +73,8 @@ EOF
|
||||
done
|
||||
|
||||
mkswap -L swap -U $swapUUID /dev/sda1
|
||||
mkfs.ext4 -L root -U $rootUUID /dev/sda2
|
||||
mkfs.ext4 -L data -U $dataUUID /dev/sda3
|
||||
mkfs.ext4 -F -L root -U $rootUUID /dev/sda2
|
||||
mkfs.ext4 -F -L data -U $dataUUID /dev/sda3
|
||||
|
||||
log "Finished setting up filesystems"
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ installPackages()
|
||||
signalAutoprovisionWaitingForUser
|
||||
|
||||
until (opkg update)
|
||||
do
|
||||
do
|
||||
log "opkg update failed. No internet connection? Retrying in 15 seconds..."
|
||||
sleep 15
|
||||
done
|
||||
@ -50,6 +50,9 @@ autoprovisionStage2()
|
||||
else
|
||||
signalAutoprovisionWorking
|
||||
|
||||
echo Updating system time using ntp; otherwise the openwrt.org certificates are rejected as not yet valid.
|
||||
ntpd -d -q -n -p 0.openwrt.pool.ntp.org
|
||||
|
||||
# CUSTOMIZE: with an empty argument it will set a random password and only ssh key based login will work.
|
||||
# please note that stage2 requires internet connection to install packages and you most probably want to log in
|
||||
# on the GUI to set up a WAN connection. but on the other hand you don't want to end up using a publically
|
||||
|
Loading…
x
Reference in New Issue
Block a user