+static void fill_header_v2(char *buf, int len)
+{
+ struct fw_header_v2 *hdr = (struct fw_header_v2 *)buf;
+
+ memset(hdr, 0, sizeof(struct fw_header_v2));
+
+ hdr->version = htonl(HEADER_VERSION_V2);
+ memset(hdr->fw_version, 0xff, sizeof(hdr->fw_version));
+ strncpy(hdr->fw_version, version, strlen(version));
+ hdr->hw_id = htonl(hw_id);
+ hdr->hw_rev = htonl(hw_rev);
+
+ if (boot_info.file_size == 0)
+ memcpy(hdr->md5sum1, md5salt_normal, sizeof(hdr->md5sum1));
+ else
+ memcpy(hdr->md5sum1, md5salt_boot, sizeof(hdr->md5sum1));
+
+ hdr->kernel_la = htonl(kernel_la);
+ hdr->kernel_ep = htonl(kernel_ep);
+ hdr->fw_length = htonl(layout->fw_max_len);
+ hdr->kernel_ofs = htonl(sizeof(struct fw_header_v2));
+ hdr->kernel_len = htonl(kernel_len);
+ if (!combined) {
+ hdr->rootfs_ofs = htonl(rootfs_ofs);
+ hdr->rootfs_len = htonl(rootfs_info.file_size);
+ }
+
+ hdr->ver_hi = htons(fw_ver_hi);
+ hdr->ver_mid = htons(fw_ver_mid);
+ hdr->ver_lo = htons(fw_ver_lo);
+
+ get_md5(buf, len, hdr->md5sum1);
+}
+