Fix getopt return type. Fix oned startup in armv6l
(cherry picked from commit b1c036c91afc79cbe60ea543c04c7917754911db)