--- media_create_original/boards.py 2011-04-04 16:32:57.029231109 +0200 +++ media_create/boards.py 2011-04-02 16:06:05.074967005 +0200 @@ -429,7 +429,7 @@ kernel_addr = '0x00100000' initrd_addr = '0x08000000' load_addr = '0x00008000' - kernel_suffix = 'u?500' + kernel_suffix = 'ux500' boot_script = 'flash.scr' extra_boot_args_options = ( 'earlyprintk rootdelay=1 fixrtc nocompcache ' @@ -447,6 +447,108 @@ make_boot_script(boot_env, boot_script_path) +class SnowballConfig(Ux500Config): + # Boot ROM looks for a boot table of contents (TOC) at 0x20000 + # Actually, it first looks at address 0, but that's where l-m-c + # puts the MBR, so the boot loader skips that address. + LOADER_START_S = (128 * 1024) / SECTOR_SIZE + + + @classmethod + def get_sfdisk_cmd(cls, should_align_boot_part=None): + """Return the sfdisk command to partition the media. + + :param should_align_boot_part: Ignored. + + This Snowball implementation returns a non-FS data bootloader partition, + followed by a FAT32 boot partition, followed by a root partition. + """ + # boot ROM expects bootloader at 0x20000, which is sector 0x100 + # with the usual SECTOR_SIZE of 0x200. + # (sector 0 is MBR / partition table) + loader_start, loader_end, loader_len = align_partition( + SnowballConfig.LOADER_START_S, LOADER_MIN_SIZE_S, 1, PART_ALIGN_S) + boot_start, boot_end, boot_len = align_partition( + loader_end + 1, BOOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S) + # we ignore _root_end / _root_len and return an sfdisk command to + # instruct the use of all remaining space; XXX if we had some root size + # config, we could do something more sensible + root_start, _root_end, _root_len = align_partition( + boot_end + 1, ROOT_MIN_SIZE_S, PART_ALIGN_S, PART_ALIGN_S) + + return '%s,%s,0xDA\n%s,%s,0x0C,*\n%s,,,-' % ( + loader_start, loader_len, boot_start, boot_len, root_start) + + + @classmethod + def get_file_info(cls, bin_dir, files): + ''' Fills in the offsets of files that are located in + non-absolute memory locations depending on their sizes.' + Also fills in file sizes''' + toc_size = 512 + ofs = toc_size + for i in range(len(files)): + section, filename, flag, address, sz = files[i] + filename = os.path.join(bin_dir, filename) + if address != 0: + ofs = address + size = os.path.getsize(filename) + files[i] = section, filename, flag, ofs, size + ofs += size + return files + + + @classmethod + def create_toc(cls, toc_filename, files): + ''' Writes a table of contents of the boot binaries. + Boot rom searches this table to find the binaries.''' + with open(toc_filename, 'wb') as f: + for item in files: + section, filename, flag, address, size = item + data = struct.pack('