Move this code into the helper so that build-efi can use it too. Signed-off-by: Simon Glass <sjg@chromium.org>