diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d15eaa2..ac63086 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -51,6 +51,7 @@ ;; Add some standard directories to exec-path to use in eshell (setenv "PATH" "/bin:/sbin") +(add-to-list 'load-path "/.emacs.d/") ;; Mount various needed virtual/tmp filesystem (call-process "/sbin/mount" nil "*log*" nil "-t" "proc" "proc" "/proc") @@ -59,6 +60,11 @@ (call-process "/sbin/mount" nil "*log*" nil "-t" "tmpfs" "run" "/run") (call-process "/sbin/mount" nil "*log*" nil "-t" "devtmpfs" "dev" "/dev") +(call-process "/bin/hostname" nil nil nil "emacs") + +(require 'ip) +(assign-ip '(172 16 57 10) "ens33") + (custom-set-variables '(inhibit-startup-screen t) '(initial-buffer-choice nil)) diff --git a/.emacs.d/ip.el b/.emacs.d/ip.el new file mode 100644 index 0000000..8c5eebc --- /dev/null +++ b/.emacs.d/ip.el @@ -0,0 +1,34 @@ +(defun ip-to-string (ip) + (mapconcat 'int-to-string ip ".")) + +(defun modify-ip (ip idx newval) + (let ((i (copy-tree ip))) + (setcar (nthcdr idx i) newval) + i)) + +(defun assign-ip (ip interface) + (call-process "/sbin/ip" nil "*log*" nil + "addr" + "add" + (concat (ip-to-string ip) "/24") + "broadcast" + (ip-to-string (modify-ip ip 3 255)) + "dev" + interface) + (call-process "/sbin/ip" nil "*log*" nil + "link" + "set" + "dev" + interface + "up") + (call-process "/sbin/ip" nil "*log*" nil + "route" + "add" + "default" + "via" + (ip-to-string (modify-ip ip 3 2)) + "dev" + interface)) + +(provide 'ip) + diff --git a/.gitmodules b/.gitmodules index 838fb5d..d701daf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "busybox"] path = busybox url = https://github.com/mirror/busybox +[submodule "libxml2"] + path = libxml2 + url = https://github.com/GNOME/libxml2.git diff --git a/README.md b/README.md index 9441742..5bba1c2 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,23 @@ $ make DESTDIR=$PWD/build install $ popd ``` +## Statically compiled libxml2 +The Emacs web browser requires libxml2 to work + +``` shellsession +$ pushd libxml2 +$ cmake -DBUILD_SHARED_LIBS=OFF -DLIBXML2_WITH_LZMA=OFF -DLIBXML2_WITH_ZLIB=OFF -DLIBXML_HTTP_ENABLED=OFF -DCMAKE_INSTALL_PREFIX:PATH=$PWD/build . +$ sudo cmake --build . --target install +$ popd libmxl2 +``` + ## Statically compiled Emacs We need a statically compiled version of emacs if we want to keep the rootfs minimal ``` shellsession $ pushd emacs $ ./autogen.sh -$ ./configure --with-json=no --without-x --without-libsystemd --without-gnutls --with-sound=no --without-lcms2 --without-dbus CFLAGS="-static -O3 -I$PWD/../ncurses/build/include" LDFLAGS="-static -L$PWD/../ncurses/build/lib" CC=musl-gcc CXX=musl-gcc --prefix="" +$ ./configure --with-json=no --without-x --without-libsystemd --without-gnutls --with-sound=no --without-lcms2 --without-dbus CFLAGS="-static -O3 -I$PWD/../ncurses/build/include -I$PWD/../libxml2/build/include/libxml2 -I$PWD/../zlib/build/include -I$PWD/../lzma/liblzma" LDFLAGS="-static -L$PWD/../ncurses/build/lib -L$PWD/../libxml2/build/lib -L$PWD/../zlib/build/lib -lpthread -lm -ldl" CC=musl-gcc CXX=musl-gcc --prefix="" $ make -j$(nproc) $ sudo make DESTDIR=$ROOTFS_MNT install $ popd diff --git a/libxml2 b/libxml2 new file mode 160000 index 0000000..f67dc61 --- /dev/null +++ b/libxml2 @@ -0,0 +1 @@ +Subproject commit f67dc6189fce50aec9c1446cbe8c55268564485b