Created
June 19, 2012 23:07
-
-
Save dwalters-zz/2957075 to your computer and use it in GitHub Desktop.
Extract kernal and root filesystem images from the Linksys EA3500 firmware.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Requires Ruby 1.9, and extracts the uImage header, kernel, and jffs root image from a stock | |
# firmware. | |
Encoding.default_external = "binary" | |
FW_FILENAME = "FW_EA3500_1.0.30.126544.SSA" | |
data = File.read(FW_FILENAME) | |
fs_offset = data.index("\x00\x00\x85\x19".force_encoding("binary")) + 2 | |
puts "found jffs2 root at offset 0x%x" % [fs_offset] | |
File.write("uImage.img", data[0, fs_offset]) | |
File.write("jffs2.rootfs.img", data[fs_offset..-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment