Implementing a network stack, maybe with reduced functions and written directly in C and/or Assembly, should keep the size of the OS low. It's a lot of work, and at some point you will need to make a careful evaluation between the effort and the result you want to reach. Also it wouldn't be bad if you allowed a certain margin of flexibility: 60 MB instead of 50 MB shouldn't be a big problem, and a lot of assembly code fits in 10 MB. For updates you need to plan a dedicated repository, because the software has to be dedicated, not use packages from the standard distros. Yes, a hyper-optimized 50 MB system is a lot of work, and in fact embedded systems generally have very outdated software versions.