diff --git a/src/freedombone-image-customise b/src/freedombone-image-customise
index 0b05dea0a5b80ad50a2923365d14e4b8d8e84417..a1ebf5f604c86bd08317684b356c916f93562536 100755
--- a/src/freedombone-image-customise
+++ b/src/freedombone-image-customise
@@ -829,7 +829,7 @@ EOF
 
 install_bmx7() {
     # shellcheck disable=SC2086
-    chroot "$rootdir" $INSTALL_PACKAGES libjson-c-dev zlib1g-dev libiw-dev wget cmake pkg-config
+    chroot "$rootdir" $INSTALL_PACKAGES libjson-c-dev zlib1g-dev libiw-dev wget cmake pkg-config lua5.1 liblua5.1-0-dev dh-autoreconf
 
 
     git clone "$BMX7_REPO" "$rootdir/etc/bmx7"
@@ -847,14 +847,31 @@ if ! make; then
 fi
 make install
 
+cd /etc
+git clone https://github.com/json-c/json-c.git
+cd json-c
+sh ./autogen.sh
+./configure
+if ! make; then
+    exit 2
+fi
+make install
+
+cd /etc
+git clone https://git.openwrt.org/project/libubox.git
+cd libubox
+cmake .
+if ! make; then
+    exit 3
+fi
+make install
+
 cd /etc
 git clone https://git.openwrt.org/project/uci.git
 cd uci
 git checkout 5d2bf09ec594d97eb9284b8c721dbfe10b81a6f6 -b 5d2bf09ec594d97eb9284b8c721dbfe10b81a6f6
-mkdir build
-cd build
-if ! cmake ..; then
-    exit 2
+if ! cmake .; then
+    exit 4
 fi
 make clean all install WOPTS="-pedantic -Wall"
 make install
@@ -862,7 +879,7 @@ make install
 cd /etc/bmx7
 git checkout $BMX7_COMMIT -b $BMX7_COMMIT
 if ! make build_all EXTRA_CFLAGS="-DTRAFFIC_DUMP -DCRYPTLIB=MBEDTLS_${MBEDTLS_VERSION}"; then
-    exit 3
+    exit 5
 fi
 make install