DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-01-25 05:58:29

puterboy
Member
Registered: 2008-09-18
Posts: 306

My updated version of Fonz's reloaded kernel - allows larger initrds

Opening this new thread to post the code discussed in http://dns323.kood.org/forum/viewtopic. … 736#p40736

So here I am just posting the source code for the modified reloaded module.
Changes are as follows: (most are to improve efficiency of memory allocation in case you have a large running kernel, large current ramdisk, large new kernel, and large new initrd -- I have not yet had such an issue but just in case...)
1. Starting point for TAG list, KERNEL, and INITRD are now global variables that can be set in a single place (reboot.S) rather than being hard-coded into both main.c and reboot.S (In particular, this is how I get a larger initrd to work by setting INITRD to be at 4MiB. I in fact am including 2 copies of reboot.S, one with the variable set to 6MiB and one set to 8MiB)
2. Took advantage of the fact that segments load sequentially to sequence the loading and slide the minimum kernel allocation address to allow for more efficient usage of memory allocation. In particular, the load_file routine (and other similar instances) are given a variable of where memory can start  based on where previous segments end. The basic idea is that since reboot.S copies one word at a time we only need to stay one word ahead of ourselves as long as we load into memory in the same order that we copy it over in reboot.S. This resulted also in reordering of reboot.S code.
3. Added memory allocation __GFP_REPEAT which makes kernel try harder to free up memory
4. Changed initrd_size from int to unsigned long (not consequential but right)
5. Added retry logic to memory allocation for loading tag_list and boot code
6. Fixed size of flush_icache_range (was off by 1 byte)
7. In reboot.S allowed the number of segments available for the initrd to be a variable based on INITRD_SIZE
8. I also added a build script.

So anyway here is the code -- it should compile without issues on the standard ulibc toolchain.
I have included to precompiled reloaded kernels one for a 6MiB initrd start (larger initrd) and one with a standard 8MiB initrd start -- this shouldn't make any practical difference since the initrd is only used during boot. Both are compiled with the stock 2.6.12.6 kernel and have been tested on fw1.05 and fw1.09.

ENJOY

Last edited by puterboy (2011-01-25 05:59:43)


Attachments:
Attachment Icon dns323-reloaded-0.7.167-jjk.tgz, Size: 14,493 bytes, Downloads: 316

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB