This appears to be a duplicate copy that was hacked, but has since bit rotted. We should kill it and if there's anything here that actually works, we should move it into the one in loader/bootinfo.c.
And then we should merge it with all the other metadata stuff. Too many cut and paste copies of that code!