#include #include #include #include #include #include #include #include #include #include #include #include #include "kexec.h" // Offsets same as in kernel asm/kexec.h #define KEXEC_ARM_ATAGS_OFFSET 0x1000 #define KEXEC_ARM_ZIMAGE_OFFSET 0x8000 #define MEMORY_SIZE 0x0800000 // Physical buffer address cannot overlap with other regions #define START_ADDRESS 0x44000000 #define ROUND_TO_PAGE(address, pagesize) (((address) + (pagesize)-1) & (~((pagesize)-1))) /* * Gives file position and resets current position to begining of file */ int get_file_size(int f) { struct stat st; fstat(f, &st); return st.st_size; } int test_kexeccall() { int rv; rv = kexec_load(0, 0, NULL, KEXEC_ARCH_DEFAULT); if (rv != 0) { printf("ERROR: kexec_load: %d \n", errno); return 1; } printf("Kexec test: Success \n"); return 0; } void usage(void) { fprintf(stderr, "usage: kexecload [