mirror of
https://github.com/raspberrypi/rpi-eeprom.git
synced 2026-01-20 21:13:36 +08:00
test-rpi-eeprom-config: Add test cases for large config files
This commit is contained in:
28
test/bootconf-2024.txt
Normal file
28
test/bootconf-2024.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[all]
|
||||||
|
BOOT_UART=0
|
||||||
|
WAKE_ON_GPIO=1
|
||||||
|
POWER_OFF_ON_HALT=0
|
||||||
|
[none]
|
||||||
|
userdata0=0x12345789
|
||||||
|
userdata1=0x12345789
|
||||||
|
userdata2=0x12345789
|
||||||
|
userdata3=0x12345789
|
||||||
|
userdata4=0x12345789
|
||||||
|
userdata5=0x12345789
|
||||||
|
userdata6=0x12345789
|
||||||
|
userdata7=0x12345789
|
||||||
|
userdata8=0x12345789
|
||||||
|
userdata9=0x12345789
|
||||||
|
usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
28
test/bootconf-2025.txt
Normal file
28
test/bootconf-2025.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[all]
|
||||||
|
BOOT_UART=0
|
||||||
|
WAKE_ON_GPIO=1
|
||||||
|
POWER_OFF_ON_HALT=0
|
||||||
|
[none]
|
||||||
|
userdata0=0x12345789
|
||||||
|
userdata1=0x12345789
|
||||||
|
userdata2=0x12345789
|
||||||
|
userdata3=0x12345789
|
||||||
|
userdata4=0x12345789
|
||||||
|
userdata5=0x12345789
|
||||||
|
userdata6=0x12345789
|
||||||
|
userdata7=0x12345789
|
||||||
|
userdata8=0x12345789
|
||||||
|
userdata9=0x12345789
|
||||||
|
usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789
|
||||||
|
# ++++++++++++++++++++++++++++++++++++++++++++++++!
|
||||||
@@ -107,6 +107,40 @@ check_update()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Verify that rpi-eeprom-config will apply and 2024 byte configuration file correctly.
|
||||||
|
check_conf_size_large()
|
||||||
|
{
|
||||||
|
echo "check maximum config file size"
|
||||||
|
image="${script_dir}/$1"
|
||||||
|
conf="bootconf-2024.txt"
|
||||||
|
|
||||||
|
expected_md5="$(md5sum "${conf}" | awk '{print $1}')"
|
||||||
|
|
||||||
|
TMP_EEPROM="$(mktemp)"
|
||||||
|
"${script_dir}/../rpi-eeprom-config" \
|
||||||
|
"${image}" \
|
||||||
|
--config "${conf}" \
|
||||||
|
--out "${TMP_EEPROM}"
|
||||||
|
|
||||||
|
actual_md5="$("${script_dir}/../rpi-eeprom-config" "${TMP_EEPROM}" | md5sum | awk '{print $1}')"
|
||||||
|
[ "${actual_md5}" = "${expected_md5}" ] || die "EEPROM check large config: checksum mismatch"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verify that rpi-eeprom-config will reject files exceeding 2024 bytes
|
||||||
|
check_conf_size_too_large()
|
||||||
|
{
|
||||||
|
echo "check config file which exceeds the maximum size"
|
||||||
|
image="${script_dir}/$1"
|
||||||
|
conf="bootconf-2025.txt"
|
||||||
|
|
||||||
|
expected_md5="$(md5sum "${conf}" | awk '{print $1}')"
|
||||||
|
|
||||||
|
TMP_EEPROM="$(mktemp)"
|
||||||
|
if "${script_dir}/../rpi-eeprom-config" "${image}" --config "${conf}" --out "${TMP_EEPROM}" > /dev/null 2>&1; then
|
||||||
|
die "$config should have been rejected"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
check_loopback "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt"
|
check_loopback "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt"
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
@@ -118,3 +152,9 @@ cleanup
|
|||||||
|
|
||||||
check_reduce_size "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt"
|
check_reduce_size "../firmware/critical/pieeprom-2019-05-10.bin" "bootconf-2019-05-10.txt"
|
||||||
cleanup
|
cleanup
|
||||||
|
|
||||||
|
check_conf_size_large "../firmware/critical/pieeprom-2019-05-10.bin"
|
||||||
|
cleanup
|
||||||
|
|
||||||
|
check_conf_size_too_large "../firmware/critical/pieeprom-2019-05-10.bin"
|
||||||
|
cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user