Aspect-oriented programming (AOP) has been successful in modularizing crosscutting concerns in complex software systems. In this paper, we present our aspect-oriented approach to building a highly customizable embedded operating system. This is a challenging task since embedded operating systems consist of intertwined concerns often implemented using a mixture of multiple programming languages including an assembly language. Furthermore, they often contain hand-optimized code that makes clear modularization extremely difficult. We provide a two-step approach that addresses these difficulties. First, we devised an aspect-oriented programming environment AOX (AspectOriented eXtension). It supports both modularization and customization of complex software via a set of aspect-oriented mechanisms. AOX extends existing approaches in the sense that it is entirely programming language independent and provides finegrained joinpoints. Second, using AOX, we built a customizable embedded operating system we call the HEART OS. It is highly configurable and very user-friendly. AOX has been implemented and integrated into the Eclipse IDE as a plug-in module. The HEART OS has also been implemented and ported to the XScale and x86 platforms. Our experience with AOX in building the HEART OS was very positive.