mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
add test for two 'loadables'
Nothing too fancy. A simple test that attmpts to load two loadables and verify that they are properly unpacked in the u-boot sandbox. Signed-off-by: Karl Apsite <Karl.Apsite@dornerworks.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@ -48,6 +48,15 @@ base_its = '''
|
|||||||
load = <0x40000>;
|
load = <0x40000>;
|
||||||
entry = <0x8>;
|
entry = <0x8>;
|
||||||
};
|
};
|
||||||
|
kernel@2 {
|
||||||
|
data = /incbin/("%(loadables1)s");
|
||||||
|
type = "kernel";
|
||||||
|
arch = "sandbox";
|
||||||
|
os = "linux";
|
||||||
|
compression = "none";
|
||||||
|
%(loadables1_load)s
|
||||||
|
entry = <0x0>;
|
||||||
|
};
|
||||||
fdt@1 {
|
fdt@1 {
|
||||||
description = "snow";
|
description = "snow";
|
||||||
data = /incbin/("u-boot.dtb");
|
data = /incbin/("u-boot.dtb");
|
||||||
@ -69,6 +78,15 @@ base_its = '''
|
|||||||
%(ramdisk_load)s
|
%(ramdisk_load)s
|
||||||
compression = "none";
|
compression = "none";
|
||||||
};
|
};
|
||||||
|
ramdisk@2 {
|
||||||
|
description = "snow";
|
||||||
|
data = /incbin/("%(loadables2)s");
|
||||||
|
type = "ramdisk";
|
||||||
|
arch = "sandbox";
|
||||||
|
os = "linux";
|
||||||
|
%(loadables2_load)s
|
||||||
|
compression = "none";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
configurations {
|
configurations {
|
||||||
default = "conf@1";
|
default = "conf@1";
|
||||||
@ -76,6 +94,7 @@ base_its = '''
|
|||||||
kernel = "kernel@1";
|
kernel = "kernel@1";
|
||||||
fdt = "fdt@1";
|
fdt = "fdt@1";
|
||||||
%(ramdisk_config)s
|
%(ramdisk_config)s
|
||||||
|
%(loadables_config)s
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -103,6 +122,8 @@ bootm loados
|
|||||||
sb save hostfs 0 %(kernel_addr)x %(kernel_out)s %(kernel_size)x
|
sb save hostfs 0 %(kernel_addr)x %(kernel_out)s %(kernel_size)x
|
||||||
sb save hostfs 0 %(fdt_addr)x %(fdt_out)s %(fdt_size)x
|
sb save hostfs 0 %(fdt_addr)x %(fdt_out)s %(fdt_size)x
|
||||||
sb save hostfs 0 %(ramdisk_addr)x %(ramdisk_out)s %(ramdisk_size)x
|
sb save hostfs 0 %(ramdisk_addr)x %(ramdisk_out)s %(ramdisk_size)x
|
||||||
|
sb save hostfs 0 %(loadables1_addr)x %(loadables1_out)s %(loadables1_size)x
|
||||||
|
sb save hostfs 0 %(loadables2_addr)x %(loadables2_out)s %(loadables2_size)x
|
||||||
reset
|
reset
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@ -188,30 +209,32 @@ def make_fit(mkimage, params):
|
|||||||
print >>fd, base_fdt
|
print >>fd, base_fdt
|
||||||
return fit
|
return fit
|
||||||
|
|
||||||
def make_kernel():
|
def make_kernel(filename, text):
|
||||||
"""Make a sample kernel with test data
|
"""Make a sample kernel with test data
|
||||||
|
|
||||||
|
Args:
|
||||||
|
filename: the name of the file you want to create
|
||||||
Returns:
|
Returns:
|
||||||
Filename of kernel created
|
Full path and filename of the kernel it created
|
||||||
"""
|
"""
|
||||||
fname = make_fname('test-kernel.bin')
|
fname = make_fname(filename)
|
||||||
data = ''
|
data = ''
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
data += 'this kernel %d is unlikely to boot\n' % i
|
data += 'this %s %d is unlikely to boot\n' % (text, i)
|
||||||
with open(fname, 'w') as fd:
|
with open(fname, 'w') as fd:
|
||||||
print >>fd, data
|
print >>fd, data
|
||||||
return fname
|
return fname
|
||||||
|
|
||||||
def make_ramdisk():
|
def make_ramdisk(filename, text):
|
||||||
"""Make a sample ramdisk with test data
|
"""Make a sample ramdisk with test data
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Filename of ramdisk created
|
Filename of ramdisk created
|
||||||
"""
|
"""
|
||||||
fname = make_fname('test-ramdisk.bin')
|
fname = make_fname(filename)
|
||||||
data = ''
|
data = ''
|
||||||
for i in range(100):
|
for i in range(100):
|
||||||
data += 'ramdisk %d was seldom used in the middle ages\n' % i
|
data += '%s %d was seldom used in the middle ages\n' % (text, i)
|
||||||
with open(fname, 'w') as fd:
|
with open(fname, 'w') as fd:
|
||||||
print >>fd, data
|
print >>fd, data
|
||||||
return fname
|
return fname
|
||||||
@ -298,11 +321,15 @@ def run_fit_test(mkimage, u_boot):
|
|||||||
|
|
||||||
# Set up invariant files
|
# Set up invariant files
|
||||||
control_dtb = make_dtb()
|
control_dtb = make_dtb()
|
||||||
kernel = make_kernel()
|
kernel = make_kernel('test-kernel.bin', 'kernel')
|
||||||
ramdisk = make_ramdisk()
|
ramdisk = make_ramdisk('test-ramdisk.bin', 'ramdisk')
|
||||||
|
loadables1 = make_kernel('test-loadables1.bin', 'lenrek')
|
||||||
|
loadables2 = make_ramdisk('test-loadables2.bin', 'ksidmar')
|
||||||
kernel_out = make_fname('kernel-out.bin')
|
kernel_out = make_fname('kernel-out.bin')
|
||||||
fdt_out = make_fname('fdt-out.dtb')
|
fdt_out = make_fname('fdt-out.dtb')
|
||||||
ramdisk_out = make_fname('ramdisk-out.bin')
|
ramdisk_out = make_fname('ramdisk-out.bin')
|
||||||
|
loadables1_out = make_fname('loadables1-out.bin')
|
||||||
|
loadables2_out = make_fname('loadables2-out.bin')
|
||||||
|
|
||||||
# Set up basic parameters with default values
|
# Set up basic parameters with default values
|
||||||
params = {
|
params = {
|
||||||
@ -324,6 +351,20 @@ def run_fit_test(mkimage, u_boot):
|
|||||||
'ramdisk_size' : filesize(ramdisk),
|
'ramdisk_size' : filesize(ramdisk),
|
||||||
'ramdisk_load' : '',
|
'ramdisk_load' : '',
|
||||||
'ramdisk_config' : '',
|
'ramdisk_config' : '',
|
||||||
|
|
||||||
|
'loadables1' : loadables1,
|
||||||
|
'loadables1_out' : loadables1_out,
|
||||||
|
'loadables1_addr' : 0x100000,
|
||||||
|
'loadables1_size' : filesize(loadables1),
|
||||||
|
'loadables1_load' : '',
|
||||||
|
|
||||||
|
'loadables2' : loadables2,
|
||||||
|
'loadables2_out' : loadables2_out,
|
||||||
|
'loadables2_addr' : 0x140000,
|
||||||
|
'loadables2_size' : filesize(loadables2),
|
||||||
|
'loadables2_load' : '',
|
||||||
|
|
||||||
|
'loadables_config' : '',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Make a basic FIT and a script to load it
|
# Make a basic FIT and a script to load it
|
||||||
@ -378,6 +419,19 @@ def run_fit_test(mkimage, u_boot):
|
|||||||
if read_file(ramdisk) != read_file(ramdisk_out):
|
if read_file(ramdisk) != read_file(ramdisk_out):
|
||||||
fail('Ramdisk not loaded', stdout)
|
fail('Ramdisk not loaded', stdout)
|
||||||
|
|
||||||
|
# Configuration with some Loadables
|
||||||
|
set_test('Kernel + FDT + Ramdisk load + Loadables')
|
||||||
|
params['loadables_config'] = 'loadables = "kernel@2", "ramdisk@2";'
|
||||||
|
params['loadables1_load'] = 'load = <%#x>;' % params['loadables1_addr']
|
||||||
|
params['loadables2_load'] = 'load = <%#x>;' % params['loadables2_addr']
|
||||||
|
fit = make_fit(mkimage, params)
|
||||||
|
stdout = command.Output(u_boot, '-d', control_dtb, '-c', cmd)
|
||||||
|
debug_stdout(stdout)
|
||||||
|
if read_file(loadables1) != read_file(loadables1_out):
|
||||||
|
fail('Loadables1 (kernel) not loaded', stdout)
|
||||||
|
if read_file(loadables2) != read_file(loadables2_out):
|
||||||
|
fail('Loadables2 (ramdisk) not loaded', stdout)
|
||||||
|
|
||||||
def run_tests():
|
def run_tests():
|
||||||
"""Parse options, run the FIT tests and print the result"""
|
"""Parse options, run the FIT tests and print the result"""
|
||||||
global base_path, base_dir
|
global base_path, base_dir
|
||||||
|
Reference in New Issue
Block a user