diff --git a/tools/src/bin/create-image.rs b/tools/src/bin/create-image.rs index 653362061..6617a2cfb 100644 --- a/tools/src/bin/create-image.rs +++ b/tools/src/bin/create-image.rs @@ -15,18 +15,6 @@ use tools::xous_arguments::XousArguments; use clap::{App, Arg}; -// fn pad_file_to_4_bytes(f: &mut File) { -// while f -// .seek(SeekFrom::Current(0)) -// .expect("couldn't check file position") -// & 3 -// != 0 -// { -// println!("padding..."); -// f.seek(SeekFrom::Current(1)).expect("couldn't pad file"); -// } -// } - fn main() { env_logger::init(); let matches = App::new("Xous Image Creator") diff --git a/tools/src/tags/inie.rs b/tools/src/tags/inie.rs index dbe44198a..60d2e6d62 100644 --- a/tools/src/tags/inie.rs +++ b/tools/src/tags/inie.rs @@ -35,7 +35,11 @@ impl fmt::Display for IniE { } impl IniE { - pub fn new(entrypoint: u32, sections: Vec, data: Vec) -> IniE { + pub fn new(entrypoint: u32, sections: Vec, mut data: Vec) -> IniE { + // pad the data to 4 bytes + while data.len() & 3 != 0 { + data.push(0); + } IniE { load_offset: 0, entrypoint, diff --git a/tools/src/tags/xkrn.rs b/tools/src/tags/xkrn.rs index fde7915fb..7b9cac4fd 100644 --- a/tools/src/tags/xkrn.rs +++ b/tools/src/tags/xkrn.rs @@ -45,8 +45,12 @@ impl XousKernel { data_size: u32, bss_size: u32, entrypoint: u32, - program: Vec, + mut program: Vec, ) -> XousKernel { + // pad the program to 4 bytes + while program.len() & 3 != 0 { + program.push(0); + } XousKernel { load_offset: 0, text_offset,