mirror of
https://github.com/adron-s/mtik_initrd_hacks.git
synced 2026-01-28 00:17:17 +01:00
fix chmod bug in init.c and add USB flash drive support.
Signed-off-by: Sergey Sergeev <adron@yapic.net>
This commit is contained in:
parent
7b4c422117
commit
a6f257a42e
6 changed files with 32 additions and 6 deletions
|
|
@ -62,7 +62,8 @@ For Developers:
|
||||||
cd ..
|
cd ..
|
||||||
Make the necessary changes to the ./cpio-fs-ARCH(copy oldinit && order from ./bins/initramfs.cpio, compile add add busybox, etc...)
|
Make the necessary changes to the ./cpio-fs-ARCH(copy oldinit && order from ./bins/initramfs.cpio, compile add add busybox, etc...)
|
||||||
In the end, when everything is ready, to get ./bins/kernel-new.elf, run: ./pack-kernel.sh
|
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 or ...)
|
Upload content of ./for_ftp_upload/pub/* to target RouterOS device via FTP(to /pub or /flash or /disk1 or ...)
|
||||||
|
* /disk1 is a USB flash drive with ext3 fs
|
||||||
Put ./bins/kernel-new.elf to your tftp and Netboot from it
|
Put ./bins/kernel-new.elf to your tftp and Netboot from it
|
||||||
telnet x.x.x.x 22111
|
telnet x.x.x.x 22111
|
||||||
|
|
||||||
|
|
|
||||||
BIN
cpio-fs-arm/init
BIN
cpio-fs-arm/init
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
||||||
binary files from routeros arm 7.2rc1!
|
binary files from routeros arm 7.2.3!
|
||||||
33
init/init.c
33
init/init.c
|
|
@ -32,12 +32,21 @@ static void do_chmod(const char *fname, int perm)
|
||||||
perm, fname);
|
perm, fname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("Making %s executable\n", fname);
|
printf("chmod %d %s\n", perm, fname);
|
||||||
fchmod(fd, perm);
|
fchmod(fd, perm);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *work_dirs[ ] = { "/flash/rw/disk/pub", "/flash/rw/disk/flash/rw/disk/pub", NULL };
|
|
||||||
|
static char srd_dir[ ] = "/system/ram/disks";
|
||||||
|
static char rd_dir[ ] = "/ram/disks";
|
||||||
|
static char *work_dirs[ ] = {
|
||||||
|
"/ram/disks/disk1",
|
||||||
|
"/ram/disks/disk2",
|
||||||
|
"/flash/rw/disk/pub",
|
||||||
|
"/flash/rw/disk/flash/rw/disk/pub",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
void daemonized_OWL(void)
|
void daemonized_OWL(void)
|
||||||
{
|
{
|
||||||
int a = 0;
|
int a = 0;
|
||||||
|
|
@ -47,6 +56,16 @@ void daemonized_OWL(void)
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int work_dir_x = 0;
|
int work_dir_x = 0;
|
||||||
char *work_dir = NULL;
|
char *work_dir = NULL;
|
||||||
|
do {
|
||||||
|
//waiting for system directory to be ready
|
||||||
|
printf("Waiting for %s dir to be ready\n", srd_dir);
|
||||||
|
ret = stat(srd_dir, &sb);
|
||||||
|
sleep(10);
|
||||||
|
} while (ret != 0);
|
||||||
|
ret = symlink(srd_dir, rd_dir);
|
||||||
|
if (ret !=0) {
|
||||||
|
printf("Can't create %s->%s symlink. ret = %d !\n", rd_dir, srd_dir, ret);
|
||||||
|
}
|
||||||
while(1){
|
while(1){
|
||||||
do{//autodetect work_dir
|
do{//autodetect work_dir
|
||||||
work_dir = work_dirs[work_dir_x++];
|
work_dir = work_dirs[work_dir_x++];
|
||||||
|
|
@ -64,13 +83,19 @@ void daemonized_OWL(void)
|
||||||
snprintf(bin_busybox, sizeof(bin_busybox), "%s/OWL/bin/busybox", work_dir);
|
snprintf(bin_busybox, sizeof(bin_busybox), "%s/OWL/bin/busybox", work_dir);
|
||||||
snprintf(owl_sh, sizeof(owl_sh), "%s/OWL.sh", work_dir);
|
snprintf(owl_sh, sizeof(owl_sh), "%s/OWL.sh", work_dir);
|
||||||
if(stat(bin_busybox, &sb) == 0) {
|
if(stat(bin_busybox, &sb) == 0) {
|
||||||
if (sb.st_mode & S_IXUSR)
|
printf("busybox sb.st_mode: 0x%x, %d\n", sb.st_mode, sb.st_mode & 0x3FF);
|
||||||
|
if ((sb.st_mode & 0x3FF) != 777) {
|
||||||
do_chmod(bin_busybox, 777);
|
do_chmod(bin_busybox, 777);
|
||||||
|
}
|
||||||
|
printf("executing: busybox sh %s\n", owl_sh);
|
||||||
my_system(bin_busybox, "sh", owl_sh, work_dir);
|
my_system(bin_busybox, "sh", owl_sh, work_dir);
|
||||||
|
} else {
|
||||||
|
printf("busybox not found!\n");
|
||||||
}
|
}
|
||||||
//my_system(bin_busybox, "sh", owl_sh, work_dir);
|
//my_system(bin_busybox, "sh", owl_sh, work_dir);
|
||||||
//my_system(bin_busybox, "rm", "-Rf", "/flash/rw/disk/pub/OWL");
|
//my_system(bin_busybox, "rm", "-Rf", "/flash/rw/disk/pub/OWL");
|
||||||
//my_system(bin_busybox, "ls", "-l", "/flash/rw/disk/flash/rw/disk");
|
//my_system(bin_busybox, "sh", NULL, NULL);
|
||||||
|
//my_system(bin_busybox, "ls", "-l", "/system/ram");
|
||||||
//my_system(bin_busybox, "ls", "-l", "/system/flash/rw/disk/pub/OWL.sh");
|
//my_system(bin_busybox, "ls", "-l", "/system/flash/rw/disk/pub/OWL.sh");
|
||||||
//my_system(bin_busybox, "ls", "-l", "/system/flash/rw/disk/pub");
|
//my_system(bin_busybox, "ls", "-l", "/system/flash/rw/disk/pub");
|
||||||
//my_system(bin_busybox, "--help", NULL);
|
//my_system(bin_busybox, "--help", NULL);
|
||||||
|
|
|
||||||
BIN
ready-kernels/kernel-new-7.2.3-arm.elf
Normal file
BIN
ready-kernels/kernel-new-7.2.3-arm.elf
Normal file
Binary file not shown.
Loading…
Add table
Reference in a new issue