aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/etrax/image
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-12-18 17:54:04 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-12-18 17:54:04 +0000
commit1080f68b2b422f1e72e402765a45d0cc3c550825 (patch)
treebd66621cafaf19ba323210d4fe7242b5ea71d458 /target/linux/etrax/image
parentb86e82e5cc54f03f9207411197e15f431d2173ff (diff)
downloadupstream-1080f68b2b422f1e72e402765a45d0cc3c550825.tar.gz
upstream-1080f68b2b422f1e72e402765a45d0cc3c550825.tar.bz2
upstream-1080f68b2b422f1e72e402765a45d0cc3c550825.zip
etrax: R.I.P.
It is broken and it is not maintained by anyone since long time. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34768
Diffstat (limited to 'target/linux/etrax/image')
-rw-r--r--target/linux/etrax/image/Config.in5
-rw-r--r--target/linux/etrax/image/Makefile42
-rwxr-xr-xtarget/linux/etrax/image/boot_linux511
-rw-r--r--target/linux/etrax/image/e100boot/Makefile34
-rw-r--r--target/linux/etrax/image/mkfimage/Makefile29
-rw-r--r--target/linux/etrax/image/mkfimage/src/Makefile4
-rw-r--r--target/linux/etrax/image/mkfimage/src/mkfimage.c72
7 files changed, 0 insertions, 697 deletions
diff --git a/target/linux/etrax/image/Config.in b/target/linux/etrax/image/Config.in
deleted file mode 100644
index 4a01de7ec2..0000000000
--- a/target/linux/etrax/image/Config.in
+++ /dev/null
@@ -1,5 +0,0 @@
-config AXIS_FIMAGE
- bool "Build fimage"
- depends TARGET_etrax
- default y
-
diff --git a/target/linux/etrax/image/Makefile b/target/linux/etrax/image/Makefile
deleted file mode 100644
index 22931d6c8e..0000000000
--- a/target/linux/etrax/image/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Copyright (C) 2006-2010 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/image.mk
-
-define Image/BuildKernel
- cp $(KDIR)/vmlinuz $(BIN_DIR)/$(IMG_PREFIX)-zImage
-endef
-
-define Image/Prepare
- cp $(LINUX_DIR)/arch/cris/boot/zImage $(KDIR)/vmlinuz
- $(MAKE) -C e100boot compile
- $(MAKE) -C mkfimage compile
- $(INSTALL_BIN) ./boot_linux $(BIN_DIR)
-endef
-
-define Image/Build/generic
- mkfimage $(KDIR)/vmlinuz $(KDIR)/vmlinuz.tmp
- cat $(KDIR)/vmlinuz.tmp $(KDIR)/root.$(1) > $(KDIR)/fimage.$(1).tmp
- dd if=$(KDIR)/fimage.$(1).tmp of=$(KDIR)/fimage.$(1) bs=$(2) conv=sync
- cp $(KDIR)/fimage.$(1) $(BIN_DIR)/$(IMG_PREFIX)-$(1)-fimage
-endef
-
-define Image/Build/jffs2-64k
- $(call prepare_generic_jffs-64k,$(KDIR)/root.jff2-64k)
- $(call Image/Build/generic,$(1),4194304)
-endef
-
-define Image/Build/squashfs
- $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
- $(call Image/Build/generic,$(1),4194304)
-endef
-
-define Image/Build
- $(call Image/Build/$(1),$(1))
-endef
-
-$(eval $(call BuildImage))
diff --git a/target/linux/etrax/image/boot_linux b/target/linux/etrax/image/boot_linux
deleted file mode 100755
index f7da261e20..0000000000
--- a/target/linux/etrax/image/boot_linux
+++ /dev/null
@@ -1,511 +0,0 @@
-#!/usr/bin/perl -w
-
-#*****************************************************************************
-#!
-#! FILE NAME : boot_linux
-#!
-#! PARAMETERS : -b <bootimage> the name of the boot image to use
-#! -d <device> the interface to use, e.g., eth1
-#! (defaults is eth0)
-#! -f save it in flash memory at address 0x10000
-#! -F save it in flash memory at address 0
-#! -h show some help
-#! -i <image> name of the image to use (default is fimage)
-#! -o <offset> the offset in the flash where the flashing
-#! starts
-#! -O <offset> the offset in the image file where the
-#! flashing starts from
-#! -p print the resulting etrax100boot command
-#! instead of executing it
-#! -s <size> how much to flash (default is the size of
-#! the flash minus the offset specified using
-#! -o or -f)
-#! -S <size> the size of the flash
-#!
-#! All sizes and offsets above can be specified as decimal
-#! numbers, or as hexadecimal numbers by prefixing them with 0x.
-#! It is also possible to use the suffixes k and M to specify
-#! kilo (1024) or mega (1048576).
-#!
-#! DESCRIPTION: Extract the start of the image and any registers that should
-#! be set from the kimage or fimage file, and then boot it.
-#!
-#! FUNCTIONS : convert_size
-#! extract_hw_settings
-#! get_dword
-#! calculate_sdram_init
-#! sdram_command
-#! print_help
-#!
-#!----------------------------------------------------------------------------
-#! HISTORY
-#!
-#! $Log: boot_linux,v $
-#! Revision 1.16 2004/11/01 16:32:27 starvik
-#! Corrected help text to avoid confusion
-#!
-#! Revision 1.15 2003/01/29 11:48:57 pkj
-#! Calculate a flash size large enough for the given image if the
-#! -S option is not specified.
-#!
-#! Revision 1.14 2002/11/18 14:40:09 pkj
-#! Make use of the --loop option to etrax100boot when initialising
-#! SDRAM memories. This requires a lot fewer options to be passed
-#! to the boot loader.
-#!
-#! Revision 1.13 2002/08/15 16:29:02 pkj
-#! * The -S option now accepts the size in bytes (just like the -s option).
-#! For backwards compatibility it still assumes sizes of 16 and less to
-#! be specified in MB.
-#! * The suffixes k and M can now be used with all sizes and offsets to
-#! specify them in kilo or mega.
-#!
-#! Revision 1.12 2002/08/15 15:27:34 pkj
-#! Use $opts{'x'} instead of $opt_x.
-#!
-#! Revision 1.11 2002/07/04 17:06:39 pkj
-#! * No longer specifies a bootfile by default (not needed any longer).
-#! * Implemented option -b to specify a bootfile.
-#! * Removed references to option -l (it was never implemented).
-#!
-#! Revision 1.10 2002/06/04 11:50:23 starvik
-#! Check if mrs_data is specified in kernelconfig (necessary for MCM)
-#!
-#! Revision 1.9 2002/01/29 10:38:26 pkj
-#! Change illegal to invalid.
-#!
-#! Revision 1.8 2001/09/13 12:32:10 pkj
-#! * Added option -S to specify the size of the flash (in MB), as -s
-#! is used to specify how much to flash nowadays.
-#! * Made the default size of the flash depend on the size of the image
-#! file. If it is bigger than 0x200100 then the flash is assumed to
-#! be 4 MB, otherwise it is assumed to be 2 MB.
-#! * Added verification of various options.
-#!
-#! Revision 1.7 2001/09/13 10:25:11 pkj
-#! Minor clean-up.
-#!
-#! Revision 1.6 2001/06/29 10:05:16 pkj
-#! Corrected check for SDRAM.
-#!
-#! Revision 1.5 2001/06/29 09:11:55 pkj
-#! Synchronised boot_elinux and boot_linux.
-#!
-#!----------------------------------------------------------------------------
-#! (C) Copyright 2001, Axis Communications AB, LUND, SWEDEN
-#!****************************************************************************
-
-#****************** INCLUDE FILES SECTION ************************************
-
-use strict;
-
-use Getopt::Std;
-use File::Basename;
-
-#****************** VARIABLE DECLARATION SECTION *****************************
-
-use vars qw($my_name %opts);
-use vars qw($text_start $cmd);
-use vars qw($image_name $image_size);
-use vars qw($offset $source_offset $flash_size $flashing_size);
-use vars qw($sdram_timing_address $sdram_config_address);
-use vars qw($sdram_precharge $sdram_nop $sdram_refresh $sdram_mrs);
-
-#****************** CONSTANT SECTION *****************************************
-
-# Register addresses
-$sdram_timing_address = "b0000008";
-$sdram_config_address = "b000000c";
-
-# SDRAM commands
-$sdram_precharge = 3;
-$sdram_nop = 0;
-$sdram_refresh = 2;
-$sdram_mrs = 1;
-
-#****************** MAIN PROGRAM SECTION *************************************
-
-# The name of this program.
-$my_name = basename($0);
-
-# Get options
-getopts('b:d:fFhi:o:O:ps:S:', \%opts);
-
-&print_help if ($opts{'h'});
-
-# Name and existance of the image
-$image_name = ($opts{'i'} ? $opts{'i'} : 'fimage');
-die "Could not find the image $image_name!\n" unless (-s $image_name);
-
-if ($opts{'f'} || $opts{'F'})
-{
- $image_size = -s $image_name;
-
- $offset = ($opts{'f'} ? 0x10000 : 0);
-
- $offset = &convert_size($opts{'o'}) if (defined($opts{'o'}));
-
- die("$my_name: Invalid destination offset\n") if ($offset !~ /^\d+$/);
-
- my $base_name = basename($image_name);
- if ($base_name eq 'timage' || $base_name eq 'flash1.img')
- {
- $source_offset = 0;
- }
- else
- {
- $source_offset = $offset;
- }
-
- $source_offset = &convert_size($opts{'O'}) if (defined($opts{'O'}));
-
- die("$my_name: Invalid source offset\n") if ($source_offset !~ /^\d+$/);
- die("$my_name: Source offset > image size\n") if ($source_offset > $image_size);
-
- if (defined($opts{'S'}))
- {
- # Backwards compatibility to allow specifying the flash size in MB
- # without using an M suffix
- $opts{'S'} .= 'M' if ($opts{'S'} =~ /^\d+$/ && $opts{'S'} <= 16);
-
- $flash_size = &convert_size($opts{'S'});
- }
- else
- {
- # Calculate a flash size large enough for the image without the checksum
- # and HWID.
- $flash_size = ($image_size - $source_offset + $offset) & 0xFFFF0000;
- }
-
- die("$my_name: Invalid flash size\n") if ($flash_size !~ /^\d+$/);
- die("$my_name: Destination offset > flash size\n") if ($offset > $flash_size);
- if (defined($opts{'s'}))
- {
- $flashing_size = &convert_size($opts{'s'});
- }
- else
- {
- $flashing_size = $flash_size - $offset;
- }
-
- die("$my_name: Invalid size to flash\n") if ($flashing_size !~ /^\d+$/);
-
- if ($flashing_size > $flash_size - $offset)
- {
- $flashing_size = $flash_size - $offset;
- printf("Warning: Flashing size limited to 0x%lx due to the offset (0x%lx) and flash size (0x%lx).\n", $flashing_size, $offset, $flash_size);
- }
-
- if ($flashing_size > $image_size - $source_offset)
- {
- $flashing_size = $image_size - $source_offset;
- printf("Warning: Flashing size limited to 0x%lx due to the offset (0x%lx) and image size (0x%lx).\n", $flashing_size, $source_offset, $image_size);
- }
-}
-
-# Create the command line to boot the image
-if (system('./etrax100boot --help > /dev/null') == 0)
-{
- $cmd = './etrax100boot';
-}
-elsif (system('svinto_boot --help > /dev/null') == 0)
-{
- $cmd = 'svinto_boot';
-}
-else
-{
- die("Cannot find e100boot program in your PATH!\n");
-}
-
-$cmd .= " --device $opts{'d'}" if ($opts{'d'});
-
-$cmd .= &extract_hw_settings;
-
-$cmd .= " --bootfile $opts{'b'}" if ($opts{'b'});
-$cmd .= " --file $image_name $text_start";
-
-if ($opts{'f'} || $opts{'F'})
-{
- $cmd .= sprintf(" --flash %lx %lx %lx --jump 0",
- hex($text_start) + $source_offset, $offset, $flashing_size);
-}
-else
-{
- $cmd .= " --jump $text_start";
-}
-
-if ($opts{'p'})
-{
- print "Command:\n$cmd\n";
-}
-else
-{
- system($cmd);
-}
-
-exit 0;
-
-#****************** FUNCTION DEFINITION SECTION ******************************
-
-#*****************************************************************************
-##
-## FUNCTION NAME: convert_size
-##
-##****************************************************************************
-
-sub convert_size
-{
- my($arg) = @_;
- my $size;
-
- if ($arg =~ /^0x([\da-fA-F]+)([kM])?$/)
- {
- $size = hex($1);
- }
- elsif ($arg =~ /^(\d+)([kM])?$/)
- {
- $size = $1;
- }
- else
- {
- return -1;
- }
-
- if (!defined($2))
- {
- return $size;
- }
- elsif ($2 eq 'k')
- {
- return $size * 1024;
- }
- elsif ($2 eq 'M')
- {
- return $size * 1048576;
- }
-}
-
-#*****************************************************************************
-##
-## FUNCTION NAME: extract_hw_settings
-##
-##****************************************************************************
-
-sub extract_hw_settings
-{
- my $data;
- my $dbg_port;
- my $sdram_enabled;
- my $return_value = "";
- my $sdram_config;
-
- # The hw information table has the following format
- #
- # "HW_PARAM_MAGIC"
- # text_start (dword)
- # serial debg port (dword)
- # sdram enabled (dword)
- # register address (dword)
- # register value (dword)
- # ...
- # 0
-
- open(FILE, "$image_name") || die("Could not open '$image_name'");
-
- while (<FILE>)
- {
- if (m/HW_PARAM_MAGIC/g)
- {
- # Seek to first byte after magic
- seek(FILE, -length($_) + pos($_), 1);
- last;
- }
- }
-
- $text_start = &get_dword;
- $dbg_port = &get_dword;
- $sdram_enabled = int(&get_dword);
-
- while (1)
- {
- my $register = &get_dword;
- my $value = &get_dword;
-
- last if ($register eq "00000000");
-
- if ($sdram_enabled)
- {
- if ($register eq $sdram_config_address)
- {
- $sdram_config = $value;
- }
- elsif ($register eq $sdram_timing_address)
- {
- $return_value .= &calculate_sdram_init($value, $sdram_config);
- next;
- }
- }
-
- $return_value .= " --setreg $register $value";
- }
-
- close(FILE);
-
- return $return_value;
-}
-
-#*****************************************************************************
-##
-## FUNCTION NAME: get_dword
-##
-##****************************************************************************
-
-sub get_dword
-{
- my $data;
-
- read(FILE, $data, 4);
- return unpack("H8", pack("V", unpack("N", $data)));
-}
-
-#*****************************************************************************
-##
-## FUNCTION NAME: calculate_sdram_init
-##
-##****************************************************************************
-
-sub calculate_sdram_init
-{
- # Refer to ETRAX 100LX Designers Reference for a description of SDRAM
- # initialization
- my $sdram_init_val = hex($_[0]);
- my $sdram_config_val = hex($_[1]);
- my $bus_width = $sdram_config_val & 0x00800000;
- my $speed;
- my $cas_latency;
- my $mrs_data;
- my $temp;
- my $return_value;
- my $value;
-
- $mrs_data = ($sdram_init_val & 0x00ff0000) >> 16;
- $sdram_init_val &= 0x8000ffff; # Make sure mrs data is 0
- $sdram_init_val |= 0x80000000; # Make sure sdram is enabled
- $speed = $sdram_init_val & 0x1000;
- $cas_latency = $sdram_init_val & 0x3;
- if ($speed) # 100 MHz
- {
- $cas_latency += 2;
- }
- else # 50 MHz
- {
- $cas_latency += 1;
- }
-
- # Calculate value of mrs_data
- # CAS latency = 2 && bus_width = 32 => 0x40
- # CAS latency = 3 && bus_width = 32 => 0x60
- # CAS latency = 2 && bus_width = 16 => 0x20
- # CAS latency = 3 && bus_width = 16 => 0x30
- if ($mrs_data == 0)
- {
- if ($bus_width == 0) # 16 bits
- {
- $mrs_data = $cas_latency == 2 ? 0x20 : 0x30;
- }
- else # 32 bits
- {
- $mrs_data = $cas_latency == 2 ? 0x40 : 0x60;
- }
- }
-
- $temp = $sdram_init_val | 0x0000c000; # Disable refresh
- $return_value .= &sdram_command($temp);
- $return_value .= " --pause 20000";
-
- $return_value .= &sdram_command($temp, $sdram_precharge);
- $return_value .= &sdram_command($temp, $sdram_nop);
-
- $return_value .= " --setreg +0 7";
- $return_value .= " --label label1";
- $return_value .= &sdram_command($temp, $sdram_refresh);
- $return_value .= &sdram_command($temp, $sdram_nop);
- $return_value .= " --loop +0 label1";
-
- $return_value .= &sdram_command($temp, $sdram_mrs, $mrs_data);
- $return_value .= &sdram_command($temp, $sdram_nop);
-
- $return_value .= &sdram_command($sdram_init_val);
-
- return $return_value;
-}
-
-#*****************************************************************************
-##
-## FUNCTION NAME: sdram_command
-##
-##****************************************************************************
-
-sub sdram_command
-{
- my($temp, $value, $mrs_data) = @_;
-
- $value ||= 0;
- if ($value == $sdram_mrs)
- {
- $value = sprintf("%lx", $temp | ($value << 9) | ($mrs_data << 16));
- }
- else
- {
- $value = sprintf("%lx", $temp | ($value << 9));
- }
-
- return " --setreg $sdram_timing_address $value";
-}
-
-#*****************************************************************************
-##
-## FUNCTION NAME: print_help
-##
-##****************************************************************************
-
-sub print_help
-{
- print "\nAXIS $my_name, ", '$Revision: 1.16 $ $Date: 2004/11/01 16:32:27 $ ', "\n";
- die <<EOT;
-Copyright (C) 2001-2002 Axis Communications AB
-
-DESCRIPTION:
- This program is used to boot (and flash) a linux image to a box.
- It tries to extract the required ETRAX 100 settings from the image file.
-
-SYNTAX:
- $my_name [options]
-
-OPTIONS:
- -b <bootfile> : The boot image to use.
- -d <device> : The network interface to use, default is eth0.
- -f : Save the image in the flash memory starting at
- address 0x10000.
- -F : Save the image in the flash memory starting at
- address 0.
- -h : Print this help text.
- -i <image> : The path and name of the image to use, default
- is fimage.
- -o <offset> : The offset in the flash where the flashing starts.
- -O <offset> : The offset in the image file where the flashing
- starts from.
- -p : Print the resulting etrax100boot command instead
- of executing it.
- -s <size> : How much to flash (default is the size of the
- flash minus the offset specified using -o or -f).
- -S <size> : The size of the flash.
-
- All sizes and offsets above can be specified as decimal numbers, or as
- hexadecimal numbers by prefixing them with 0x. It is also possible to use
- the suffixes k and M to specify kilo (1024) or mega (1048576).
-
-EOT
-}
-
-#****************** END OF FILE boot_linux ***********************************
diff --git a/target/linux/etrax/image/e100boot/Makefile b/target/linux/etrax/image/e100boot/Makefile
deleted file mode 100644
index 4a30caf72f..0000000000
--- a/target/linux/etrax/image/e100boot/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-#
-# Copyright (C) 2006 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=e100boot
-PKG_VERSION:=0.1
-PKG_RELEASE:=1
-
-PKG_SOURCE:=e100boot.tar.bz2
-PKG_SOURCE_URL:=http://www.acmesystems.it/download/owrt \
-http://download.tuxfamily.org/crisos/repository/source/
-PKG_MD5SUM:=11fd53e7824dc550e4cffbc4cd114c3e
-
-PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
-
-CRLF_WORKAROUND=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define Build/Compile
- make -C $(PKG_BUILD_DIR) STRIP=true
-endef
-
-define Build/InstallDev
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/sbl/e100boot $(BIN_DIR)/etrax100boot
-endef
-
-$(eval $(call Build/DefaultTargets))
diff --git a/target/linux/etrax/image/mkfimage/Makefile b/target/linux/etrax/image/mkfimage/Makefile
deleted file mode 100644
index 77d1cb1514..0000000000
--- a/target/linux/etrax/image/mkfimage/Makefile
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# Copyright (C) 2006 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=mkfimage
-PKG_VERSION:=0.1
-PKG_RELEASE:=1
-
-PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)
-
-include $(INCLUDE_DIR)/package.mk
-
-define Build/Compile
- mkdir -p $(PKG_BUILD_DIR)
- cp -r ./src/* $(PKG_BUILD_DIR)
- make -C $(PKG_BUILD_DIR)
-endef
-
-define Build/InstallDev
- $(INSTALL_BIN) $(PKG_BUILD_DIR)/mkfimage $(STAGING_DIR_HOST)/bin/mkfimage
-endef
-
-$(eval $(call Build/DefaultTargets))
diff --git a/target/linux/etrax/image/mkfimage/src/Makefile b/target/linux/etrax/image/mkfimage/src/Makefile
deleted file mode 100644
index 3e0b79c661..0000000000
--- a/target/linux/etrax/image/mkfimage/src/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-
-all: mkfimage
- gcc mkfimage.c -o mkfimage
-
diff --git a/target/linux/etrax/image/mkfimage/src/mkfimage.c b/target/linux/etrax/image/mkfimage/src/mkfimage.c
deleted file mode 100644
index 6904170cfe..0000000000
--- a/target/linux/etrax/image/mkfimage/src/mkfimage.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdlib.h>
-
-int main(int argc, char **argv){
- unsigned char *buffer = malloc(64 * 1024);
- struct stat s;
- unsigned int size_vmlinux = 0, real_size_vmlinux = 0;
- const unsigned char *magic_str = "ACME_PART_MAGIC";
- unsigned int loop;
- unsigned char *magic;
-
- if(argc != 3){
- printf("%s in out\n", argv[0]);
- return 1;
- }
-
- printf("Generating image\n");
-
- FILE *vmlinux = fopen(argv[1], "r");
- FILE *vmlinux_out = fopen(argv[2], "w");
- if((!vmlinux) || (!vmlinux_out)){
- printf("Error opening a file\n");
- return 1;
- }
-
- stat(argv[1], &s);
- size_vmlinux = s.st_size;
- real_size_vmlinux = (size_vmlinux & 0xffff0000) + 0x10000;
-
- printf("vmlinux = 0x%.08X / 0x%.08X\n", size_vmlinux, real_size_vmlinux);
-
- unsigned int t = fread(buffer, 1, 64 * 1024, vmlinux);
- for(loop = 0; loop < (64 * 1024) - sizeof(magic_str); loop++){
- if(buffer[loop] == magic_str[0]){
- if((magic = strstr(&buffer[loop], magic_str))){
- printf("Magic at 0x%.08X %p %p\n", magic - buffer, magic, buffer);
- printf("Found Magic %X%X%X%X\n",
- buffer[loop + strlen(magic_str)],
- buffer[loop + strlen(magic_str) + 2],
- buffer[loop + strlen(magic_str) + 1],
- buffer[loop + strlen(magic_str) + 3]);
-
- buffer[loop + strlen(magic_str)] = real_size_vmlinux >> 24;
- buffer[loop + strlen(magic_str) + 2] = (real_size_vmlinux >> 16) & 0xff;
- buffer[loop + strlen(magic_str) + 1] = (real_size_vmlinux >> 8) & 0xff;
- buffer[loop + strlen(magic_str) + 3] = (real_size_vmlinux) & 0xff;
-
- printf("Replaced with %.02X%.02X%.02X%.02X\n",
- buffer[loop + strlen(magic_str)],
- buffer[loop + strlen(magic_str) + 2],
- buffer[loop + strlen(magic_str) + 1],
- buffer[loop + strlen(magic_str) + 3]);
-
- }
- }
- }
-
- fwrite(buffer, 1, 64 * 1024, vmlinux_out);
- real_size_vmlinux -= 64 * 1024;
- do {
- real_size_vmlinux -= 64 * 1024;
- memset(buffer, 0, 64 * 1024);
- fread(buffer, 1, 64 * 1024, vmlinux);
- fwrite(buffer, 1, 64 * 1024, vmlinux_out);
- } while (real_size_vmlinux);
-
- return 0;
-}