Running Linux on the
The x86isa model is capable of running a slightly modified version of Linux. This version of Linux is modified to add support for our timer and TTY devices and a few other minor changes.
To run Linux, you need to certify the books, as described in x86isa-build-instructions (Note: you do NOT need to set
00233a202564befedfeee50822fd3b4ef1fc64196bfda38b9382687005d1c2744d9e4a704efb9c5aa3f4aafcffc6c0d1fe71e7ad3eaafe591af681afbaca0144 alpine-gcc.img 9bc9b816ac751c569db4ba17f27c3d9c0ffbd1fb34e4fe129f4fc2b70a572a01e753c564e87cc3eea6f0f82b6d6595f1772ea7d310ba65290dcf86b2a45339aa alpine.img 05545c7c38547cb8c86968853cd0b2292407764bb0f3924116de19ff5d3059904b148886eff48b13871418b1cf49ecc68d16043444d0e59397086271372626f3 bzImage 859f8d7c67e32183988ae7c8fbe973e537b9e731820b3ff8c26b1f2c3f871cb961c76e5ab1f59f5e58dfc03f1332398f2f07dfe1578918cb0fdb17c89a38f87d vmlinux
The provided
While it isn't required, we recommend using the bigmem-asymmetric::bigmem-asymmetric memory model because it gives better performance. See physical-memory-model. You can execute the following in ACL2, before doing anything else, to switch:
(include-book "centaur/bigmems/bigmem-asymmetric/bigmem-asymmetric" :dir :system) (include-book "centaur/bigmems/bigmem/portcullis" :dir :system) (attach-stobj bigmem::mem bigmem-asymmetric::mem)
To load Linux, run the following in an ACL2 session (assuming
you're in the
(include-book "tools/execution/top") ;; This writes out some identity mapped page tables (init-sys-view #xF0000000 x86) ;; Enable peripherals and exception handling (!enable-peripherals t x86) (!handle-exceptions t x86) ;; This function serves as our bootloader (linux-load "<path to kernel bzImage>" "<path to rootfs archive>" ;; The following is the kernel command line. Unless you ;; know what you're doing, you don't have much reason to ;; touch this "rootfstype=ramfs console=ttyprintk ignore_loglevel root=/dev/ram0" x86 state)
This will load Linux into the model. Optionally, if you wish to be able to interact with a shell on the machine over a TCP socket, you can run:
(defttag :tty-raw) (include-raw "machine/tty-raw.lsp")
After submitting the second form, the ACL2 session will hang. At this point you can connect to localhost on TCP port 6444 using socat. Execute the following in a shell:
socat file:`tty`,rawer tcp-connect:localhost:6444
Once you connect, ACL2 should continue. Note: this utility only works in CCL and is unsound. Don't include it in proofs.
Now, all you have to do is start execution. Submit the following form to ACL2:
(x86-run-steps <n> x86)
This will tell ACL2 to execute
As Linux boots, you should see the kernel log being printed in ACL2.
Eventually, once Linux is done starting, it'll start
The modified Linux kernel has support for a block device called