mirror of
https://github.com/adron-s/mtik_initrd_hacks.git
synced 2026-01-28 00:17:17 +01:00
Added support for mips ARCH and RouterOS 6.45.6
- Support for multi-arch: arm and mips. - Support for RouterOS 6.45.6.
This commit is contained in:
parent
5cfbf786f7
commit
85ffaded3d
18 changed files with 76 additions and 69 deletions
15
README.md
15
README.md
|
|
@ -6,10 +6,10 @@ All that you do is at your own risk!
|
|||
The author has not liable for any of you actions and their consequences!
|
||||
This code is presented as is and is solely for educational purposes ONLY!
|
||||
|
||||
0) Use RouterOS 6.44 or 7.0b1!
|
||||
0) Use RouterOS 6.45.6 or 7.0b1!
|
||||
1) Upload(using FTP) content of ./for_ftp_upload/pub/* to /pub
|
||||
(or /flash/rw/disk/pub) folder on target RouterOS device
|
||||
2) Netboot with kernel-new.elf
|
||||
(or /flash or /flash/rw/disk/pub) folder on target RouterOS device
|
||||
2) Netboot(via bootp and tftp) with kernel-new.elf
|
||||
3) telnet x.x.x.x 22111
|
||||
|
||||
Все что вы делаете, вы делаете на свой страх и риск!
|
||||
|
|
@ -21,13 +21,14 @@ For Developers:
|
|||
cd ./finder
|
||||
./Build.sh
|
||||
cd ..
|
||||
./unpack-npk.sh ./ros/routeros-7.0beta1-arm.npk
|
||||
edit ./globals.sh and set your target device ARCH: arm or mips
|
||||
./unpack-npk.sh ./ros/routeros-mipsbe-6.45.6.npk
|
||||
./unpack-kernel.sh
|
||||
cd ./init
|
||||
./compile_for_arm.sh
|
||||
./compile.sh
|
||||
cd ..
|
||||
Make the necessary changes to the ./cpio-fs(compile add add busybox, etc...)
|
||||
Make the necessary changes to the ./cpio-fs-ARCH(compile add add busybox, etc...)
|
||||
In the end, when everything is ready, to get ./bins/kernel-new.elf, run: ./pack-kernel.sh
|
||||
Upload content of ./for_ftp_upload/pub/* to target RouterOS device via FTP(to /pub or /flash/rw/disk/pub)
|
||||
Upload content of ./for_ftp_upload/pub/* to target RouterOS device via FTP(to /pub or /flash or ...)
|
||||
Put ./bins/kernel-new.elf to your tftp and Netboot from it
|
||||
telnet x.x.x.x 22111
|
||||
|
|
|
|||
BIN
cpio-fs-mips/bin/busybox
Executable file
BIN
cpio-fs-mips/bin/busybox
Executable file
Binary file not shown.
1
cpio-fs-mips/bin/busybox.readme
Normal file
1
cpio-fs-mips/bin/busybox.readme
Normal file
|
|
@ -0,0 +1 @@
|
|||
busybox скомпилен вот тут: /home/prog/openwrt/switch/mikrotik-tools-master/busybox-arm-soft-float
|
||||
BIN
cpio-fs-mips/init
Executable file
BIN
cpio-fs-mips/init
Executable file
Binary file not shown.
BIN
cpio-fs-mips/oldinit
Executable file
BIN
cpio-fs-mips/oldinit
Executable file
Binary file not shown.
BIN
cpio-fs-mips/order
Executable file
BIN
cpio-fs-mips/order
Executable file
Binary file not shown.
Binary file not shown.
25
globals.sh
Normal file
25
globals.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#(C) Sergey Sergeev aka adron, 2019
|
||||
#
|
||||
|
||||
#TARGET_ARCH="arm"
|
||||
TARGET_ARCH="mips"
|
||||
|
||||
[ ${TARGET_ARCH} = "arm" ] && {
|
||||
OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq806x
|
||||
export STAGING_DIR=$OPENWRT_DIR/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
#OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq4xxx
|
||||
#export STAGING_DIR=${OPENWRT_DIR}/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
}
|
||||
|
||||
[ ${TARGET_ARCH} = "mips" ] && {
|
||||
#I use: https://downloads.openwrt.org/releases/18.06.4/targets/ar71xx/generic/openwrt-sdk-18.06.4-ar71xx-generic_gcc-7.3.0_musl.Linux-x86_64.tar.xz
|
||||
OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-sdk-18.06.4-ar71xx-generic_gcc-7.3.0_musl.Linux-x86_64
|
||||
export STAGING_DIR=$OPENWRT_DIR/staging_dir/toolchain-mips_24kc_gcc-7.3.0_musl
|
||||
}
|
||||
|
||||
GCC=$STAGING_DIR/bin/${TARGET_ARCH}-openwrt-linux-gcc
|
||||
OBJDUMP=$STAGING_DIR/bin/${TARGET_ARCH}-openwrt-linux-objdump
|
||||
OBJCOPY=$STAGING_DIR/bin/${TARGET_ARCH}-openwrt-linux-objcopy
|
||||
LD=$STAGING_DIR/bin/${TARGET_ARCH}-openwrt-linux-ld
|
||||
24
init/compile.sh
Executable file
24
init/compile.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
#(C) Sergey Sergeev aka adron, 2019
|
||||
#
|
||||
|
||||
. ../globals.sh
|
||||
|
||||
#for 7.0rc1 we need gcc with soft-float ONLY!
|
||||
#apt-get install gcc-arm-linux-gnueabi
|
||||
[ ${TARGET_ARCH} = "arm" ] && {
|
||||
GCC=arm-linux-gnueabi-gcc
|
||||
OBJCOPY=arm-linux-gnueabi-objcopy
|
||||
}
|
||||
|
||||
CPIO_FS="../cpio-fs-${TARGET_ARCH}"
|
||||
|
||||
$GCC -static ./init.c -o ${CPIO_FS}/init
|
||||
$OBJCOPY --strip-all ${CPIO_FS}/init ${CPIO_FS}/init
|
||||
|
||||
#exit 0
|
||||
|
||||
cd ../
|
||||
./pack-kernel.sh
|
||||
#./ftp_upload.sh
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
#(C) Sergey Sergeev aka adron, 2019
|
||||
#
|
||||
|
||||
#OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/LAST/openwrt
|
||||
#export STAGING_DIR=$OPENWRT_DIR/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.2.0_glibc_eabi
|
||||
#TOOLCHAIN_PREFIX="arm-openwrt-linux"
|
||||
#OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/LAST/openwrt
|
||||
#export STAGING_DIR=$OPENWRT_DIR/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-9.2.0_musl_eabi
|
||||
#TOOLCHAIN_PREFIX="arm-openwrt-linux"
|
||||
#OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq806x
|
||||
#export STAGING_DIR=$OPENWRT_DIR/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
#TOOLCHAIN_PREFIX=arm-openwrt-linux
|
||||
#OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq4xxx
|
||||
#export STAGING_DIR=${OPENWRT_DIR}/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
|
||||
GCC=$STAGING_DIR/bin/${TOOLCHAIN_PREFIX}-gcc
|
||||
OD=$STAGING_DIR/bin/${TOOLCHAIN_PREFIX}-objdump
|
||||
OC=$STAGING_DIR/bin/${TOOLCHAIN_PREFIX}-objcopy
|
||||
LD=$STAGING_DIR/bin/${TOOLCHAIN_PREFIX}-ld
|
||||
|
||||
#for 7.0rc1 we need gcc with soft-float ONLY!
|
||||
#apt-get install gcc-arm-linux-gnueabi
|
||||
|
||||
#$GCC -static ./init.c -o ../cpio-fs/init
|
||||
#$GCC -static ./init.c -o ../cpio-fs/init
|
||||
arm-linux-gnueabi-gcc -static ./init.c -o ../cpio-fs/init
|
||||
arm-linux-gnueabi-objcopy --strip-all ../cpio-fs/init ../cpio-fs/init
|
||||
#$OC --strip-all ../cpio-fs/init ../cpio-fs/init
|
||||
|
||||
#exit 0
|
||||
|
||||
cd ../
|
||||
./pack-kernel.sh
|
||||
./ftp_upload.sh
|
||||
|
|
@ -3,16 +3,9 @@
|
|||
#(C) Sergey Sergeev aka adron, 2019
|
||||
#
|
||||
|
||||
OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq806x
|
||||
export STAGING_DIR=$OPENWRT_DIR/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
#OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq4xxx
|
||||
#export STAGING_DIR=${OPENWRT_DIR}/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
. ../globals.sh
|
||||
|
||||
GCC=$STAGING_DIR/bin/arm-openwrt-linux-gcc
|
||||
OD=$STAGING_DIR/bin/arm-openwrt-linux-objdump
|
||||
OC=$STAGING_DIR/bin/arm-openwrt-linux-objcopy
|
||||
LD=$STAGING_DIR/bin/arm-openwrt-linux-ld
|
||||
|
||||
$OD ../cpio-fs/oldinit -x > ./oldinit.objdump
|
||||
$OD ../cpio-fs/init -x > ./init.objdump
|
||||
CPIO_FS="../cpio-fs-${TARGET_ARCH}"
|
||||
|
||||
$OBJDUMP ${CPIO_FS}/oldinit -x > ./oldinit.objdump
|
||||
$OBJDUMP ${CPIO_FS}/init -x > ./init.objdump
|
||||
|
|
|
|||
|
|
@ -3,19 +3,10 @@
|
|||
#(C) Sergey Sergeev aka adron, 2019
|
||||
#
|
||||
|
||||
|
||||
OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq806x
|
||||
export STAGING_DIR=$OPENWRT_DIR/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
#OPENWRT_DIR=/home/prog/openwrt/lede-all/2019-openwrt-all/openwrt-ipq4xxx
|
||||
#export STAGING_DIR=${OPENWRT_DIR}/staging_dir/toolchain-arm_cortex-a7+neon-vfpv4_gcc-7.4.0_musl_eabi
|
||||
|
||||
GCC=$STAGING_DIR/bin/arm-openwrt-linux-gcc
|
||||
OBJDUMP=$STAGING_DIR/bin/arm-openwrt-linux-objdump
|
||||
OBJCOPY=$STAGING_DIR/bin/arm-openwrt-linux-objcopy
|
||||
LD=$STAGING_DIR/bin/arm-openwrt-linux-ld
|
||||
. ./globals.sh
|
||||
|
||||
ROOT=$(pwd)
|
||||
cd ./cpio-fs
|
||||
cd ./cpio-fs-${TARGET_ARCH}
|
||||
find . 2>/dev/null | cpio --quiet -o --format='newc' | \
|
||||
xz --check=crc32 --lzma2=dict=512KiB > ${ROOT}/bins/kernel.p3-new.xz
|
||||
cd ${ROOT}
|
||||
|
|
@ -25,3 +16,6 @@ cat ./bins/kernel.p2.xz ./bins/kernel.p3-new.xz > ./bins/kernel-new.combo
|
|||
${OBJCOPY} --update-section initrd=./bins/kernel-new.combo ./bins/kernel.elf ./bins/kernel-new.elf
|
||||
|
||||
#cat ./bins/kernel-new.elf > /var/lib/tftpboot/linux_t1.bin
|
||||
|
||||
#now update busybox for current ARCH
|
||||
cat ./cpio-fs-${TARGET_ARCH}/bin/busybox > ./for_ftp_upload/pub/OWL/bin/busybox
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#(C) Sergey Sergeev aka adron, 2019
|
||||
#
|
||||
|
||||
. ./globals.sh
|
||||
|
||||
_kernel_bin_binwalk=""
|
||||
kernel_bin_binwalk(){
|
||||
[ -z "${_kernel_bin_binwalk}" ] && \
|
||||
|
|
@ -86,10 +88,11 @@ truncate_kernel_p3(){
|
|||
|
||||
extract_kernel_cpiofs(){
|
||||
local ROOT=$(pwd)
|
||||
rm -Rf ./cpio-fs
|
||||
mkdir ./cpio-fs
|
||||
cd ./cpio-fs
|
||||
rm -Rf ./cpio-fs-${TARGET_ARCH}
|
||||
mkdir ./cpio-fs-${TARGET_ARCH}
|
||||
cd ./cpio-fs-${TARGET_ARCH}
|
||||
xzcat ${ROOT}/bins/kernel.p3.xz | cpio -idv
|
||||
cp ./init ./oldinit
|
||||
}
|
||||
|
||||
unpack_kernel_bin
|
||||
|
|
@ -102,4 +105,6 @@ unpack_kernel_bin
|
|||
|
||||
extract_kernel_elf
|
||||
|
||||
#extract_kernel_cpiofs
|
||||
#if cpio-fs dir is empty
|
||||
ls -1qA ./cpio-fs-mips/ | grep -q . || \
|
||||
extract_kernel_cpiofs
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue